This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.poetry] | |
name = "extras-export" | |
version = "0.1.0" | |
description = "" | |
authors = ["Tony <[email protected]>"] | |
[tool.poetry.dependencies] | |
python = "^3.6" | |
[tool.poetry.dev-dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nose.tools import assert_equal, assert_is_not, assert_raises | |
def flatten_inheritance_dict(child_dict, parent_key, | |
expand_parent=lambda x: x): | |
"""Return a flattened version of dictionary that inherits from a parent. | |
Parameters | |
---------- | |
child_dict : dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.colors as mcolors | |
RGBS = np.asarray([mcolors.hex2color(h) for h in mcolors.cnames.values()]) | |
# Mapping from color-component name to array index | |
HSV_INDEX = dict(hue=0, saturation=1, value=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text.color: 8dd3c7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from skimage import data, color, filter, exposure | |
from skimage.util import dtype | |
from scipy.ndimage import gaussian_filter | |
lab_range = (0, 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Interactive tool to draw mask on an image or image-like array. | |
Adapted from matplotlib/examples/event_handling/poly_editor.py | |
""" | |
import numpy as np | |
# import matplotlib as mpl | |
# mpl.use('tkagg') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Automatically adjust the number of ticklabels based on label width. | |
This is a hacky attempt at an auto tick locator and misses *many* use cases. | |
To test, stretch and shrink the x-axis. | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.ticker as mtick | |
import matplotlib.axis as maxis |