repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
wright-group/WrightTools
WrightTools/artists/_colors.py
grayify_cmap
def grayify_cmap(cmap): """Return a grayscale version of the colormap. `Source`__ __ https://jakevdp.github.io/blog/2014/10/16/how-bad-is-your-colormap/ """ cmap = plt.cm.get_cmap(cmap) colors = cmap(np.arange(cmap.N)) # convert RGBA to perceived greyscale luminance # cf. http://alienr...
python
def grayify_cmap(cmap): """Return a grayscale version of the colormap. `Source`__ __ https://jakevdp.github.io/blog/2014/10/16/how-bad-is-your-colormap/ """ cmap = plt.cm.get_cmap(cmap) colors = cmap(np.arange(cmap.N)) # convert RGBA to perceived greyscale luminance # cf. http://alienr...
[ "def", "grayify_cmap", "(", "cmap", ")", ":", "cmap", "=", "plt", ".", "cm", ".", "get_cmap", "(", "cmap", ")", "colors", "=", "cmap", "(", "np", ".", "arange", "(", "cmap", ".", "N", ")", ")", "RGB_weight", "=", "[", "0.299", ",", "0.587", ",", ...
Return a grayscale version of the colormap. `Source`__ __ https://jakevdp.github.io/blog/2014/10/16/how-bad-is-your-colormap/
[ "Return", "a", "grayscale", "version", "of", "the", "colormap", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_colors.py#L236-L250
train
wright-group/WrightTools
WrightTools/artists/_colors.py
get_color_cycle
def get_color_cycle(n, cmap="rainbow", rotations=3): """Get a list of RGBA colors following a colormap. Useful for plotting lots of elements, keeping the color of each unique. Parameters ---------- n : integer The number of colors to return. cmap : string (optional) The colorma...
python
def get_color_cycle(n, cmap="rainbow", rotations=3): """Get a list of RGBA colors following a colormap. Useful for plotting lots of elements, keeping the color of each unique. Parameters ---------- n : integer The number of colors to return. cmap : string (optional) The colorma...
[ "def", "get_color_cycle", "(", "n", ",", "cmap", "=", "\"rainbow\"", ",", "rotations", "=", "3", ")", ":", "cmap", "=", "colormaps", "[", "cmap", "]", "if", "np", ".", "mod", "(", "n", ",", "rotations", ")", "==", "0", ":", "per", "=", "np", ".",...
Get a list of RGBA colors following a colormap. Useful for plotting lots of elements, keeping the color of each unique. Parameters ---------- n : integer The number of colors to return. cmap : string (optional) The colormap to use in the cycle. Default is rainbow. rotations : i...
[ "Get", "a", "list", "of", "RGBA", "colors", "following", "a", "colormap", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_colors.py#L253-L281
train
wright-group/WrightTools
WrightTools/diagrams/delay.py
label_sectors
def label_sectors( *, labels=["I", "II", "IV", "VI", "V", "III"], ax=None, lw=2, lc="k", cs=None, c_zlevel=2, c_alpha=0.5, fontsize=40 ): """Label the six time-orderings in a three-pulse experiment. Parameters ---------- labels : list of strings Labels to pla...
python
def label_sectors( *, labels=["I", "II", "IV", "VI", "V", "III"], ax=None, lw=2, lc="k", cs=None, c_zlevel=2, c_alpha=0.5, fontsize=40 ): """Label the six time-orderings in a three-pulse experiment. Parameters ---------- labels : list of strings Labels to pla...
[ "def", "label_sectors", "(", "*", ",", "labels", "=", "[", "\"I\"", ",", "\"II\"", ",", "\"IV\"", ",", "\"VI\"", ",", "\"V\"", ",", "\"III\"", "]", ",", "ax", "=", "None", ",", "lw", "=", "2", ",", "lc", "=", "\"k\"", ",", "cs", "=", "None", ",...
Label the six time-orderings in a three-pulse experiment. Parameters ---------- labels : list of strings Labels to place within sectors, starting in the upper left and proceeding clockwise. Default is ['I', 'II', 'IV', 'VI', 'V', 'III']. ax : matplotlib axis object (optional) Ax...
[ "Label", "the", "six", "time", "-", "orderings", "in", "a", "three", "-", "pulse", "experiment", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/delay.py#L13-L76
train
wright-group/WrightTools
WrightTools/kit/_calculate.py
fluence
def fluence( power_mW, color, beam_radius, reprate_Hz, pulse_width, color_units="wn", beam_radius_units="mm", pulse_width_units="fs_t", area_type="even", ) -> tuple: """Calculate the fluence of a beam. Parameters ---------- power_mW : number Time integrated p...
python
def fluence( power_mW, color, beam_radius, reprate_Hz, pulse_width, color_units="wn", beam_radius_units="mm", pulse_width_units="fs_t", area_type="even", ) -> tuple: """Calculate the fluence of a beam. Parameters ---------- power_mW : number Time integrated p...
[ "def", "fluence", "(", "power_mW", ",", "color", ",", "beam_radius", ",", "reprate_Hz", ",", "pulse_width", ",", "color_units", "=", "\"wn\"", ",", "beam_radius_units", "=", "\"mm\"", ",", "pulse_width_units", "=", "\"fs_t\"", ",", "area_type", "=", "\"even\"", ...
Calculate the fluence of a beam. Parameters ---------- power_mW : number Time integrated power of beam. color : number Color of beam in units. beam_radius : number Radius of beam in units. reprate_Hz : number Laser repetition rate in inverse seconds (Hz). pul...
[ "Calculate", "the", "fluence", "of", "a", "beam", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_calculate.py#L20-L88
train
wright-group/WrightTools
WrightTools/kit/_calculate.py
mono_resolution
def mono_resolution( grooves_per_mm, slit_width, focal_length, output_color, output_units="wn" ) -> float: """Calculate the resolution of a monochromator. Parameters ---------- grooves_per_mm : number Grooves per millimeter. slit_width : number Slit width in microns. focal_l...
python
def mono_resolution( grooves_per_mm, slit_width, focal_length, output_color, output_units="wn" ) -> float: """Calculate the resolution of a monochromator. Parameters ---------- grooves_per_mm : number Grooves per millimeter. slit_width : number Slit width in microns. focal_l...
[ "def", "mono_resolution", "(", "grooves_per_mm", ",", "slit_width", ",", "focal_length", ",", "output_color", ",", "output_units", "=", "\"wn\"", ")", "->", "float", ":", "d_lambda", "=", "1e6", "*", "slit_width", "/", "(", "grooves_per_mm", "*", "focal_length",...
Calculate the resolution of a monochromator. Parameters ---------- grooves_per_mm : number Grooves per millimeter. slit_width : number Slit width in microns. focal_length : number Focal length in mm. output_color : number Output color in nm. output_units : st...
[ "Calculate", "the", "resolution", "of", "a", "monochromator", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_calculate.py#L91-L120
train
wright-group/WrightTools
WrightTools/kit/_calculate.py
nm_width
def nm_width(center, width, units="wn") -> float: """Given a center and width, in energy units, get back a width in nm. Parameters ---------- center : number Center (in energy units). width : number Width (in energy units). units : string (optional) Input units. Default ...
python
def nm_width(center, width, units="wn") -> float: """Given a center and width, in energy units, get back a width in nm. Parameters ---------- center : number Center (in energy units). width : number Width (in energy units). units : string (optional) Input units. Default ...
[ "def", "nm_width", "(", "center", ",", "width", ",", "units", "=", "\"wn\"", ")", "->", "float", ":", "red", "=", "wt_units", ".", "converter", "(", "center", "-", "width", "/", "2.", ",", "units", ",", "\"nm\"", ")", "blue", "=", "wt_units", ".", ...
Given a center and width, in energy units, get back a width in nm. Parameters ---------- center : number Center (in energy units). width : number Width (in energy units). units : string (optional) Input units. Default is wn. Returns ------- number Width ...
[ "Given", "a", "center", "and", "width", "in", "energy", "units", "get", "back", "a", "width", "in", "nm", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_calculate.py#L123-L142
train
wright-group/WrightTools
WrightTools/diagrams/WMEL.py
Subplot.add_arrow
def add_arrow( self, index, between, kind, label="", head_length=0.1, head_aspect=2, font_size=14, color="k", ): """Add an arrow to the WMEL diagram. Parameters ---------- index : integer The interac...
python
def add_arrow( self, index, between, kind, label="", head_length=0.1, head_aspect=2, font_size=14, color="k", ): """Add an arrow to the WMEL diagram. Parameters ---------- index : integer The interac...
[ "def", "add_arrow", "(", "self", ",", "index", ",", "between", ",", "kind", ",", "label", "=", "\"\"", ",", "head_length", "=", "0.1", ",", "head_aspect", "=", "2", ",", "font_size", "=", "14", ",", "color", "=", "\"k\"", ",", ")", ":", "if", "hasa...
Add an arrow to the WMEL diagram. Parameters ---------- index : integer The interaction, or start and stop interaction for the arrow. between : 2-element iterable of integers The inital and final state of the arrow kind : {'ket', 'bra'} The ki...
[ "Add", "an", "arrow", "to", "the", "WMEL", "diagram", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/WMEL.py#L98-L184
train
wright-group/WrightTools
WrightTools/diagrams/WMEL.py
Artist.label_rows
def label_rows(self, labels, font_size=15, text_buffer=1.5): """Label rows. Parameters ---------- labels : list of strings Labels. font_size : number (optional) Font size. Default is 15. text_buffer : number Buffer around text. Default...
python
def label_rows(self, labels, font_size=15, text_buffer=1.5): """Label rows. Parameters ---------- labels : list of strings Labels. font_size : number (optional) Font size. Default is 15. text_buffer : number Buffer around text. Default...
[ "def", "label_rows", "(", "self", ",", "labels", ",", "font_size", "=", "15", ",", "text_buffer", "=", "1.5", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "subplots", ")", ")", ":", "plot", "=", "self", ".", "subplots", "[", ...
Label rows. Parameters ---------- labels : list of strings Labels. font_size : number (optional) Font size. Default is 15. text_buffer : number Buffer around text. Default is 1.5.
[ "Label", "rows", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/WMEL.py#L261-L282
train
wright-group/WrightTools
WrightTools/diagrams/WMEL.py
Artist.clear_diagram
def clear_diagram(self, diagram): """Clear diagram. Parameters ---------- diagram : [column, row] Diagram to clear. """ plot = self.subplots[diagram[1]][diagram[0]] plot.cla()
python
def clear_diagram(self, diagram): """Clear diagram. Parameters ---------- diagram : [column, row] Diagram to clear. """ plot = self.subplots[diagram[1]][diagram[0]] plot.cla()
[ "def", "clear_diagram", "(", "self", ",", "diagram", ")", ":", "plot", "=", "self", ".", "subplots", "[", "diagram", "[", "1", "]", "]", "[", "diagram", "[", "0", "]", "]", "plot", ".", "cla", "(", ")" ]
Clear diagram. Parameters ---------- diagram : [column, row] Diagram to clear.
[ "Clear", "diagram", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/WMEL.py#L307-L316
train
wright-group/WrightTools
WrightTools/diagrams/WMEL.py
Artist.add_arrow
def add_arrow( self, diagram, number, between, kind, label="", head_length=0.075, font_size=7, color="k" ): """Add arrow. Parameters ---------- diagram : [column, row] Diagram position. number : integer Arrow position. between : [start...
python
def add_arrow( self, diagram, number, between, kind, label="", head_length=0.075, font_size=7, color="k" ): """Add arrow. Parameters ---------- diagram : [column, row] Diagram position. number : integer Arrow position. between : [start...
[ "def", "add_arrow", "(", "self", ",", "diagram", ",", "number", ",", "between", ",", "kind", ",", "label", "=", "\"\"", ",", "head_length", "=", "0.075", ",", "font_size", "=", "7", ",", "color", "=", "\"k\"", ")", ":", "column", ",", "row", "=", "...
Add arrow. Parameters ---------- diagram : [column, row] Diagram position. number : integer Arrow position. between : [start, stop] Arrow span. kind : {'ket', 'bra', 'out'} Arrow style. label : string (optional) ...
[ "Add", "arrow", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/WMEL.py#L318-L392
train
wright-group/WrightTools
WrightTools/diagrams/WMEL.py
Artist.plot
def plot(self, save_path=None, close=False, bbox_inches="tight", pad_inches=1): """Plot figure. Parameters ---------- save_path : string (optional) Save path. Default is None. close : boolean (optional) Toggle automatic figure closure after plotting. ...
python
def plot(self, save_path=None, close=False, bbox_inches="tight", pad_inches=1): """Plot figure. Parameters ---------- save_path : string (optional) Save path. Default is None. close : boolean (optional) Toggle automatic figure closure after plotting. ...
[ "def", "plot", "(", "self", ",", "save_path", "=", "None", ",", "close", "=", "False", ",", "bbox_inches", "=", "\"tight\"", ",", "pad_inches", "=", "1", ")", ":", "for", "plot", "in", "self", ".", "subplots", ".", "flatten", "(", ")", ":", "plot", ...
Plot figure. Parameters ---------- save_path : string (optional) Save path. Default is None. close : boolean (optional) Toggle automatic figure closure after plotting. Default is False. bbox_inches : number (optional) Bounding box ...
[ "Plot", "figure", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/diagrams/WMEL.py#L394-L427
train
wright-group/WrightTools
WrightTools/collection/_collection.py
Collection.create_collection
def create_collection(self, name="collection", position=None, **kwargs): """Create a new child colleciton. Parameters ---------- name : string Unique identifier. position : integer (optional) Location to insert. Default is None (append). kwargs ...
python
def create_collection(self, name="collection", position=None, **kwargs): """Create a new child colleciton. Parameters ---------- name : string Unique identifier. position : integer (optional) Location to insert. Default is None (append). kwargs ...
[ "def", "create_collection", "(", "self", ",", "name", "=", "\"collection\"", ",", "position", "=", "None", ",", "**", "kwargs", ")", ":", "if", "name", "in", "self", ".", "item_names", ":", "wt_exceptions", ".", "ObjectExistsWarning", ".", "warn", "(", "na...
Create a new child colleciton. Parameters ---------- name : string Unique identifier. position : integer (optional) Location to insert. Default is None (append). kwargs Additional arguments to child collection instantiation. Returns ...
[ "Create", "a", "new", "child", "colleciton", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/collection/_collection.py#L75-L103
train
wright-group/WrightTools
WrightTools/collection/_collection.py
Collection.create_data
def create_data(self, name="data", position=None, **kwargs): """Create a new child data. Parameters ---------- name : string Unique identifier. position : integer (optional) Location to insert. Default is None (append). kwargs Addition...
python
def create_data(self, name="data", position=None, **kwargs): """Create a new child data. Parameters ---------- name : string Unique identifier. position : integer (optional) Location to insert. Default is None (append). kwargs Addition...
[ "def", "create_data", "(", "self", ",", "name", "=", "\"data\"", ",", "position", "=", "None", ",", "**", "kwargs", ")", ":", "if", "name", "in", "self", ".", "item_names", ":", "wt_exceptions", ".", "ObjectExistsWarning", ".", "warn", "(", "name", ")", ...
Create a new child data. Parameters ---------- name : string Unique identifier. position : integer (optional) Location to insert. Default is None (append). kwargs Additional arguments to child data instantiation. Returns -----...
[ "Create", "a", "new", "child", "data", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/collection/_collection.py#L105-L139
train
wright-group/WrightTools
WrightTools/collection/_collection.py
Collection.flush
def flush(self): """Ensure contents are written to file.""" for name in self.item_names: item = self[name] item.flush() self.file.flush()
python
def flush(self): """Ensure contents are written to file.""" for name in self.item_names: item = self[name] item.flush() self.file.flush()
[ "def", "flush", "(", "self", ")", ":", "for", "name", "in", "self", ".", "item_names", ":", "item", "=", "self", "[", "name", "]", "item", ".", "flush", "(", ")", "self", ".", "file", ".", "flush", "(", ")" ]
Ensure contents are written to file.
[ "Ensure", "contents", "are", "written", "to", "file", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/collection/_collection.py#L158-L163
train
wright-group/WrightTools
WrightTools/kit/_array.py
closest_pair
def closest_pair(arr, give="indicies"): """Find the pair of indices corresponding to the closest elements in an array. If multiple pairs are equally close, both pairs of indicies are returned. Optionally returns the closest distance itself. I am sure that this could be written as a cheaper operation. ...
python
def closest_pair(arr, give="indicies"): """Find the pair of indices corresponding to the closest elements in an array. If multiple pairs are equally close, both pairs of indicies are returned. Optionally returns the closest distance itself. I am sure that this could be written as a cheaper operation. ...
[ "def", "closest_pair", "(", "arr", ",", "give", "=", "\"indicies\"", ")", ":", "idxs", "=", "[", "idx", "for", "idx", "in", "np", ".", "ndindex", "(", "arr", ".", "shape", ")", "]", "outs", "=", "[", "]", "min_dist", "=", "arr", ".", "max", "(", ...
Find the pair of indices corresponding to the closest elements in an array. If multiple pairs are equally close, both pairs of indicies are returned. Optionally returns the closest distance itself. I am sure that this could be written as a cheaper operation. I wrote this as a quick and dirty method be...
[ "Find", "the", "pair", "of", "indices", "corresponding", "to", "the", "closest", "elements", "in", "an", "array", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L35-L84
train
wright-group/WrightTools
WrightTools/kit/_array.py
diff
def diff(xi, yi, order=1) -> np.ndarray: """Take the numerical derivative of a 1D array. Output is mapped onto the original coordinates using linear interpolation. Expects monotonic xi values. Parameters ---------- xi : 1D array-like Coordinates. yi : 1D array-like Values....
python
def diff(xi, yi, order=1) -> np.ndarray: """Take the numerical derivative of a 1D array. Output is mapped onto the original coordinates using linear interpolation. Expects monotonic xi values. Parameters ---------- xi : 1D array-like Coordinates. yi : 1D array-like Values....
[ "def", "diff", "(", "xi", ",", "yi", ",", "order", "=", "1", ")", "->", "np", ".", "ndarray", ":", "yi", "=", "np", ".", "array", "(", "yi", ")", ".", "copy", "(", ")", "flip", "=", "False", "if", "xi", "[", "-", "1", "]", "<", "xi", "[",...
Take the numerical derivative of a 1D array. Output is mapped onto the original coordinates using linear interpolation. Expects monotonic xi values. Parameters ---------- xi : 1D array-like Coordinates. yi : 1D array-like Values. order : positive integer (optional) ...
[ "Take", "the", "numerical", "derivative", "of", "a", "1D", "array", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L87-L120
train
wright-group/WrightTools
WrightTools/kit/_array.py
fft
def fft(xi, yi, axis=0) -> tuple: """Take the 1D FFT of an N-dimensional array and return "sensible" properly shifted arrays. Parameters ---------- xi : numpy.ndarray 1D array over which the points to be FFT'ed are defined yi : numpy.ndarray ND array with values to FFT axis : in...
python
def fft(xi, yi, axis=0) -> tuple: """Take the 1D FFT of an N-dimensional array and return "sensible" properly shifted arrays. Parameters ---------- xi : numpy.ndarray 1D array over which the points to be FFT'ed are defined yi : numpy.ndarray ND array with values to FFT axis : in...
[ "def", "fft", "(", "xi", ",", "yi", ",", "axis", "=", "0", ")", "->", "tuple", ":", "if", "xi", ".", "ndim", "!=", "1", ":", "raise", "wt_exceptions", ".", "DimensionalityError", "(", "1", ",", "xi", ".", "ndim", ")", "spacing", "=", "np", ".", ...
Take the 1D FFT of an N-dimensional array and return "sensible" properly shifted arrays. Parameters ---------- xi : numpy.ndarray 1D array over which the points to be FFT'ed are defined yi : numpy.ndarray ND array with values to FFT axis : int axis of yi to perform FFT over ...
[ "Take", "the", "1D", "FFT", "of", "an", "N", "-", "dimensional", "array", "and", "return", "sensible", "properly", "shifted", "arrays", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L123-L157
train
wright-group/WrightTools
WrightTools/kit/_array.py
joint_shape
def joint_shape(*args) -> tuple: """Given a set of arrays, return the joint shape. Parameters ---------- args : array-likes Returns ------- tuple of int Joint shape. """ if len(args) == 0: return () shape = [] shapes = [a.shape for a in args] ndim = args...
python
def joint_shape(*args) -> tuple: """Given a set of arrays, return the joint shape. Parameters ---------- args : array-likes Returns ------- tuple of int Joint shape. """ if len(args) == 0: return () shape = [] shapes = [a.shape for a in args] ndim = args...
[ "def", "joint_shape", "(", "*", "args", ")", "->", "tuple", ":", "if", "len", "(", "args", ")", "==", "0", ":", "return", "(", ")", "shape", "=", "[", "]", "shapes", "=", "[", "a", ".", "shape", "for", "a", "in", "args", "]", "ndim", "=", "ar...
Given a set of arrays, return the joint shape. Parameters ---------- args : array-likes Returns ------- tuple of int Joint shape.
[ "Given", "a", "set", "of", "arrays", "return", "the", "joint", "shape", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L160-L179
train
wright-group/WrightTools
WrightTools/kit/_array.py
orthogonal
def orthogonal(*args) -> bool: """Determine if a set of arrays are orthogonal. Parameters ---------- args : array-likes or array shapes Returns ------- bool Array orthogonality condition. """ for i, arg in enumerate(args): if hasattr(arg, "shape"): args[...
python
def orthogonal(*args) -> bool: """Determine if a set of arrays are orthogonal. Parameters ---------- args : array-likes or array shapes Returns ------- bool Array orthogonality condition. """ for i, arg in enumerate(args): if hasattr(arg, "shape"): args[...
[ "def", "orthogonal", "(", "*", "args", ")", "->", "bool", ":", "for", "i", ",", "arg", "in", "enumerate", "(", "args", ")", ":", "if", "hasattr", "(", "arg", ",", "\"shape\"", ")", ":", "args", "[", "i", "]", "=", "arg", ".", "shape", "for", "s...
Determine if a set of arrays are orthogonal. Parameters ---------- args : array-likes or array shapes Returns ------- bool Array orthogonality condition.
[ "Determine", "if", "a", "set", "of", "arrays", "are", "orthogonal", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L182-L200
train
wright-group/WrightTools
WrightTools/kit/_array.py
remove_nans_1D
def remove_nans_1D(*args) -> tuple: """Remove nans in a set of 1D arrays. Removes indicies in all arrays if any array is nan at that index. All input arrays must have the same size. Parameters ---------- args : 1D arrays Returns ------- tuple Tuple of 1D arrays in same ord...
python
def remove_nans_1D(*args) -> tuple: """Remove nans in a set of 1D arrays. Removes indicies in all arrays if any array is nan at that index. All input arrays must have the same size. Parameters ---------- args : 1D arrays Returns ------- tuple Tuple of 1D arrays in same ord...
[ "def", "remove_nans_1D", "(", "*", "args", ")", "->", "tuple", ":", "vals", "=", "np", ".", "isnan", "(", "args", "[", "0", "]", ")", "for", "a", "in", "args", ":", "vals", "|=", "np", ".", "isnan", "(", "a", ")", "return", "tuple", "(", "np", ...
Remove nans in a set of 1D arrays. Removes indicies in all arrays if any array is nan at that index. All input arrays must have the same size. Parameters ---------- args : 1D arrays Returns ------- tuple Tuple of 1D arrays in same order as given, with nan indicies removed.
[ "Remove", "nans", "in", "a", "set", "of", "1D", "arrays", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L203-L221
train
wright-group/WrightTools
WrightTools/kit/_array.py
share_nans
def share_nans(*arrs) -> tuple: """Take a list of nD arrays and return a new list of nD arrays. The new list is in the same order as the old list. If one indexed element in an old array is nan then every element for that index in all new arrays in the list is then nan. Parameters ---------- ...
python
def share_nans(*arrs) -> tuple: """Take a list of nD arrays and return a new list of nD arrays. The new list is in the same order as the old list. If one indexed element in an old array is nan then every element for that index in all new arrays in the list is then nan. Parameters ---------- ...
[ "def", "share_nans", "(", "*", "arrs", ")", "->", "tuple", ":", "nans", "=", "np", ".", "zeros", "(", "joint_shape", "(", "*", "arrs", ")", ")", "for", "arr", "in", "arrs", ":", "nans", "*=", "arr", "return", "tuple", "(", "[", "a", "+", "nans", ...
Take a list of nD arrays and return a new list of nD arrays. The new list is in the same order as the old list. If one indexed element in an old array is nan then every element for that index in all new arrays in the list is then nan. Parameters ---------- *arrs : nD arrays. Returns -...
[ "Take", "a", "list", "of", "nD", "arrays", "and", "return", "a", "new", "list", "of", "nD", "arrays", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L224-L243
train
wright-group/WrightTools
WrightTools/kit/_array.py
smooth_1D
def smooth_1D(arr, n=10, smooth_type="flat") -> np.ndarray: """Smooth 1D data using a window function. Edge effects will be present. Parameters ---------- arr : array_like Input array, 1D. n : int (optional) Window length. smooth_type : {'flat', 'hanning', 'hamming', '...
python
def smooth_1D(arr, n=10, smooth_type="flat") -> np.ndarray: """Smooth 1D data using a window function. Edge effects will be present. Parameters ---------- arr : array_like Input array, 1D. n : int (optional) Window length. smooth_type : {'flat', 'hanning', 'hamming', '...
[ "def", "smooth_1D", "(", "arr", ",", "n", "=", "10", ",", "smooth_type", "=", "\"flat\"", ")", "->", "np", ".", "ndarray", ":", "if", "arr", ".", "ndim", "!=", "1", ":", "raise", "wt_exceptions", ".", "DimensionalityError", "(", "1", ",", "arr", ".",...
Smooth 1D data using a window function. Edge effects will be present. Parameters ---------- arr : array_like Input array, 1D. n : int (optional) Window length. smooth_type : {'flat', 'hanning', 'hamming', 'bartlett', 'blackman'} (optional) Type of window function t...
[ "Smooth", "1D", "data", "using", "a", "window", "function", ".", "Edge", "effects", "will", "be", "present", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L246-L291
train
wright-group/WrightTools
WrightTools/kit/_array.py
svd
def svd(a, i=None) -> tuple: """Singular Value Decomposition. Factors the matrix `a` as ``u * np.diag(s) * v``, where `u` and `v` are unitary and `s` is a 1D array of `a`'s singular values. Parameters ---------- a : array_like Input array. i : int or slice (optional) What s...
python
def svd(a, i=None) -> tuple: """Singular Value Decomposition. Factors the matrix `a` as ``u * np.diag(s) * v``, where `u` and `v` are unitary and `s` is a 1D array of `a`'s singular values. Parameters ---------- a : array_like Input array. i : int or slice (optional) What s...
[ "def", "svd", "(", "a", ",", "i", "=", "None", ")", "->", "tuple", ":", "u", ",", "s", ",", "v", "=", "np", ".", "linalg", ".", "svd", "(", "a", ",", "full_matrices", "=", "False", ",", "compute_uv", "=", "True", ")", "u", "=", "u", ".", "T...
Singular Value Decomposition. Factors the matrix `a` as ``u * np.diag(s) * v``, where `u` and `v` are unitary and `s` is a 1D array of `a`'s singular values. Parameters ---------- a : array_like Input array. i : int or slice (optional) What singular value "slice" to return. ...
[ "Singular", "Value", "Decomposition", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L294-L318
train
wright-group/WrightTools
WrightTools/kit/_array.py
unique
def unique(arr, tolerance=1e-6) -> np.ndarray: """Return unique elements in 1D array, within tolerance. Parameters ---------- arr : array_like Input array. This will be flattened if it is not already 1D. tolerance : number (optional) The tolerance for uniqueness. Returns --...
python
def unique(arr, tolerance=1e-6) -> np.ndarray: """Return unique elements in 1D array, within tolerance. Parameters ---------- arr : array_like Input array. This will be flattened if it is not already 1D. tolerance : number (optional) The tolerance for uniqueness. Returns --...
[ "def", "unique", "(", "arr", ",", "tolerance", "=", "1e-6", ")", "->", "np", ".", "ndarray", ":", "arr", "=", "sorted", "(", "arr", ".", "flatten", "(", ")", ")", "unique", "=", "[", "]", "while", "len", "(", "arr", ")", ">", "0", ":", "current...
Return unique elements in 1D array, within tolerance. Parameters ---------- arr : array_like Input array. This will be flattened if it is not already 1D. tolerance : number (optional) The tolerance for uniqueness. Returns ------- array The sorted unique values.
[ "Return", "unique", "elements", "in", "1D", "array", "within", "tolerance", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L321-L344
train
wright-group/WrightTools
WrightTools/kit/_array.py
valid_index
def valid_index(index, shape) -> tuple: """Get a valid index for a broadcastable shape. Parameters ---------- index : tuple Given index. shape : tuple of int Shape. Returns ------- tuple Valid index. """ # append slices to index index = list(index) ...
python
def valid_index(index, shape) -> tuple: """Get a valid index for a broadcastable shape. Parameters ---------- index : tuple Given index. shape : tuple of int Shape. Returns ------- tuple Valid index. """ # append slices to index index = list(index) ...
[ "def", "valid_index", "(", "index", ",", "shape", ")", "->", "tuple", ":", "index", "=", "list", "(", "index", ")", "while", "len", "(", "index", ")", "<", "len", "(", "shape", ")", ":", "index", ".", "append", "(", "slice", "(", "None", ")", ")"...
Get a valid index for a broadcastable shape. Parameters ---------- index : tuple Given index. shape : tuple of int Shape. Returns ------- tuple Valid index.
[ "Get", "a", "valid", "index", "for", "a", "broadcastable", "shape", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L347-L376
train
wright-group/WrightTools
WrightTools/kit/_array.py
mask_reduce
def mask_reduce(mask): """Reduce a boolean mask, removing all false slices in any dimension. Parameters ---------- mask : ndarray with bool dtype The mask which is to be reduced Returns ------- A boolean mask with no all False slices. """ mask = mask.copy() for i in...
python
def mask_reduce(mask): """Reduce a boolean mask, removing all false slices in any dimension. Parameters ---------- mask : ndarray with bool dtype The mask which is to be reduced Returns ------- A boolean mask with no all False slices. """ mask = mask.copy() for i in...
[ "def", "mask_reduce", "(", "mask", ")", ":", "mask", "=", "mask", ".", "copy", "(", ")", "for", "i", "in", "range", "(", "len", "(", "mask", ".", "shape", ")", ")", ":", "a", "=", "mask", ".", "copy", "(", ")", "j", "=", "list", "(", "range",...
Reduce a boolean mask, removing all false slices in any dimension. Parameters ---------- mask : ndarray with bool dtype The mask which is to be reduced Returns ------- A boolean mask with no all False slices.
[ "Reduce", "a", "boolean", "mask", "removing", "all", "false", "slices", "in", "any", "dimension", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L379-L402
train
wright-group/WrightTools
WrightTools/kit/_array.py
enforce_mask_shape
def enforce_mask_shape(mask, shape): """Reduce a boolean mask to fit a given shape. Parameters ---------- mask : ndarray with bool dtype The mask which is to be reduced shape : tuple of int Shape which broadcasts to the mask shape. Returns ------- A boolean mask, co...
python
def enforce_mask_shape(mask, shape): """Reduce a boolean mask to fit a given shape. Parameters ---------- mask : ndarray with bool dtype The mask which is to be reduced shape : tuple of int Shape which broadcasts to the mask shape. Returns ------- A boolean mask, co...
[ "def", "enforce_mask_shape", "(", "mask", ",", "shape", ")", ":", "red", "=", "tuple", "(", "[", "i", "for", "i", "in", "range", "(", "len", "(", "shape", ")", ")", "if", "shape", "[", "i", "]", "==", "1", "]", ")", "return", "mask", ".", "max"...
Reduce a boolean mask to fit a given shape. Parameters ---------- mask : ndarray with bool dtype The mask which is to be reduced shape : tuple of int Shape which broadcasts to the mask shape. Returns ------- A boolean mask, collapsed along axes where the shape given has...
[ "Reduce", "a", "boolean", "mask", "to", "fit", "a", "given", "shape", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_array.py#L405-L420
train
wright-group/WrightTools
WrightTools/datasets/__init__.py
DatasetContainer._from_directory
def _from_directory(self, dirname, prefix=""): """Add dataset from files in a directory. Parameters ---------- dirname : string Directory name. prefix : string Prefix. """ ps = [os.path.join(here, dirname, p) for p in os.listdir(os.path.jo...
python
def _from_directory(self, dirname, prefix=""): """Add dataset from files in a directory. Parameters ---------- dirname : string Directory name. prefix : string Prefix. """ ps = [os.path.join(here, dirname, p) for p in os.listdir(os.path.jo...
[ "def", "_from_directory", "(", "self", ",", "dirname", ",", "prefix", "=", "\"\"", ")", ":", "ps", "=", "[", "os", ".", "path", ".", "join", "(", "here", ",", "dirname", ",", "p", ")", "for", "p", "in", "os", ".", "listdir", "(", "os", ".", "pa...
Add dataset from files in a directory. Parameters ---------- dirname : string Directory name. prefix : string Prefix.
[ "Add", "dataset", "from", "files", "in", "a", "directory", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/datasets/__init__.py#L37-L49
train
wright-group/WrightTools
WrightTools/kit/_utilities.py
string2identifier
def string2identifier(s): """Turn a string into a valid python identifier. Currently only allows ASCII letters and underscore. Illegal characters are replaced with underscore. This is slightly more opinionated than python 3 itself, and may be refactored in future (see PEP 3131). Parameters ---...
python
def string2identifier(s): """Turn a string into a valid python identifier. Currently only allows ASCII letters and underscore. Illegal characters are replaced with underscore. This is slightly more opinionated than python 3 itself, and may be refactored in future (see PEP 3131). Parameters ---...
[ "def", "string2identifier", "(", "s", ")", ":", "if", "len", "(", "s", ")", "==", "0", ":", "return", "\"_\"", "if", "s", "[", "0", "]", "not", "in", "string", ".", "ascii_letters", ":", "s", "=", "\"_\"", "+", "s", "valids", "=", "string", ".", ...
Turn a string into a valid python identifier. Currently only allows ASCII letters and underscore. Illegal characters are replaced with underscore. This is slightly more opinionated than python 3 itself, and may be refactored in future (see PEP 3131). Parameters ---------- s : string st...
[ "Turn", "a", "string", "into", "a", "valid", "python", "identifier", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_utilities.py#L20-L50
train
wright-group/WrightTools
WrightTools/units.py
converter
def converter(val, current_unit, destination_unit): """Convert from one unit to another. Parameters ---------- val : number Number to convert. current_unit : string Current unit. destination_unit : string Destination unit. Returns ------- number Conv...
python
def converter(val, current_unit, destination_unit): """Convert from one unit to another. Parameters ---------- val : number Number to convert. current_unit : string Current unit. destination_unit : string Destination unit. Returns ------- number Conv...
[ "def", "converter", "(", "val", ",", "current_unit", ",", "destination_unit", ")", ":", "x", "=", "val", "for", "dic", "in", "dicts", ".", "values", "(", ")", ":", "if", "current_unit", "in", "dic", ".", "keys", "(", ")", "and", "destination_unit", "in...
Convert from one unit to another. Parameters ---------- val : number Number to convert. current_unit : string Current unit. destination_unit : string Destination unit. Returns ------- number Converted value.
[ "Convert", "from", "one", "unit", "to", "another", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/units.py#L96-L135
train
wright-group/WrightTools
WrightTools/units.py
get_symbol
def get_symbol(units) -> str: """Get default symbol type. Parameters ---------- units_str : string Units. Returns ------- string LaTeX formatted symbol. """ if kind(units) == "energy": d = {} d["nm"] = r"\lambda" d["wn"] = r"\bar\nu" ...
python
def get_symbol(units) -> str: """Get default symbol type. Parameters ---------- units_str : string Units. Returns ------- string LaTeX formatted symbol. """ if kind(units) == "energy": d = {} d["nm"] = r"\lambda" d["wn"] = r"\bar\nu" ...
[ "def", "get_symbol", "(", "units", ")", "->", "str", ":", "if", "kind", "(", "units", ")", "==", "\"energy\"", ":", "d", "=", "{", "}", "d", "[", "\"nm\"", "]", "=", "r\"\\lambda\"", "d", "[", "\"wn\"", "]", "=", "r\"\\bar\\nu\"", "d", "[", "\"eV\"...
Get default symbol type. Parameters ---------- units_str : string Units. Returns ------- string LaTeX formatted symbol.
[ "Get", "default", "symbol", "type", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/units.py#L141-L172
train
wright-group/WrightTools
WrightTools/units.py
kind
def kind(units): """Find the kind of given units. Parameters ---------- units : string The units of interest Returns ------- string The kind of the given units. If no match is found, returns None. """ for k, v in dicts.items(): if units in v.keys(): ...
python
def kind(units): """Find the kind of given units. Parameters ---------- units : string The units of interest Returns ------- string The kind of the given units. If no match is found, returns None. """ for k, v in dicts.items(): if units in v.keys(): ...
[ "def", "kind", "(", "units", ")", ":", "for", "k", ",", "v", "in", "dicts", ".", "items", "(", ")", ":", "if", "units", "in", "v", ".", "keys", "(", ")", ":", "return", "k" ]
Find the kind of given units. Parameters ---------- units : string The units of interest Returns ------- string The kind of the given units. If no match is found, returns None.
[ "Find", "the", "kind", "of", "given", "units", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/units.py#L194-L209
train
hagenw/sphinxcontrib-katex
sphinxcontrib/katex.py
latex_defs_to_katex_macros
def latex_defs_to_katex_macros(defs): r'''Converts LaTeX \def statements to KaTeX macros. This is a helper function that can be used in conf.py to translate your already specified LaTeX definitions. https://github.com/Khan/KaTeX#rendering-options, e.g. `\def \e #1{\mathrm{e}^{#1}}` => `"\\e:" "\\m...
python
def latex_defs_to_katex_macros(defs): r'''Converts LaTeX \def statements to KaTeX macros. This is a helper function that can be used in conf.py to translate your already specified LaTeX definitions. https://github.com/Khan/KaTeX#rendering-options, e.g. `\def \e #1{\mathrm{e}^{#1}}` => `"\\e:" "\\m...
[ "def", "latex_defs_to_katex_macros", "(", "defs", ")", ":", "r", "defs", "=", "defs", ".", "strip", "(", ")", "tmp", "=", "[", "]", "for", "line", "in", "defs", ".", "splitlines", "(", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "line", ...
r'''Converts LaTeX \def statements to KaTeX macros. This is a helper function that can be used in conf.py to translate your already specified LaTeX definitions. https://github.com/Khan/KaTeX#rendering-options, e.g. `\def \e #1{\mathrm{e}^{#1}}` => `"\\e:" "\\mathrm{e}^{#1}"`' Example ------- ...
[ "r", "Converts", "LaTeX", "\\", "def", "statements", "to", "KaTeX", "macros", "." ]
52e235b93a2471df9a7477e04b697e4274399623
https://github.com/hagenw/sphinxcontrib-katex/blob/52e235b93a2471df9a7477e04b697e4274399623/sphinxcontrib/katex.py#L32-L68
train
hagenw/sphinxcontrib-katex
sphinxcontrib/katex.py
katex_rendering_delimiters
def katex_rendering_delimiters(app): """Delimiters for rendering KaTeX math. If no delimiters are specified in katex_options, add the katex_inline and katex_display delimiters. See also https://khan.github.io/KaTeX/docs/autorender.html """ # Return if we have user defined rendering delimiters ...
python
def katex_rendering_delimiters(app): """Delimiters for rendering KaTeX math. If no delimiters are specified in katex_options, add the katex_inline and katex_display delimiters. See also https://khan.github.io/KaTeX/docs/autorender.html """ # Return if we have user defined rendering delimiters ...
[ "def", "katex_rendering_delimiters", "(", "app", ")", ":", "if", "'delimiters'", "in", "app", ".", "config", ".", "katex_options", ":", "return", "''", "katex_inline", "=", "[", "d", ".", "replace", "(", "'\\\\'", ",", "'\\\\\\\\'", ")", "for", "d", "in", ...
Delimiters for rendering KaTeX math. If no delimiters are specified in katex_options, add the katex_inline and katex_display delimiters. See also https://khan.github.io/KaTeX/docs/autorender.html
[ "Delimiters", "for", "rendering", "KaTeX", "math", "." ]
52e235b93a2471df9a7477e04b697e4274399623
https://github.com/hagenw/sphinxcontrib-katex/blob/52e235b93a2471df9a7477e04b697e4274399623/sphinxcontrib/katex.py#L159-L177
train
wright-group/WrightTools
WrightTools/data/_axis.py
Axis.label
def label(self) -> str: """A latex formatted label representing axis expression.""" label = self.expression.replace("_", "\\;") if self.units_kind: symbol = wt_units.get_symbol(self.units) for v in self.variables: vl = "%s_{%s}" % (symbol, v.label) ...
python
def label(self) -> str: """A latex formatted label representing axis expression.""" label = self.expression.replace("_", "\\;") if self.units_kind: symbol = wt_units.get_symbol(self.units) for v in self.variables: vl = "%s_{%s}" % (symbol, v.label) ...
[ "def", "label", "(", "self", ")", "->", "str", ":", "label", "=", "self", ".", "expression", ".", "replace", "(", "\"_\"", ",", "\"\\\\;\"", ")", "if", "self", ".", "units_kind", ":", "symbol", "=", "wt_units", ".", "get_symbol", "(", "self", ".", "u...
A latex formatted label representing axis expression.
[ "A", "latex", "formatted", "label", "representing", "axis", "expression", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_axis.py#L94-L109
train
wright-group/WrightTools
WrightTools/data/_axis.py
Axis.natural_name
def natural_name(self) -> str: """Valid python identifier representation of the expession.""" name = self.expression.strip() for op in operators: name = name.replace(op, operator_to_identifier[op]) return wt_kit.string2identifier(name)
python
def natural_name(self) -> str: """Valid python identifier representation of the expession.""" name = self.expression.strip() for op in operators: name = name.replace(op, operator_to_identifier[op]) return wt_kit.string2identifier(name)
[ "def", "natural_name", "(", "self", ")", "->", "str", ":", "name", "=", "self", ".", "expression", ".", "strip", "(", ")", "for", "op", "in", "operators", ":", "name", "=", "name", ".", "replace", "(", "op", ",", "operator_to_identifier", "[", "op", ...
Valid python identifier representation of the expession.
[ "Valid", "python", "identifier", "representation", "of", "the", "expession", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_axis.py#L112-L117
train
wright-group/WrightTools
WrightTools/data/_axis.py
Axis.masked
def masked(self) -> np.ndarray: """Axis expression evaluated, and masked with NaN shared from data channels.""" arr = self[:] arr.shape = self.shape arr = wt_kit.share_nans(arr, *self.parent.channels)[0] return np.nanmean( arr, keepdims=True, axis=tuple(i for i in ran...
python
def masked(self) -> np.ndarray: """Axis expression evaluated, and masked with NaN shared from data channels.""" arr = self[:] arr.shape = self.shape arr = wt_kit.share_nans(arr, *self.parent.channels)[0] return np.nanmean( arr, keepdims=True, axis=tuple(i for i in ran...
[ "def", "masked", "(", "self", ")", "->", "np", ".", "ndarray", ":", "arr", "=", "self", "[", ":", "]", "arr", ".", "shape", "=", "self", ".", "shape", "arr", "=", "wt_kit", ".", "share_nans", "(", "arr", ",", "*", "self", ".", "parent", ".", "c...
Axis expression evaluated, and masked with NaN shared from data channels.
[ "Axis", "expression", "evaluated", "and", "masked", "with", "NaN", "shared", "from", "data", "channels", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_axis.py#L166-L173
train
wright-group/WrightTools
WrightTools/data/_axis.py
Axis.convert
def convert(self, destination_units, *, convert_variables=False): """Convert axis to destination_units. Parameters ---------- destination_units : string Destination units. convert_variables : boolean (optional) Toggle conversion of stored arrays. Default ...
python
def convert(self, destination_units, *, convert_variables=False): """Convert axis to destination_units. Parameters ---------- destination_units : string Destination units. convert_variables : boolean (optional) Toggle conversion of stored arrays. Default ...
[ "def", "convert", "(", "self", ",", "destination_units", ",", "*", ",", "convert_variables", "=", "False", ")", ":", "if", "self", ".", "units", "is", "None", "and", "(", "destination_units", "is", "None", "or", "destination_units", "==", "\"None\"", ")", ...
Convert axis to destination_units. Parameters ---------- destination_units : string Destination units. convert_variables : boolean (optional) Toggle conversion of stored arrays. Default is False.
[ "Convert", "axis", "to", "destination_units", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_axis.py#L175-L193
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.add_section
def add_section(self, section): """Add section. Parameters ---------- section : string Section to add. """ self.config.read(self.filepath) self.config.add_section(section) with open(self.filepath, "w") as f: self.config.write(f)
python
def add_section(self, section): """Add section. Parameters ---------- section : string Section to add. """ self.config.read(self.filepath) self.config.add_section(section) with open(self.filepath, "w") as f: self.config.write(f)
[ "def", "add_section", "(", "self", ",", "section", ")", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "self", ".", "config", ".", "add_section", "(", "section", ")", "with", "open", "(", "self", ".", "filepath", ",", "\"...
Add section. Parameters ---------- section : string Section to add.
[ "Add", "section", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L35-L46
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.dictionary
def dictionary(self) -> dict: """Get a python dictionary of contents.""" self.config.read(self.filepath) return self.config._sections
python
def dictionary(self) -> dict: """Get a python dictionary of contents.""" self.config.read(self.filepath) return self.config._sections
[ "def", "dictionary", "(", "self", ")", "->", "dict", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "return", "self", ".", "config", ".", "_sections" ]
Get a python dictionary of contents.
[ "Get", "a", "python", "dictionary", "of", "contents", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L58-L61
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.has_option
def has_option(self, section, option) -> bool: """Test if file has option. Parameters ---------- section : string Section. option : string Option. Returns ------- boolean """ self.config.read(self.filepath) ...
python
def has_option(self, section, option) -> bool: """Test if file has option. Parameters ---------- section : string Section. option : string Option. Returns ------- boolean """ self.config.read(self.filepath) ...
[ "def", "has_option", "(", "self", ",", "section", ",", "option", ")", "->", "bool", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "return", "self", ".", "config", ".", "has_option", "(", "section", ",", "option", ")" ]
Test if file has option. Parameters ---------- section : string Section. option : string Option. Returns ------- boolean
[ "Test", "if", "file", "has", "option", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L78-L93
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.has_section
def has_section(self, section) -> bool: """Test if file has section. Parameters ---------- section : string Section. Returns ------- boolean """ self.config.read(self.filepath) return self.config.has_section(section)
python
def has_section(self, section) -> bool: """Test if file has section. Parameters ---------- section : string Section. Returns ------- boolean """ self.config.read(self.filepath) return self.config.has_section(section)
[ "def", "has_section", "(", "self", ",", "section", ")", "->", "bool", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "return", "self", ".", "config", ".", "has_section", "(", "section", ")" ]
Test if file has section. Parameters ---------- section : string Section. Returns ------- boolean
[ "Test", "if", "file", "has", "section", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L95-L108
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.read
def read(self, section, option): """Read from file. Parameters ---------- section : string Section. option : string Option. Returns ------- string Value. """ self.config.read(self.filepath) raw ...
python
def read(self, section, option): """Read from file. Parameters ---------- section : string Section. option : string Option. Returns ------- string Value. """ self.config.read(self.filepath) raw ...
[ "def", "read", "(", "self", ",", "section", ",", "option", ")", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "raw", "=", "self", ".", "config", ".", "get", "(", "section", ",", "option", ")", "out", "=", "tidy_headers...
Read from file. Parameters ---------- section : string Section. option : string Option. Returns ------- string Value.
[ "Read", "from", "file", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L110-L128
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.sections
def sections(self) -> list: """List of sections.""" self.config.read(self.filepath) return self.config.sections()
python
def sections(self) -> list: """List of sections.""" self.config.read(self.filepath) return self.config.sections()
[ "def", "sections", "(", "self", ")", "->", "list", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "return", "self", ".", "config", ".", "sections", "(", ")" ]
List of sections.
[ "List", "of", "sections", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L131-L134
train
wright-group/WrightTools
WrightTools/kit/_ini.py
INI.write
def write(self, section, option, value): """Write to file. Parameters ---------- section : string Section. option : string Option. value : string Value. """ self.config.read(self.filepath) string = tidy_headers....
python
def write(self, section, option, value): """Write to file. Parameters ---------- section : string Section. option : string Option. value : string Value. """ self.config.read(self.filepath) string = tidy_headers....
[ "def", "write", "(", "self", ",", "section", ",", "option", ",", "value", ")", ":", "self", ".", "config", ".", "read", "(", "self", ".", "filepath", ")", "string", "=", "tidy_headers", ".", "_parse_item", ".", "item2string", "(", "value", ",", "sep", ...
Write to file. Parameters ---------- section : string Section. option : string Option. value : string Value.
[ "Write", "to", "file", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_ini.py#L136-L152
train
wright-group/WrightTools
WrightTools/kit/_timestamp.py
timestamp_from_RFC3339
def timestamp_from_RFC3339(RFC3339): """Generate a Timestamp object from a RFC3339 formatted string. `Link to RFC3339`__ __ https://www.ietf.org/rfc/rfc3339.txt Parameters ---------- RFC3339 : string RFC3339 formatted string. Returns ------- WrightTools.kit.TimeStamp ...
python
def timestamp_from_RFC3339(RFC3339): """Generate a Timestamp object from a RFC3339 formatted string. `Link to RFC3339`__ __ https://www.ietf.org/rfc/rfc3339.txt Parameters ---------- RFC3339 : string RFC3339 formatted string. Returns ------- WrightTools.kit.TimeStamp ...
[ "def", "timestamp_from_RFC3339", "(", "RFC3339", ")", ":", "dt", "=", "dateutil", ".", "parser", ".", "parse", "(", "RFC3339", ")", "if", "hasattr", "(", "dt", ".", "tzinfo", ",", "\"_offset\"", ")", ":", "timezone", "=", "dt", ".", "tzinfo", ".", "_of...
Generate a Timestamp object from a RFC3339 formatted string. `Link to RFC3339`__ __ https://www.ietf.org/rfc/rfc3339.txt Parameters ---------- RFC3339 : string RFC3339 formatted string. Returns ------- WrightTools.kit.TimeStamp
[ "Generate", "a", "Timestamp", "object", "from", "a", "RFC3339", "formatted", "string", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_timestamp.py#L25-L47
train
wright-group/WrightTools
WrightTools/kit/_timestamp.py
TimeStamp.human
def human(self): """Human-readable timestamp.""" # get timezone offset delta_sec = time.timezone m, s = divmod(delta_sec, 60) h, m = divmod(m, 60) # create output format_string = "%Y-%m-%d %H:%M:%S" out = self.datetime.strftime(format_string) retur...
python
def human(self): """Human-readable timestamp.""" # get timezone offset delta_sec = time.timezone m, s = divmod(delta_sec, 60) h, m = divmod(m, 60) # create output format_string = "%Y-%m-%d %H:%M:%S" out = self.datetime.strftime(format_string) retur...
[ "def", "human", "(", "self", ")", ":", "delta_sec", "=", "time", ".", "timezone", "m", ",", "s", "=", "divmod", "(", "delta_sec", ",", "60", ")", "h", ",", "m", "=", "divmod", "(", "m", ",", "60", ")", "format_string", "=", "\"%Y-%m-%d %H:%M:%S\"", ...
Human-readable timestamp.
[ "Human", "-", "readable", "timestamp", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_timestamp.py#L135-L144
train
wright-group/WrightTools
WrightTools/kit/_timestamp.py
TimeStamp.path
def path(self): """Timestamp for placing into filepaths.""" out = self.datetime.strftime("%Y-%m-%d") out += " " ssm = ( self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0) ).total_seconds() out += str(int(ssm)).zfill(5) ret...
python
def path(self): """Timestamp for placing into filepaths.""" out = self.datetime.strftime("%Y-%m-%d") out += " " ssm = ( self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0) ).total_seconds() out += str(int(ssm)).zfill(5) ret...
[ "def", "path", "(", "self", ")", ":", "out", "=", "self", ".", "datetime", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "out", "+=", "\" \"", "ssm", "=", "(", "self", ".", "datetime", "-", "self", ".", "datetime", ".", "replace", "(", "hour", "=", "0...
Timestamp for placing into filepaths.
[ "Timestamp", "for", "placing", "into", "filepaths", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_timestamp.py#L187-L195
train
wright-group/WrightTools
WrightTools/kit/_interpolate.py
zoom2D
def zoom2D(xi, yi, zi, xi_zoom=3., yi_zoom=3., order=3, mode="nearest", cval=0.): """Zoom a 2D array, with axes. Parameters ---------- xi : 1D array x axis points. yi : 1D array y axis points. zi : 2D array array values. Shape of (x, y). xi_zoom : float (optional) ...
python
def zoom2D(xi, yi, zi, xi_zoom=3., yi_zoom=3., order=3, mode="nearest", cval=0.): """Zoom a 2D array, with axes. Parameters ---------- xi : 1D array x axis points. yi : 1D array y axis points. zi : 2D array array values. Shape of (x, y). xi_zoom : float (optional) ...
[ "def", "zoom2D", "(", "xi", ",", "yi", ",", "zi", ",", "xi_zoom", "=", "3.", ",", "yi_zoom", "=", "3.", ",", "order", "=", "3", ",", "mode", "=", "\"nearest\"", ",", "cval", "=", "0.", ")", ":", "xi", "=", "ndimage", ".", "interpolation", ".", ...
Zoom a 2D array, with axes. Parameters ---------- xi : 1D array x axis points. yi : 1D array y axis points. zi : 2D array array values. Shape of (x, y). xi_zoom : float (optional) Zoom factor along x axis. Default is 3. yi_zoom : float (optional) Zoom...
[ "Zoom", "a", "2D", "array", "with", "axes", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_interpolate.py#L24-L50
train
wright-group/WrightTools
WrightTools/artists/_base.py
apply_rcparams
def apply_rcparams(kind="fast"): """Quickly apply rcparams for given purposes. Parameters ---------- kind: {'default', 'fast', 'publication'} (optional) Settings to use. Default is 'fast'. """ if kind == "default": matplotlib.rcdefaults() elif kind == "fast": matplot...
python
def apply_rcparams(kind="fast"): """Quickly apply rcparams for given purposes. Parameters ---------- kind: {'default', 'fast', 'publication'} (optional) Settings to use. Default is 'fast'. """ if kind == "default": matplotlib.rcdefaults() elif kind == "fast": matplot...
[ "def", "apply_rcparams", "(", "kind", "=", "\"fast\"", ")", ":", "if", "kind", "==", "\"default\"", ":", "matplotlib", ".", "rcdefaults", "(", ")", "elif", "kind", "==", "\"fast\"", ":", "matplotlib", ".", "rcParams", "[", "\"text.usetex\"", "]", "=", "Fal...
Quickly apply rcparams for given purposes. Parameters ---------- kind: {'default', 'fast', 'publication'} (optional) Settings to use. Default is 'fast'.
[ "Quickly", "apply", "rcparams", "for", "given", "purposes", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_base.py#L520-L547
train
wright-group/WrightTools
WrightTools/artists/_base.py
Axes._apply_labels
def _apply_labels( self, autolabel="none", xlabel=None, ylabel=None, data=None, channel_index=0 ): """Apply x and y labels to axes. Parameters ---------- autolabel : {'none', 'both', 'x', 'y'} (optional) Label(s) to apply from data. Default is none. xlabe...
python
def _apply_labels( self, autolabel="none", xlabel=None, ylabel=None, data=None, channel_index=0 ): """Apply x and y labels to axes. Parameters ---------- autolabel : {'none', 'both', 'x', 'y'} (optional) Label(s) to apply from data. Default is none. xlabe...
[ "def", "_apply_labels", "(", "self", ",", "autolabel", "=", "\"none\"", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "data", "=", "None", ",", "channel_index", "=", "0", ")", ":", "if", "autolabel", "in", "[", "\"xy\"", ",", "\"both\"",...
Apply x and y labels to axes. Parameters ---------- autolabel : {'none', 'both', 'x', 'y'} (optional) Label(s) to apply from data. Default is none. xlabel : string (optional) x label. Default is None. ylabel : string (optional) y label. Defaul...
[ "Apply", "x", "and", "y", "labels", "to", "axes", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_base.py#L49-L83
train
wright-group/WrightTools
WrightTools/artists/_base.py
Axes.add_sideplot
def add_sideplot(self, along, pad=0, height=0.75, ymin=0, ymax=1.1): """Add a side axis. Parameters ---------- along : {'x', 'y'} Axis to add along. pad : float (optional) Side axis pad. Default is 0. height : float (optional) Side axi...
python
def add_sideplot(self, along, pad=0, height=0.75, ymin=0, ymax=1.1): """Add a side axis. Parameters ---------- along : {'x', 'y'} Axis to add along. pad : float (optional) Side axis pad. Default is 0. height : float (optional) Side axi...
[ "def", "add_sideplot", "(", "self", ",", "along", ",", "pad", "=", "0", ",", "height", "=", "0.75", ",", "ymin", "=", "0", ",", "ymax", "=", "1.1", ")", ":", "if", "hasattr", "(", "self", ",", "\"divider\"", ")", ":", "divider", "=", "self", ".",...
Add a side axis. Parameters ---------- along : {'x', 'y'} Axis to add along. pad : float (optional) Side axis pad. Default is 0. height : float (optional) Side axis height. Default is 0.
[ "Add", "a", "side", "axis", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_base.py#L192-L227
train
wright-group/WrightTools
WrightTools/artists/_base.py
Axes.legend
def legend(self, *args, **kwargs): """Add a legend. Parameters ---------- *args matplotlib legend args. *kwargs matplotlib legend kwargs. Returns ------- legend """ if "fancybox" not in kwargs.keys(): k...
python
def legend(self, *args, **kwargs): """Add a legend. Parameters ---------- *args matplotlib legend args. *kwargs matplotlib legend kwargs. Returns ------- legend """ if "fancybox" not in kwargs.keys(): k...
[ "def", "legend", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "\"fancybox\"", "not", "in", "kwargs", ".", "keys", "(", ")", ":", "kwargs", "[", "\"fancybox\"", "]", "=", "False", "if", "\"framealpha\"", "not", "in", "kwargs", "...
Add a legend. Parameters ---------- *args matplotlib legend args. *kwargs matplotlib legend kwargs. Returns ------- legend
[ "Add", "a", "legend", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_base.py#L327-L345
train
wright-group/WrightTools
WrightTools/artists/_base.py
Figure.add_subplot
def add_subplot(self, *args, **kwargs): """Add a subplot to the figure. Parameters ---------- *args **kwargs Returns ------- WrightTools.artists.Axes object """ kwargs.setdefault("projection", "wright") return super().add_subplot(...
python
def add_subplot(self, *args, **kwargs): """Add a subplot to the figure. Parameters ---------- *args **kwargs Returns ------- WrightTools.artists.Axes object """ kwargs.setdefault("projection", "wright") return super().add_subplot(...
[ "def", "add_subplot", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "\"projection\"", ",", "\"wright\"", ")", "return", "super", "(", ")", ".", "add_subplot", "(", "*", "args", ",", "**", "kwargs", ")" ...
Add a subplot to the figure. Parameters ---------- *args **kwargs Returns ------- WrightTools.artists.Axes object
[ "Add", "a", "subplot", "to", "the", "figure", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_base.py#L495-L508
train
wright-group/WrightTools
WrightTools/exceptions.py
WrongFileTypeWarning.warn
def warn(filepath, expected): """Raise warning. Parameters ---------- filepath : path-like Given filepath. expected : string Expected file suffix. """ filepath = pathlib.Path(filepath) message = "file {0} has type {1} (expected {2}...
python
def warn(filepath, expected): """Raise warning. Parameters ---------- filepath : path-like Given filepath. expected : string Expected file suffix. """ filepath = pathlib.Path(filepath) message = "file {0} has type {1} (expected {2}...
[ "def", "warn", "(", "filepath", ",", "expected", ")", ":", "filepath", "=", "pathlib", ".", "Path", "(", "filepath", ")", "message", "=", "\"file {0} has type {1} (expected {2})\"", ".", "format", "(", "filepath", ",", "filepath", ".", "suffix", ",", "expected...
Raise warning. Parameters ---------- filepath : path-like Given filepath. expected : string Expected file suffix.
[ "Raise", "warning", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/exceptions.py#L147-L161
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.channel_names
def channel_names(self) -> tuple: """Channel names.""" if "channel_names" not in self.attrs.keys(): self.attrs["channel_names"] = np.array([], dtype="S") return tuple(s.decode() for s in self.attrs["channel_names"])
python
def channel_names(self) -> tuple: """Channel names.""" if "channel_names" not in self.attrs.keys(): self.attrs["channel_names"] = np.array([], dtype="S") return tuple(s.decode() for s in self.attrs["channel_names"])
[ "def", "channel_names", "(", "self", ")", "->", "tuple", ":", "if", "\"channel_names\"", "not", "in", "self", ".", "attrs", ".", "keys", "(", ")", ":", "self", ".", "attrs", "[", "\"channel_names\"", "]", "=", "np", ".", "array", "(", "[", "]", ",", ...
Channel names.
[ "Channel", "names", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L110-L114
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.ndim
def ndim(self) -> int: """Get number of dimensions.""" try: assert self._ndim is not None except (AssertionError, AttributeError): if len(self.variables) == 0: self._ndim = 0 else: self._ndim = self.variables[0].ndim fin...
python
def ndim(self) -> int: """Get number of dimensions.""" try: assert self._ndim is not None except (AssertionError, AttributeError): if len(self.variables) == 0: self._ndim = 0 else: self._ndim = self.variables[0].ndim fin...
[ "def", "ndim", "(", "self", ")", "->", "int", ":", "try", ":", "assert", "self", ".", "_ndim", "is", "not", "None", "except", "(", "AssertionError", ",", "AttributeError", ")", ":", "if", "len", "(", "self", ".", "variables", ")", "==", "0", ":", "...
Get number of dimensions.
[ "Get", "number", "of", "dimensions", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L140-L150
train
wright-group/WrightTools
WrightTools/data/_data.py
Data._on_axes_updated
def _on_axes_updated(self): """Method to run when axes are changed in any way. Propagates updated axes properly. """ # update attrs self.attrs["axes"] = [a.identity.encode() for a in self._axes] # remove old attributes while len(self._current_axis_identities_in_n...
python
def _on_axes_updated(self): """Method to run when axes are changed in any way. Propagates updated axes properly. """ # update attrs self.attrs["axes"] = [a.identity.encode() for a in self._axes] # remove old attributes while len(self._current_axis_identities_in_n...
[ "def", "_on_axes_updated", "(", "self", ")", ":", "self", ".", "attrs", "[", "\"axes\"", "]", "=", "[", "a", ".", "identity", ".", "encode", "(", ")", "for", "a", "in", "self", ".", "_axes", "]", "while", "len", "(", "self", ".", "_current_axis_ident...
Method to run when axes are changed in any way. Propagates updated axes properly.
[ "Method", "to", "run", "when", "axes", "are", "changed", "in", "any", "way", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L211-L229
train
wright-group/WrightTools
WrightTools/data/_data.py
Data._on_constants_updated
def _on_constants_updated(self): """Method to run when constants are changed in any way. Propagates updated constants properly. """ # update attrs self.attrs["constants"] = [a.identity.encode() for a in self._constants]
python
def _on_constants_updated(self): """Method to run when constants are changed in any way. Propagates updated constants properly. """ # update attrs self.attrs["constants"] = [a.identity.encode() for a in self._constants]
[ "def", "_on_constants_updated", "(", "self", ")", ":", "self", ".", "attrs", "[", "\"constants\"", "]", "=", "[", "a", ".", "identity", ".", "encode", "(", ")", "for", "a", "in", "self", ".", "_constants", "]" ]
Method to run when constants are changed in any way. Propagates updated constants properly.
[ "Method", "to", "run", "when", "constants", "are", "changed", "in", "any", "way", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L231-L237
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.bring_to_front
def bring_to_front(self, channel): """Bring a specific channel to the zero-indexed position in channels. All other channels get pushed back but remain in order. Parameters ---------- channel : int or str Channel index or name. """ channel_index = wt_...
python
def bring_to_front(self, channel): """Bring a specific channel to the zero-indexed position in channels. All other channels get pushed back but remain in order. Parameters ---------- channel : int or str Channel index or name. """ channel_index = wt_...
[ "def", "bring_to_front", "(", "self", ",", "channel", ")", ":", "channel_index", "=", "wt_kit", ".", "get_index", "(", "self", ".", "channel_names", ",", "channel", ")", "new", "=", "list", "(", "self", ".", "channel_names", ")", "new", ".", "insert", "(...
Bring a specific channel to the zero-indexed position in channels. All other channels get pushed back but remain in order. Parameters ---------- channel : int or str Channel index or name.
[ "Bring", "a", "specific", "channel", "to", "the", "zero", "-", "indexed", "position", "in", "channels", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L282-L295
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.gradient
def gradient(self, axis, *, channel=0): """ Compute the gradient along one axis. New channels have names ``<channel name>_<axis name>_gradient``. Parameters ---------- axis : int or str The axis to differentiate along. If given as an integer, the...
python
def gradient(self, axis, *, channel=0): """ Compute the gradient along one axis. New channels have names ``<channel name>_<axis name>_gradient``. Parameters ---------- axis : int or str The axis to differentiate along. If given as an integer, the...
[ "def", "gradient", "(", "self", ",", "axis", ",", "*", ",", "channel", "=", "0", ")", ":", "if", "isinstance", "(", "axis", ",", "int", ")", ":", "axis_index", "=", "axis", "elif", "isinstance", "(", "axis", ",", "str", ")", ":", "index", "=", "s...
Compute the gradient along one axis. New channels have names ``<channel name>_<axis name>_gradient``. Parameters ---------- axis : int or str The axis to differentiate along. If given as an integer, the axis in the underlying array is used, and unita...
[ "Compute", "the", "gradient", "along", "one", "axis", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L440-L494
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.convert
def convert(self, destination_units, *, convert_variables=False, verbose=True): """Convert all compatable axes and constants to given units. Parameters ---------- destination_units : str Destination units. convert_variables : boolean (optional) Toggle con...
python
def convert(self, destination_units, *, convert_variables=False, verbose=True): """Convert all compatable axes and constants to given units. Parameters ---------- destination_units : str Destination units. convert_variables : boolean (optional) Toggle con...
[ "def", "convert", "(", "self", ",", "destination_units", ",", "*", ",", "convert_variables", "=", "False", ",", "verbose", "=", "True", ")", ":", "units_kind", "=", "wt_units", ".", "kind", "(", "destination_units", ")", "for", "axis", "in", "self", ".", ...
Convert all compatable axes and constants to given units. Parameters ---------- destination_units : str Destination units. convert_variables : boolean (optional) Toggle conversion of stored arrays. Default is False verbose : bool (optional) To...
[ "Convert", "all", "compatable", "axes", "and", "constants", "to", "given", "units", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L751-L805
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.create_channel
def create_channel( self, name, values=None, *, shape=None, units=None, dtype=None, **kwargs ) -> Channel: """Append a new channel. Parameters ---------- name : string Unique name for this channel. values : array (optional) Array. If None, an ...
python
def create_channel( self, name, values=None, *, shape=None, units=None, dtype=None, **kwargs ) -> Channel: """Append a new channel. Parameters ---------- name : string Unique name for this channel. values : array (optional) Array. If None, an ...
[ "def", "create_channel", "(", "self", ",", "name", ",", "values", "=", "None", ",", "*", ",", "shape", "=", "None", ",", "units", "=", "None", ",", "dtype", "=", "None", ",", "**", "kwargs", ")", "->", "Channel", ":", "if", "name", "in", "self", ...
Append a new channel. Parameters ---------- name : string Unique name for this channel. values : array (optional) Array. If None, an empty array equaling the data shape is created. Default is None. shape : tuple of int Shape to use...
[ "Append", "a", "new", "channel", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L807-L867
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.create_variable
def create_variable( self, name, values=None, *, shape=None, units=None, dtype=None, **kwargs ) -> Variable: """Add new child variable. Parameters ---------- name : string Unique identifier. values : array-like (optional) Array to populate var...
python
def create_variable( self, name, values=None, *, shape=None, units=None, dtype=None, **kwargs ) -> Variable: """Add new child variable. Parameters ---------- name : string Unique identifier. values : array-like (optional) Array to populate var...
[ "def", "create_variable", "(", "self", ",", "name", ",", "values", "=", "None", ",", "*", ",", "shape", "=", "None", ",", "units", "=", "None", ",", "dtype", "=", "None", ",", "**", "kwargs", ")", "->", "Variable", ":", "if", "name", "in", "self", ...
Add new child variable. Parameters ---------- name : string Unique identifier. values : array-like (optional) Array to populate variable with. If None, an variable will be filled with NaN. Default is None. shape : tuple of int Shap...
[ "Add", "new", "child", "variable", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L869-L924
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.get_nadir
def get_nadir(self, channel=0) -> tuple: """Get the coordinates, in units, of the minimum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in units...
python
def get_nadir(self, channel=0) -> tuple: """Get the coordinates, in units, of the minimum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in units...
[ "def", "get_nadir", "(", "self", ",", "channel", "=", "0", ")", "->", "tuple", ":", "if", "isinstance", "(", "channel", ",", "int", ")", ":", "channel_index", "=", "channel", "elif", "isinstance", "(", "channel", ",", "str", ")", ":", "channel_index", ...
Get the coordinates, in units, of the minimum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in units for each axis.
[ "Get", "the", "coordinates", "in", "units", "of", "the", "minimum", "in", "a", "channel", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L926-L950
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.get_zenith
def get_zenith(self, channel=0) -> tuple: """Get the coordinates, in units, of the maximum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in unit...
python
def get_zenith(self, channel=0) -> tuple: """Get the coordinates, in units, of the maximum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in unit...
[ "def", "get_zenith", "(", "self", ",", "channel", "=", "0", ")", "->", "tuple", ":", "if", "isinstance", "(", "channel", ",", "int", ")", ":", "channel_index", "=", "channel", "elif", "isinstance", "(", "channel", ",", "str", ")", ":", "channel_index", ...
Get the coordinates, in units, of the maximum in a channel. Parameters ---------- channel : int or str (optional) Channel. Default is 0. Returns ------- generator of numbers Coordinates in units for each axis.
[ "Get", "the", "coordinates", "in", "units", "of", "the", "maximum", "in", "a", "channel", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L952-L976
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.heal
def heal(self, channel=0, method="linear", fill_value=np.nan, verbose=True): """ Remove nans from channel using interpolation. Parameters ---------- channel : int or str (optional) Channel to heal. Default is 0. method : {'linear', 'nearest', 'cubic'} (option...
python
def heal(self, channel=0, method="linear", fill_value=np.nan, verbose=True): """ Remove nans from channel using interpolation. Parameters ---------- channel : int or str (optional) Channel to heal. Default is 0. method : {'linear', 'nearest', 'cubic'} (option...
[ "def", "heal", "(", "self", ",", "channel", "=", "0", ",", "method", "=", "\"linear\"", ",", "fill_value", "=", "np", ".", "nan", ",", "verbose", "=", "True", ")", ":", "warnings", ".", "warn", "(", "\"heal\"", ",", "category", "=", "wt_exceptions", ...
Remove nans from channel using interpolation. Parameters ---------- channel : int or str (optional) Channel to heal. Default is 0. method : {'linear', 'nearest', 'cubic'} (optional) The interpolation method. Note that cubic interpolation is only possi...
[ "Remove", "nans", "from", "channel", "using", "interpolation", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L978-L1037
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.level
def level(self, channel, axis, npts, *, verbose=True): """Subtract the average value of npts at the edge of a given axis. Parameters ---------- channel : int or str Channel to level. axis : int Axis to level along. npts : int Number of...
python
def level(self, channel, axis, npts, *, verbose=True): """Subtract the average value of npts at the edge of a given axis. Parameters ---------- channel : int or str Channel to level. axis : int Axis to level along. npts : int Number of...
[ "def", "level", "(", "self", ",", "channel", ",", "axis", ",", "npts", ",", "*", ",", "verbose", "=", "True", ")", ":", "warnings", ".", "warn", "(", "\"level\"", ",", "category", "=", "wt_exceptions", ".", "EntireDatasetInMemoryWarning", ")", "channel_ind...
Subtract the average value of npts at the edge of a given axis. Parameters ---------- channel : int or str Channel to level. axis : int Axis to level along. npts : int Number of points to average for each slice. Positive numbers ta...
[ "Subtract", "the", "average", "value", "of", "npts", "at", "the", "edge", "of", "a", "given", "axis", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1039-L1076
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.print_tree
def print_tree(self, *, verbose=True): """Print a ascii-formatted tree representation of the data contents.""" print("{0} ({1})".format(self.natural_name, self.filepath)) self._print_branch("", depth=0, verbose=verbose)
python
def print_tree(self, *, verbose=True): """Print a ascii-formatted tree representation of the data contents.""" print("{0} ({1})".format(self.natural_name, self.filepath)) self._print_branch("", depth=0, verbose=verbose)
[ "def", "print_tree", "(", "self", ",", "*", ",", "verbose", "=", "True", ")", ":", "print", "(", "\"{0} ({1})\"", ".", "format", "(", "self", ".", "natural_name", ",", "self", ".", "filepath", ")", ")", "self", ".", "_print_branch", "(", "\"\"", ",", ...
Print a ascii-formatted tree representation of the data contents.
[ "Print", "a", "ascii", "-", "formatted", "tree", "representation", "of", "the", "data", "contents", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1314-L1317
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.remove_channel
def remove_channel(self, channel, *, verbose=True): """Remove channel from data. Parameters ---------- channel : int or str Channel index or name to remove. verbose : boolean (optional) Toggle talkback. Default is True. """ channel_index =...
python
def remove_channel(self, channel, *, verbose=True): """Remove channel from data. Parameters ---------- channel : int or str Channel index or name to remove. verbose : boolean (optional) Toggle talkback. Default is True. """ channel_index =...
[ "def", "remove_channel", "(", "self", ",", "channel", ",", "*", ",", "verbose", "=", "True", ")", ":", "channel_index", "=", "wt_kit", ".", "get_index", "(", "self", ".", "channel_names", ",", "channel", ")", "new", "=", "list", "(", "self", ".", "chan...
Remove channel from data. Parameters ---------- channel : int or str Channel index or name to remove. verbose : boolean (optional) Toggle talkback. Default is True.
[ "Remove", "channel", "from", "data", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1353-L1369
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.remove_variable
def remove_variable(self, variable, *, implied=True, verbose=True): """Remove variable from data. Parameters ---------- variable : int or str Variable index or name to remove. implied : boolean (optional) Toggle deletion of other variables that start with...
python
def remove_variable(self, variable, *, implied=True, verbose=True): """Remove variable from data. Parameters ---------- variable : int or str Variable index or name to remove. implied : boolean (optional) Toggle deletion of other variables that start with...
[ "def", "remove_variable", "(", "self", ",", "variable", ",", "*", ",", "implied", "=", "True", ",", "verbose", "=", "True", ")", ":", "if", "isinstance", "(", "variable", ",", "int", ")", ":", "variable", "=", "self", ".", "variable_names", "[", "varia...
Remove variable from data. Parameters ---------- variable : int or str Variable index or name to remove. implied : boolean (optional) Toggle deletion of other variables that start with the same name. Default is True. verbose : boolean (optiona...
[ "Remove", "variable", "from", "data", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1371-L1419
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.rename_channels
def rename_channels(self, *, verbose=True, **kwargs): """Rename a set of channels. Parameters ---------- kwargs Keyword arguments of the form current:'new'. verbose : boolean (optional) Toggle talkback. Default is True """ # ensure that it...
python
def rename_channels(self, *, verbose=True, **kwargs): """Rename a set of channels. Parameters ---------- kwargs Keyword arguments of the form current:'new'. verbose : boolean (optional) Toggle talkback. Default is True """ # ensure that it...
[ "def", "rename_channels", "(", "self", ",", "*", ",", "verbose", "=", "True", ",", "**", "kwargs", ")", ":", "changed", "=", "kwargs", ".", "keys", "(", ")", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "v", "not", "...
Rename a set of channels. Parameters ---------- kwargs Keyword arguments of the form current:'new'. verbose : boolean (optional) Toggle talkback. Default is True
[ "Rename", "a", "set", "of", "channels", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1421-L1458
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.rename_variables
def rename_variables(self, *, implied=True, verbose=True, **kwargs): """Rename a set of variables. Parameters ---------- kwargs Keyword arguments of the form current:'new'. implied : boolean (optional) Toggle inclusion of other variables that start with t...
python
def rename_variables(self, *, implied=True, verbose=True, **kwargs): """Rename a set of variables. Parameters ---------- kwargs Keyword arguments of the form current:'new'. implied : boolean (optional) Toggle inclusion of other variables that start with t...
[ "def", "rename_variables", "(", "self", ",", "*", ",", "implied", "=", "True", ",", "verbose", "=", "True", ",", "**", "kwargs", ")", ":", "kwargs", "=", "collections", ".", "OrderedDict", "(", "kwargs", ")", "if", "implied", ":", "new", "=", "collecti...
Rename a set of variables. Parameters ---------- kwargs Keyword arguments of the form current:'new'. implied : boolean (optional) Toggle inclusion of other variables that start with the same name. Default is True. verbose : boolean (optional) ...
[ "Rename", "a", "set", "of", "variables", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1460-L1529
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.share_nans
def share_nans(self): """Share not-a-numbers between all channels. If any channel is nan at a given index, all channels will be nan at that index after this operation. Uses the share_nans method found in wt.kit. """ def f(_, s, channels): outs = wt_kit.shar...
python
def share_nans(self): """Share not-a-numbers between all channels. If any channel is nan at a given index, all channels will be nan at that index after this operation. Uses the share_nans method found in wt.kit. """ def f(_, s, channels): outs = wt_kit.shar...
[ "def", "share_nans", "(", "self", ")", ":", "def", "f", "(", "_", ",", "s", ",", "channels", ")", ":", "outs", "=", "wt_kit", ".", "share_nans", "(", "*", "[", "c", "[", "s", "]", "for", "c", "in", "channels", "]", ")", "for", "c", ",", "o", ...
Share not-a-numbers between all channels. If any channel is nan at a given index, all channels will be nan at that index after this operation. Uses the share_nans method found in wt.kit.
[ "Share", "not", "-", "a", "-", "numbers", "between", "all", "channels", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1531-L1545
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.smooth
def smooth(self, factors, channel=None, verbose=True) -> "Data": """Smooth a channel using an n-dimenional kaiser window. Note, all arrays are loaded into memory. For more info see `Kaiser_window`__ wikipedia entry. __ https://en.wikipedia.org/wiki/Kaiser_window Parameters ...
python
def smooth(self, factors, channel=None, verbose=True) -> "Data": """Smooth a channel using an n-dimenional kaiser window. Note, all arrays are loaded into memory. For more info see `Kaiser_window`__ wikipedia entry. __ https://en.wikipedia.org/wiki/Kaiser_window Parameters ...
[ "def", "smooth", "(", "self", ",", "factors", ",", "channel", "=", "None", ",", "verbose", "=", "True", ")", "->", "\"Data\"", ":", "warnings", ".", "warn", "(", "\"smooth\"", ",", "category", "=", "wt_exceptions", ".", "EntireDatasetInMemoryWarning", ")", ...
Smooth a channel using an n-dimenional kaiser window. Note, all arrays are loaded into memory. For more info see `Kaiser_window`__ wikipedia entry. __ https://en.wikipedia.org/wiki/Kaiser_window Parameters ---------- factors : int or list of int The smooth...
[ "Smooth", "a", "channel", "using", "an", "n", "-", "dimenional", "kaiser", "window", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1547-L1613
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.transform
def transform(self, *axes, verbose=True): """Transform the data. Parameters ---------- axes : strings Expressions for the new set of axes. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- set_constan...
python
def transform(self, *axes, verbose=True): """Transform the data. Parameters ---------- axes : strings Expressions for the new set of axes. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- set_constan...
[ "def", "transform", "(", "self", ",", "*", "axes", ",", "verbose", "=", "True", ")", ":", "new", "=", "[", "]", "newt", "=", "\"newt\"", "in", "self", ".", "axis_expressions", "current", "=", "{", "a", ".", "expression", ":", "a", "for", "a", "in",...
Transform the data. Parameters ---------- axes : strings Expressions for the new set of axes. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- set_constants Similar method except for constants
[ "Transform", "the", "data", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1764-L1799
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.set_constants
def set_constants(self, *constants, verbose=True): """Set the constants associated with the data. Parameters ---------- constants : str Expressions for the new set of constants. verbose : boolean (optional) Toggle talkback. Default is True See Al...
python
def set_constants(self, *constants, verbose=True): """Set the constants associated with the data. Parameters ---------- constants : str Expressions for the new set of constants. verbose : boolean (optional) Toggle talkback. Default is True See Al...
[ "def", "set_constants", "(", "self", ",", "*", "constants", ",", "verbose", "=", "True", ")", ":", "new", "=", "[", "]", "current", "=", "{", "c", ".", "expression", ":", "c", "for", "c", "in", "self", ".", "_constants", "}", "for", "expression", "...
Set the constants associated with the data. Parameters ---------- constants : str Expressions for the new set of constants. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- transform Similar meth...
[ "Set", "the", "constants", "associated", "with", "the", "data", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1801-L1833
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.create_constant
def create_constant(self, expression, *, verbose=True): """Append a constant to the stored list. Parameters ---------- expression : str Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True See...
python
def create_constant(self, expression, *, verbose=True): """Append a constant to the stored list. Parameters ---------- expression : str Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True See...
[ "def", "create_constant", "(", "self", ",", "expression", ",", "*", ",", "verbose", "=", "True", ")", ":", "if", "expression", "in", "self", ".", "constant_expressions", ":", "wt_exceptions", ".", "ObjectExistsWarning", ".", "warn", "(", "expression", ")", "...
Append a constant to the stored list. Parameters ---------- expression : str Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- set_constants Remove and...
[ "Append", "a", "constant", "to", "the", "stored", "list", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1835-L1863
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.remove_constant
def remove_constant(self, constant, *, verbose=True): """Remove a constant from the stored list. Parameters ---------- constant : str or Constant or int Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True ...
python
def remove_constant(self, constant, *, verbose=True): """Remove a constant from the stored list. Parameters ---------- constant : str or Constant or int Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True ...
[ "def", "remove_constant", "(", "self", ",", "constant", ",", "*", ",", "verbose", "=", "True", ")", ":", "if", "isinstance", "(", "constant", ",", "(", "str", ",", "int", ")", ")", ":", "constant_index", "=", "wt_kit", ".", "get_index", "(", "self", ...
Remove a constant from the stored list. Parameters ---------- constant : str or Constant or int Expression for the new constant. verbose : boolean (optional) Toggle talkback. Default is True See Also -------- set_constants ...
[ "Remove", "a", "constant", "from", "the", "stored", "list", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1865-L1891
train
wright-group/WrightTools
WrightTools/data/_data.py
Data.zoom
def zoom(self, factor, order=1, verbose=True): """Zoom the data array using spline interpolation of the requested order. The number of points along each axis is increased by factor. See `scipy ndimage`__ for more info. __ http://docs.scipy.org/doc/scipy/reference/ g...
python
def zoom(self, factor, order=1, verbose=True): """Zoom the data array using spline interpolation of the requested order. The number of points along each axis is increased by factor. See `scipy ndimage`__ for more info. __ http://docs.scipy.org/doc/scipy/reference/ g...
[ "def", "zoom", "(", "self", ",", "factor", ",", "order", "=", "1", ",", "verbose", "=", "True", ")", ":", "raise", "NotImplementedError", "import", "scipy", ".", "ndimage", "for", "axis", "in", "self", ".", "_axes", ":", "axis", "[", ":", "]", "=", ...
Zoom the data array using spline interpolation of the requested order. The number of points along each axis is increased by factor. See `scipy ndimage`__ for more info. __ http://docs.scipy.org/doc/scipy/reference/ generated/scipy.ndimage.interpolation.zoom.html Pa...
[ "Zoom", "the", "data", "array", "using", "spline", "interpolation", "of", "the", "requested", "order", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1893-L1922
train
wright-group/WrightTools
WrightTools/kit/_path.py
get_path_matching
def get_path_matching(name): """Get path matching a name. Parameters ---------- name : string Name to search for. Returns ------- string Full filepath. """ # first try looking in the user folder p = os.path.join(os.path.expanduser("~"), name) # then try expa...
python
def get_path_matching(name): """Get path matching a name. Parameters ---------- name : string Name to search for. Returns ------- string Full filepath. """ # first try looking in the user folder p = os.path.join(os.path.expanduser("~"), name) # then try expa...
[ "def", "get_path_matching", "(", "name", ")", ":", "p", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", ",", "name", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "p", ")", ":", "p", ...
Get path matching a name. Parameters ---------- name : string Name to search for. Returns ------- string Full filepath.
[ "Get", "path", "matching", "a", "name", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_path.py#L20-L44
train
wright-group/WrightTools
WrightTools/kit/_path.py
glob_handler
def glob_handler(extension, folder=None, identifier=None): """Return a list of all files matching specified inputs. Parameters ---------- extension : string File extension. folder : string (optional) Folder to search within. Default is None (current working directory). i...
python
def glob_handler(extension, folder=None, identifier=None): """Return a list of all files matching specified inputs. Parameters ---------- extension : string File extension. folder : string (optional) Folder to search within. Default is None (current working directory). i...
[ "def", "glob_handler", "(", "extension", ",", "folder", "=", "None", ",", "identifier", "=", "None", ")", ":", "filepaths", "=", "[", "]", "if", "folder", ":", "folder", "=", "folder", ".", "replace", "(", "\"[\"", ",", "\"?\"", ")", "folder", "=", "...
Return a list of all files matching specified inputs. Parameters ---------- extension : string File extension. folder : string (optional) Folder to search within. Default is None (current working directory). identifier : string Unique identifier. Default is None. ...
[ "Return", "a", "list", "of", "all", "files", "matching", "specified", "inputs", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_path.py#L47-L81
train
wright-group/WrightTools
WrightTools/data/_channel.py
Channel.major_extent
def major_extent(self) -> complex: """Maximum deviation from null.""" return max((self.max() - self.null, self.null - self.min()))
python
def major_extent(self) -> complex: """Maximum deviation from null.""" return max((self.max() - self.null, self.null - self.min()))
[ "def", "major_extent", "(", "self", ")", "->", "complex", ":", "return", "max", "(", "(", "self", ".", "max", "(", ")", "-", "self", ".", "null", ",", "self", ".", "null", "-", "self", ".", "min", "(", ")", ")", ")" ]
Maximum deviation from null.
[ "Maximum", "deviation", "from", "null", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_channel.py#L82-L84
train
wright-group/WrightTools
WrightTools/data/_channel.py
Channel.minor_extent
def minor_extent(self) -> complex: """Minimum deviation from null.""" return min((self.max() - self.null, self.null - self.min()))
python
def minor_extent(self) -> complex: """Minimum deviation from null.""" return min((self.max() - self.null, self.null - self.min()))
[ "def", "minor_extent", "(", "self", ")", "->", "complex", ":", "return", "min", "(", "(", "self", ".", "max", "(", ")", "-", "self", ".", "null", ",", "self", ".", "null", "-", "self", ".", "min", "(", ")", ")", ")" ]
Minimum deviation from null.
[ "Minimum", "deviation", "from", "null", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_channel.py#L87-L89
train
wright-group/WrightTools
WrightTools/data/_channel.py
Channel.normalize
def normalize(self, mag=1.): """Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1. """ def f(dataset, s, null, mag): dataset[s] -= null dataset...
python
def normalize(self, mag=1.): """Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1. """ def f(dataset, s, null, mag): dataset[s] -= null dataset...
[ "def", "normalize", "(", "self", ",", "mag", "=", "1.", ")", ":", "def", "f", "(", "dataset", ",", "s", ",", "null", ",", "mag", ")", ":", "dataset", "[", "s", "]", "-=", "null", "dataset", "[", "s", "]", "/=", "mag", "if", "self", ".", "sign...
Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1.
[ "Normalize", "a", "Channel", "set", "null", "to", "0", "and", "the", "mag", "to", "given", "value", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_channel.py#L115-L133
train
wright-group/WrightTools
WrightTools/data/_channel.py
Channel.trim
def trim(self, neighborhood, method="ztest", factor=3, replace="nan", verbose=True): """Remove outliers from the dataset. Identifies outliers by comparing each point to its neighbors using a statistical test. Parameters ---------- neighborhood : list of integers ...
python
def trim(self, neighborhood, method="ztest", factor=3, replace="nan", verbose=True): """Remove outliers from the dataset. Identifies outliers by comparing each point to its neighbors using a statistical test. Parameters ---------- neighborhood : list of integers ...
[ "def", "trim", "(", "self", ",", "neighborhood", ",", "method", "=", "\"ztest\"", ",", "factor", "=", "3", ",", "replace", "=", "\"nan\"", ",", "verbose", "=", "True", ")", ":", "warnings", ".", "warn", "(", "\"trim\"", ",", "category", "=", "wt_except...
Remove outliers from the dataset. Identifies outliers by comparing each point to its neighbors using a statistical test. Parameters ---------- neighborhood : list of integers Size of the neighborhood in each dimension. Length of the list must be equal to...
[ "Remove", "outliers", "from", "the", "dataset", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_channel.py#L135-L223
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.units
def units(self, value): """Set units.""" if value is None: if "units" in self.attrs.keys(): self.attrs.pop("units") else: try: self.attrs["units"] = value except AttributeError: self.attrs["units"] = value
python
def units(self, value): """Set units.""" if value is None: if "units" in self.attrs.keys(): self.attrs.pop("units") else: try: self.attrs["units"] = value except AttributeError: self.attrs["units"] = value
[ "def", "units", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "if", "\"units\"", "in", "self", ".", "attrs", ".", "keys", "(", ")", ":", "self", ".", "attrs", ".", "pop", "(", "\"units\"", ")", "else", ":", "try", ":", ...
Set units.
[ "Set", "units", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L179-L188
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.argmax
def argmax(self): """Index of the maximum, ignorning nans.""" if "argmax" not in self.attrs.keys(): def f(dataset, s): arr = dataset[s] try: amin = np.nanargmax(arr) except ValueError: amin = 0 ...
python
def argmax(self): """Index of the maximum, ignorning nans.""" if "argmax" not in self.attrs.keys(): def f(dataset, s): arr = dataset[s] try: amin = np.nanargmax(arr) except ValueError: amin = 0 ...
[ "def", "argmax", "(", "self", ")", ":", "if", "\"argmax\"", "not", "in", "self", ".", "attrs", ".", "keys", "(", ")", ":", "def", "f", "(", "dataset", ",", "s", ")", ":", "arr", "=", "dataset", "[", "s", "]", "try", ":", "amin", "=", "np", "....
Index of the maximum, ignorning nans.
[ "Index", "of", "the", "maximum", "ignorning", "nans", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L190-L208
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.chunkwise
def chunkwise(self, func, *args, **kwargs): """Execute a function for each chunk in the dataset. Order of excecution is not guaranteed. Parameters ---------- func : function Function to execute. First two arguments must be dataset, slices. args (...
python
def chunkwise(self, func, *args, **kwargs): """Execute a function for each chunk in the dataset. Order of excecution is not guaranteed. Parameters ---------- func : function Function to execute. First two arguments must be dataset, slices. args (...
[ "def", "chunkwise", "(", "self", ",", "func", ",", "*", "args", ",", "**", "kwargs", ")", ":", "out", "=", "collections", ".", "OrderedDict", "(", ")", "for", "s", "in", "self", ".", "slices", "(", ")", ":", "key", "=", "tuple", "(", "sss", ".", ...
Execute a function for each chunk in the dataset. Order of excecution is not guaranteed. Parameters ---------- func : function Function to execute. First two arguments must be dataset, slices. args (optional) Additional (unchanging) arguments...
[ "Execute", "a", "function", "for", "each", "chunk", "in", "the", "dataset", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L230-L256
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.clip
def clip(self, min=None, max=None, replace=np.nan): """Clip values outside of a defined range. Parameters ---------- min : number (optional) New channel minimum. Default is None. max : number (optional) New channel maximum. Default is None. replac...
python
def clip(self, min=None, max=None, replace=np.nan): """Clip values outside of a defined range. Parameters ---------- min : number (optional) New channel minimum. Default is None. max : number (optional) New channel maximum. Default is None. replac...
[ "def", "clip", "(", "self", ",", "min", "=", "None", ",", "max", "=", "None", ",", "replace", "=", "np", ".", "nan", ")", ":", "if", "max", "is", "None", ":", "max", "=", "self", ".", "max", "(", ")", "if", "min", "is", "None", ":", "min", ...
Clip values outside of a defined range. Parameters ---------- min : number (optional) New channel minimum. Default is None. max : number (optional) New channel maximum. Default is None. replace : number or 'value' (optional) Replace behavior. ...
[ "Clip", "values", "outside", "of", "a", "defined", "range", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L258-L290
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.convert
def convert(self, destination_units): """Convert units. Parameters ---------- destination_units : string (optional) Units to convert into. """ if not wt_units.is_valid_conversion(self.units, destination_units): kind = wt_units.kind(self.units) ...
python
def convert(self, destination_units): """Convert units. Parameters ---------- destination_units : string (optional) Units to convert into. """ if not wt_units.is_valid_conversion(self.units, destination_units): kind = wt_units.kind(self.units) ...
[ "def", "convert", "(", "self", ",", "destination_units", ")", ":", "if", "not", "wt_units", ".", "is_valid_conversion", "(", "self", ".", "units", ",", "destination_units", ")", ":", "kind", "=", "wt_units", ".", "kind", "(", "self", ".", "units", ")", "...
Convert units. Parameters ---------- destination_units : string (optional) Units to convert into.
[ "Convert", "units", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L292-L311
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.log
def log(self, base=np.e, floor=None): """Take the log of the entire dataset. Parameters ---------- base : number (optional) Base of log. Default is e. floor : number (optional) Clip values below floor after log. Default is None. """ def f...
python
def log(self, base=np.e, floor=None): """Take the log of the entire dataset. Parameters ---------- base : number (optional) Base of log. Default is e. floor : number (optional) Clip values below floor after log. Default is None. """ def f...
[ "def", "log", "(", "self", ",", "base", "=", "np", ".", "e", ",", "floor", "=", "None", ")", ":", "def", "f", "(", "dataset", ",", "s", ",", "base", ",", "floor", ")", ":", "arr", "=", "dataset", "[", "s", "]", "arr", "=", "np", ".", "log",...
Take the log of the entire dataset. Parameters ---------- base : number (optional) Base of log. Default is e. floor : number (optional) Clip values below floor after log. Default is None.
[ "Take", "the", "log", "of", "the", "entire", "dataset", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L313-L333
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.log10
def log10(self, floor=None): """Take the log base 10 of the entire dataset. Parameters ---------- floor : number (optional) Clip values below floor after log. Default is None. """ def f(dataset, s, floor): arr = dataset[s] arr = np.lo...
python
def log10(self, floor=None): """Take the log base 10 of the entire dataset. Parameters ---------- floor : number (optional) Clip values below floor after log. Default is None. """ def f(dataset, s, floor): arr = dataset[s] arr = np.lo...
[ "def", "log10", "(", "self", ",", "floor", "=", "None", ")", ":", "def", "f", "(", "dataset", ",", "s", ",", "floor", ")", ":", "arr", "=", "dataset", "[", "s", "]", "arr", "=", "np", ".", "log10", "(", "arr", ")", "if", "floor", "is", "not",...
Take the log base 10 of the entire dataset. Parameters ---------- floor : number (optional) Clip values below floor after log. Default is None.
[ "Take", "the", "log", "base", "10", "of", "the", "entire", "dataset", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L335-L351
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.max
def max(self): """Maximum, ignorning nans.""" if "max" not in self.attrs.keys(): def f(dataset, s): return np.nanmax(dataset[s]) self.attrs["max"] = np.nanmax(list(self.chunkwise(f).values())) return self.attrs["max"]
python
def max(self): """Maximum, ignorning nans.""" if "max" not in self.attrs.keys(): def f(dataset, s): return np.nanmax(dataset[s]) self.attrs["max"] = np.nanmax(list(self.chunkwise(f).values())) return self.attrs["max"]
[ "def", "max", "(", "self", ")", ":", "if", "\"max\"", "not", "in", "self", ".", "attrs", ".", "keys", "(", ")", ":", "def", "f", "(", "dataset", ",", "s", ")", ":", "return", "np", ".", "nanmax", "(", "dataset", "[", "s", "]", ")", "self", "....
Maximum, ignorning nans.
[ "Maximum", "ignorning", "nans", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L371-L379
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.min
def min(self): """Minimum, ignoring nans.""" if "min" not in self.attrs.keys(): def f(dataset, s): return np.nanmin(dataset[s]) self.attrs["min"] = np.nanmin(list(self.chunkwise(f).values())) return self.attrs["min"]
python
def min(self): """Minimum, ignoring nans.""" if "min" not in self.attrs.keys(): def f(dataset, s): return np.nanmin(dataset[s]) self.attrs["min"] = np.nanmin(list(self.chunkwise(f).values())) return self.attrs["min"]
[ "def", "min", "(", "self", ")", ":", "if", "\"min\"", "not", "in", "self", ".", "attrs", ".", "keys", "(", ")", ":", "def", "f", "(", "dataset", ",", "s", ")", ":", "return", "np", ".", "nanmin", "(", "dataset", "[", "s", "]", ")", "self", "....
Minimum, ignoring nans.
[ "Minimum", "ignoring", "nans", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L381-L389
train
wright-group/WrightTools
WrightTools/_dataset.py
Dataset.slices
def slices(self): """Returns a generator yielding tuple of slice objects. Order is not guaranteed. """ if self.chunks is None: yield tuple(slice(None, s) for s in self.shape) else: ceilings = tuple(-(-s // c) for s, c in zip(self.shape, self.chunks)) ...
python
def slices(self): """Returns a generator yielding tuple of slice objects. Order is not guaranteed. """ if self.chunks is None: yield tuple(slice(None, s) for s in self.shape) else: ceilings = tuple(-(-s // c) for s, c in zip(self.shape, self.chunks)) ...
[ "def", "slices", "(", "self", ")", ":", "if", "self", ".", "chunks", "is", "None", ":", "yield", "tuple", "(", "slice", "(", "None", ",", "s", ")", "for", "s", "in", "self", ".", "shape", ")", "else", ":", "ceilings", "=", "tuple", "(", "-", "(...
Returns a generator yielding tuple of slice objects. Order is not guaranteed.
[ "Returns", "a", "generator", "yielding", "tuple", "of", "slice", "objects", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/_dataset.py#L391-L406
train
wright-group/WrightTools
WrightTools/data/_constant.py
Constant.label
def label(self) -> str: """A latex formatted label representing constant expression and united value.""" label = self.expression.replace("_", "\\;") if self.units_kind: symbol = wt_units.get_symbol(self.units) for v in self.variables: vl = "%s_{%s}" % (sym...
python
def label(self) -> str: """A latex formatted label representing constant expression and united value.""" label = self.expression.replace("_", "\\;") if self.units_kind: symbol = wt_units.get_symbol(self.units) for v in self.variables: vl = "%s_{%s}" % (sym...
[ "def", "label", "(", "self", ")", "->", "str", ":", "label", "=", "self", ".", "expression", ".", "replace", "(", "\"_\"", ",", "\"\\\\;\"", ")", "if", "self", ".", "units_kind", ":", "symbol", "=", "wt_units", ".", "get_symbol", "(", "self", ".", "u...
A latex formatted label representing constant expression and united value.
[ "A", "latex", "formatted", "label", "representing", "constant", "expression", "and", "united", "value", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_constant.py#L61-L81
train
wright-group/WrightTools
WrightTools/collection/_directory.py
from_directory
def from_directory(filepath, from_methods, *, name=None, parent=None, verbose=True): """Create a WrightTools Collection from a directory of source files. Parameters ---------- filepath: path-like Path to the directory on the file system from_methods: dict<str, callable> Dictionary w...
python
def from_directory(filepath, from_methods, *, name=None, parent=None, verbose=True): """Create a WrightTools Collection from a directory of source files. Parameters ---------- filepath: path-like Path to the directory on the file system from_methods: dict<str, callable> Dictionary w...
[ "def", "from_directory", "(", "filepath", ",", "from_methods", ",", "*", ",", "name", "=", "None", ",", "parent", "=", "None", ",", "verbose", "=", "True", ")", ":", "filepath", "=", "pathlib", ".", "Path", "(", "filepath", ")", ".", "resolve", "(", ...
Create a WrightTools Collection from a directory of source files. Parameters ---------- filepath: path-like Path to the directory on the file system from_methods: dict<str, callable> Dictionary which maps patterns (using Unix-like glob wildcard patterns) to functions which take ...
[ "Create", "a", "WrightTools", "Collection", "from", "a", "directory", "of", "source", "files", "." ]
80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/collection/_directory.py#L24-L92
train
thombashi/allpairspy
examples/example2.2.py
is_valid_combination
def is_valid_combination(values, names): dictionary = dict(zip(names, values)) """ Should return True if combination is valid and False otherwise. Dictionary that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data...
python
def is_valid_combination(values, names): dictionary = dict(zip(names, values)) """ Should return True if combination is valid and False otherwise. Dictionary that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data...
[ "def", "is_valid_combination", "(", "values", ",", "names", ")", ":", "dictionary", "=", "dict", "(", "zip", "(", "names", ",", "values", ")", ")", "rules", "=", "[", "lambda", "d", ":", "\"98\"", "==", "d", "[", "\"os\"", "]", "and", "\"Brand Y\"", ...
Should return True if combination is valid and False otherwise. Dictionary that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data to validate it.
[ "Should", "return", "True", "if", "combination", "is", "valid", "and", "False", "otherwise", "." ]
9dd256d7ccdc1348c5807d4a814294d9c5192293
https://github.com/thombashi/allpairspy/blob/9dd256d7ccdc1348c5807d4a814294d9c5192293/examples/example2.2.py#L14-L42
train
thombashi/allpairspy
examples/example2.1.py
is_valid_combination
def is_valid_combination(row): """ This is a filtering function. Filtering functions should return True if combination is valid and False otherwise. Test row that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data t...
python
def is_valid_combination(row): """ This is a filtering function. Filtering functions should return True if combination is valid and False otherwise. Test row that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data t...
[ "def", "is_valid_combination", "(", "row", ")", ":", "n", "=", "len", "(", "row", ")", "if", "n", ">", "1", ":", "if", "\"98\"", "==", "row", "[", "1", "]", "and", "\"Brand Y\"", "==", "row", "[", "0", "]", ":", "return", "False", "if", "\"XP\"",...
This is a filtering function. Filtering functions should return True if combination is valid and False otherwise. Test row that is passed here can be incomplete. To prevent search for unnecessary items filtering function is executed with found subset of data to validate it.
[ "This", "is", "a", "filtering", "function", ".", "Filtering", "functions", "should", "return", "True", "if", "combination", "is", "valid", "and", "False", "otherwise", "." ]
9dd256d7ccdc1348c5807d4a814294d9c5192293
https://github.com/thombashi/allpairspy/blob/9dd256d7ccdc1348c5807d4a814294d9c5192293/examples/example2.1.py#L13-L39
train