crikit.utils package¶
Subpackages¶
Submodules¶
crikit.utils.breadcrumb module¶
Breadcrumb Module¶
BCPre : Container describing pre-processing steps
Class Methods¶
- HDFtoClass(filename [str], datasetname [str])Load dataset in HDF
file into the HSI Class
Bases:
object
Container that describes processing steps (ie it contains “breadcrumbs”)
- offsetint
Instead of starting at Step 0, start at offset (0 + offset)
A list-of-lists. Each contained list follows the format [‘Process Name’, ‘Var1 Name’, Val1, ‘Var2 Name’, Val2, …]. The variable names and values may be input values to the pre-processing step. Only the Process Name is mnadatory: the rest are optional.
- Type
Flag identifying which steps were backed-up to disk (e.g., for undo)
- Type
Unique identifier for each step. Can be used to name back-up/undo files
- Type
list (read-only)
Identifier of id’s cut with pop_to_last method
- Type
list (read-only)
Number of processing steps
- Type
Dictionary-version of process_list that can be written to HDF5 dataset metadata (properties)
- Type
-
add_step : Add a new processing step
-
backed_up : Mark most recent process step as backed up in backed_flag list
-
pop_to_last : Remove entries until nearest backup point (excluding current step).
Adds a steps to the list
- Parameters
process_desc (list) – List containing elements of new process with format: [‘Process Name’, ‘Var1 Name’, Val1, ‘Var2 Name’, Val2, …]. The variable names and values may be input values to the pre-processing step. Only the Process Name is mnadatory: the rest are optional.
- Returns
None
- Return type
-
property
attr_dict
Marks most recent process step as backed up in backed_flag list
Dump current state of data (class of type crikit.data.spectrum or subclass)to pickle file (filename= fname).
Can append additional attributes (addl_attr) to attribute dictionary (self.attr)
-
property
cut_list
-
property
id_list
Static method.
Return a loaded pickled version of this class (filename= fname).
-
property
num_steps
Remove entries until nearest backup point (excluding current step). That is, if current step IS a backup point, moves to previous one. If current step is NOT a backup point, moves to nearest point.
If all = True, will cut everything
crikit.utils.datacheck module¶
Functions to check and (if needed) convert input variables
Created on Sat Jun 18 00:16:27 2016
@author: chc
crikit.utils.general module¶
General utilities
expand_1d_to_ndim_data : Match 1D data array dimensionality to that of another array
expand_1d_to_ndim : Expand 1D data array dimensionality to ndim
- find_nearestGiven a vector and a value, find the index and value
of the closest match
- padWrapper around numpy.pad that also returns a window defining the
original signal
Notes
-
crikit.utils.general.
arange_nonzero
(start, stop, dtype=<class 'float'>)[source]¶ Similar to numpy arange but only returns non-zero elements
-
crikit.utils.general.
expand_1d_to_ndim_data
(data, data_to_match)[source]¶ Make 1D data array equal in dimensions to data_to_match
-
crikit.utils.general.
find_nearest
(np_vec, to_find=0)[source]¶ Given a vector and a value (or list/vector of values), find the index and value of the closest match
-
crikit.utils.general.
lin_from_row_col
(row, col, sh)[source]¶ Convert a col and row counter to 1D linear count
-
crikit.utils.general.
mean_nd_to_1d
(data, axis=-1)[source]¶ Take the mean of an nd array, except axis, returning a 1D array
-
crikit.utils.general.
np_fcn_nd_to_1d
(fcn, data, axis=-1)[source]¶ Take in an n-dimensional array and return a 1D version operated on by fcn. Works with many numpy functions that can take an “axis” parameter
-
crikit.utils.general.
pad
(y, pad_width, mode)[source]¶ Pad array with either constants or edge values.
Note: For N-D arrays, pads the -1 axis
-
crikit.utils.general.
pad_dual
(y, edge_pad_width, constant_pad_width)[source]¶ Pad array with edge values followed by constant 0’s.
Note: For N-D arrays, pads the -1 axis
- Parameters
- Returns
Padded array and window. Window defines the region of the original signal
- Return type
y_pad, window
-
crikit.utils.general.
pad_edge_mean
(y, pad_width, n_edge=1, axis=-1)[source]¶ Pad data y with edge-values or near-edge mean values along axis
- Parameters
- Returns
(y_pad, window)
y_pad (ndarray) – Padded y
window (ndarray (1D)) – Mask with 0’s for pad regions, 1’s for original size
crikit.utils.mplstyle module¶
Created on Thu Jun 30 10:23:03 2016
@author: chc
-
class
crikit.utils.mplstyle.
CrikitMplStyle
[source]¶ Bases:
object
-
_base_crikit
= {'axes.prop_cycle': cycler('color', [array([0.12156863, 0.46666667, 0.70588235]), array([1. , 0.49803922, 0.05490196]), array([0.17254902, 0.62745098, 0.17254902]), array([0.83921569, 0.15294118, 0.15686275]), array([0.58039216, 0.40392157, 0.74117647]), array([0.54901961, 0.3372549 , 0.29411765]), array([0.89019608, 0.46666667, 0.76078431]), array([0.49803922, 0.49803922, 0.49803922]), array([0.7372549 , 0.74117647, 0.13333333]), array([0.09019608, 0.74509804, 0.81176471])]), 'font.family': ['sans-serif'], 'font.sans-serif': ['Arial', 'Bitstream Vera Sans', 'DejaVu Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Avant Garde', 'sans-serif'], 'image.cmap': 'viridis', 'image.interpolation': 'none'}¶
-
_paper_fullwidth
= {'axes.labelsize': 8.8, 'axes.titlesize': 9.6, 'figure.figsize': [6.4, 4.4], 'grid.linewidth': 0.8, 'legend.fontsize': 8.8, 'lines.linewidth': 1.4, 'lines.markeredgewidth': 0.0, 'lines.markersize': 5.6, 'patch.linewidth': 0.24, 'xtick.labelsize': 8.0, 'xtick.major.pad': 5.6, 'xtick.major.width': 0.8, 'xtick.minor.width': 0.4, 'ytick.labelsize': 8.0, 'ytick.major.pad': 5.6, 'ytick.major.width': 0.8, 'ytick.minor.width': 0.4}¶
-
_paper_halfwidth
= {'axes.labelsize': 8.8, 'axes.titlesize': 9.6, 'figure.figsize': [3.3, 4.4], 'grid.linewidth': 0.8, 'legend.fontsize': 8.0, 'lines.linewidth': 1.4, 'lines.markeredgewidth': 0.0, 'lines.markersize': 5.6, 'patch.linewidth': 0.24, 'xtick.labelsize': 8.0, 'xtick.major.pad': 5.6, 'xtick.major.width': 0.8, 'xtick.minor.width': 0.4, 'ytick.labelsize': 8.0, 'ytick.major.pad': 5.6, 'ytick.major.width': 0.8, 'ytick.minor.width': 0.4}¶
-
_poster
= {'axes.labelsize': 17.6, 'axes.titlesize': 19.2, 'figure.figsize': [12.8, 8.8], 'grid.linewidth': 1.6, 'legend.fontsize': 16.0, 'lines.linewidth': 2.8, 'lines.markeredgewidth': 0.0, 'lines.markersize': 11.2, 'patch.linewidth': 0.48, 'xtick.labelsize': 16.0, 'xtick.major.pad': 11.2, 'xtick.major.width': 1.6, 'xtick.minor.width': 0.8, 'ytick.labelsize': 16.0, 'ytick.major.pad': 11.2, 'ytick.major.width': 1.6, 'ytick.minor.width': 0.8}¶
-
_tableau10
= array([[0.12156863, 0.46666667, 0.70588235], [1. , 0.49803922, 0.05490196], [0.17254902, 0.62745098, 0.17254902], [0.83921569, 0.15294118, 0.15686275], [0.58039216, 0.40392157, 0.74117647], [0.54901961, 0.3372549 , 0.29411765], [0.89019608, 0.46666667, 0.76078431], [0.49803922, 0.49803922, 0.49803922], [0.7372549 , 0.74117647, 0.13333333], [0.09019608, 0.74509804, 0.81176471]])¶
-
_tableau10_med
= array([[0.44705882, 0.61960784, 0.80784314], [1. , 0.61960784, 0.29019608], [0.40392157, 0.74901961, 0.36078431], [0.92941176, 0.4 , 0.36470588], [0.67843137, 0.54509804, 0.78823529], [0.65882353, 0.47058824, 0.43137255], [0.92941176, 0.59215686, 0.79215686], [0.63529412, 0.63529412, 0.63529412], [0.80392157, 0.8 , 0.36470588], [0.42745098, 0.8 , 0.85490196]])¶
-
_tableau20
= array([[0.12156863, 0.46666667, 0.70588235], [0.68235294, 0.78039216, 0.90980392], [1. , 0.49803922, 0.05490196], [1. , 0.73333333, 0.47058824], [0.17254902, 0.62745098, 0.17254902], [0.59607843, 0.8745098 , 0.54117647], [0.83921569, 0.15294118, 0.15686275], [1. , 0.59607843, 0.58823529], [0.58039216, 0.40392157, 0.74117647], [0.77254902, 0.69019608, 0.83529412], [0.54901961, 0.3372549 , 0.29411765], [0.76862745, 0.61176471, 0.58039216], [0.89019608, 0.46666667, 0.76078431], [0.96862745, 0.71372549, 0.82352941], [0.49803922, 0.49803922, 0.49803922], [0.78039216, 0.78039216, 0.78039216], [0.7372549 , 0.74117647, 0.13333333], [0.85882353, 0.85882353, 0.55294118], [0.09019608, 0.74509804, 0.81176471], [0.61960784, 0.85490196, 0.89803922]])¶
-
basic_fullwidth
= {'axes.labelsize': 8.8, 'axes.prop_cycle': cycler('color', [array([0.12156863, 0.46666667, 0.70588235]), array([1. , 0.49803922, 0.05490196]), array([0.17254902, 0.62745098, 0.17254902]), array([0.83921569, 0.15294118, 0.15686275]), array([0.58039216, 0.40392157, 0.74117647]), array([0.54901961, 0.3372549 , 0.29411765]), array([0.89019608, 0.46666667, 0.76078431]), array([0.49803922, 0.49803922, 0.49803922]), array([0.7372549 , 0.74117647, 0.13333333]), array([0.09019608, 0.74509804, 0.81176471])]), 'axes.titlesize': 9.6, 'figure.figsize': [6.4, 4.4], 'font.family': ['sans-serif'], 'font.sans-serif': ['Arial', 'Bitstream Vera Sans', 'DejaVu Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Avant Garde', 'sans-serif'], 'grid.linewidth': 0.8, 'image.cmap': 'viridis', 'image.interpolation': 'none', 'legend.fontsize': 8.8, 'lines.linewidth': 1.4, 'lines.markeredgewidth': 0.0, 'lines.markersize': 5.6, 'patch.linewidth': 0.24, 'xtick.labelsize': 8.0, 'xtick.major.pad': 5.6, 'xtick.major.width': 0.8, 'xtick.minor.width': 0.4, 'ytick.labelsize': 8.0, 'ytick.major.pad': 5.6, 'ytick.major.width': 0.8, 'ytick.minor.width': 0.4}¶
-
basic_halfwidth
= {'axes.labelsize': 8.8, 'axes.prop_cycle': cycler('color', [array([0.12156863, 0.46666667, 0.70588235]), array([1. , 0.49803922, 0.05490196]), array([0.17254902, 0.62745098, 0.17254902]), array([0.83921569, 0.15294118, 0.15686275]), array([0.58039216, 0.40392157, 0.74117647]), array([0.54901961, 0.3372549 , 0.29411765]), array([0.89019608, 0.46666667, 0.76078431]), array([0.49803922, 0.49803922, 0.49803922]), array([0.7372549 , 0.74117647, 0.13333333]), array([0.09019608, 0.74509804, 0.81176471])]), 'axes.titlesize': 9.6, 'figure.figsize': [3.3, 4.4], 'font.family': ['sans-serif'], 'font.sans-serif': ['Arial', 'Bitstream Vera Sans', 'DejaVu Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Avant Garde', 'sans-serif'], 'grid.linewidth': 0.8, 'image.cmap': 'viridis', 'image.interpolation': 'none', 'legend.fontsize': 8.0, 'lines.linewidth': 1.4, 'lines.markeredgewidth': 0.0, 'lines.markersize': 5.6, 'patch.linewidth': 0.24, 'xtick.labelsize': 8.0, 'xtick.major.pad': 5.6, 'xtick.major.width': 0.8, 'xtick.minor.width': 0.4, 'ytick.labelsize': 8.0, 'ytick.major.pad': 5.6, 'ytick.major.width': 0.8, 'ytick.minor.width': 0.4}¶
-
basic_poster
= {'axes.labelsize': 17.6, 'axes.prop_cycle': cycler('color', [array([0.12156863, 0.46666667, 0.70588235]), array([1. , 0.49803922, 0.05490196]), array([0.17254902, 0.62745098, 0.17254902]), array([0.83921569, 0.15294118, 0.15686275]), array([0.58039216, 0.40392157, 0.74117647]), array([0.54901961, 0.3372549 , 0.29411765]), array([0.89019608, 0.46666667, 0.76078431]), array([0.49803922, 0.49803922, 0.49803922]), array([0.7372549 , 0.74117647, 0.13333333]), array([0.09019608, 0.74509804, 0.81176471])]), 'axes.titlesize': 19.2, 'figure.figsize': [12.8, 8.8], 'font.family': ['sans-serif'], 'font.sans-serif': ['Arial', 'Bitstream Vera Sans', 'DejaVu Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Avant Garde', 'sans-serif'], 'grid.linewidth': 1.6, 'image.cmap': 'viridis', 'image.interpolation': 'none', 'legend.fontsize': 16.0, 'lines.linewidth': 2.8, 'lines.markeredgewidth': 0.0, 'lines.markersize': 11.2, 'patch.linewidth': 0.48, 'xtick.labelsize': 16.0, 'xtick.major.pad': 11.2, 'xtick.major.width': 1.6, 'xtick.minor.width': 0.8, 'ytick.labelsize': 16.0, 'ytick.major.pad': 11.2, 'ytick.major.width': 1.6, 'ytick.minor.width': 0.8}¶
-
crikit.utils.roi module¶
Created on Wed Jun 15 23:33:41 2016
@author: chc
-
crikit.utils.roi.
pts_in_path
(path)[source]¶ Return points (pixels) that fall within path (but not on boundary)