spectrochempy.Coordο
- class Coord(data=None, **kwargs)[source]ο
- Explicit coordinates for a dataset along a given axis. - The coordinates of a - NDDatasetcan be created using the- Coordobject. This is a single dimension array with either numerical (float) values or labels (str,- Datetimeobjects, or any other kind of objects) to represent the coordinates. Only a one numerical axis can be defined, but labels can be multiple.- Parameters:
- data (ndarray, tuple or list) β The actual data array contained in the - Coordobject. The given array (with a single dimension) can be a list, a tuple, a- ndarray, or a array-like object. If an object is passed that contains labels, or units, these elements will be used to accordingly set those of the created object. If possible, the provided data will not be copied for- datainput, but will be passed by reference, so you should make a copy the- databefore passing it in the object constructor if thatβs the desired behavior or set the- copyargument to True.
- **kwargs β Optional keywords parameters. See other parameters. 
 
- Other Parameters:
- dtype (str or dtype, optional, default=np.float64) β If specified, the data will be cast to this dtype, else the type of the data will be used. 
- dims (list of chars, optional.) β if specified the list must have a length equal to the number od data dimensions (ndim) and the chars must be taken among x,y,z,u,v,w or t. If not specified, the dimension names are automatically attributed in this order. 
- name (str, optional) β A user-friendly name for this object. If not given, the automatic - idgiven at the object creation will be used as a name.
- labels (array of objects, optional) β Labels for the - data. labels can be used only for 1D-datasets. The labels array may have an additional dimension, meaning several series of labels for the same data. The given array can be a list, a tuple, a- ndarray, a ndarray-like, a- NDArrayor any subclass of- NDArray.
- units ( - Unitinstance or str, optional) β Units of the data. If data is a- Quantitythen- unitsis set to the unit of the- data; if a unit is also explicitly provided an error is raised. Handling of units use the pint package.
- title (str, optional) β The title of the dimension. It will later be used for instance for labelling plots of the data. It is optional but recommended to give a title to each ndarray. 
- dlabel (str, optional) β Alias of - title.
- linearize_below (float, optional, default=0.1) β variation of spacing in % below which the coordinate is linearized. Set it to 
- rounding (bool, optional, default=True) β If True, the data will be rounded to the number of significant digits given by - sigdigits.
- sigdigits (int, optional, default=4) β Number of significant digits to be used for rounding and linearizing the data. 
- larmor ( - floator- Quantityinstance, optional) β The Larmor frequency of the nucleus. This is used only for NMR data.
- offset ( - floatinstance, optional) β The offset of the axis. This is used to generate an evenly values spaced axis together with- Γ¬ncrementand- size.
- increment ( - floatinstance, optional) β The increment between two consecutive values of the axis. This is used to generate an evenly values spaced axis together with- offsetand- size.
- size ( - intinstance, optional) β The size of the axis. This is used to generate an evenly values spaced axis together with- offsetand- increment.
 
 - See also - NDDataset
- Main SpectroChemPy object: an array with masks, units and coordinates. 
 - Examples - We first import the object from the api : - >>> from spectrochempy import Coord - We then create a numpy - ndarrayand use it as the numerical- dataaxis of our new- Coordobject :- >>> c0 = Coord.arange(1., 12., 2., title='frequency', units='Hz') >>> c0 Coord: [float64] Hz (size: 6) - We can take a series of str to create a non-numerical but labelled axis : - >>> tarr = list('abcdef') >>> tarr ['a', 'b', 'c', 'd', 'e', 'f'] - >>> c1 = Coord(labels=tarr, title='mylabels') >>> c1 Coord: [labels] [ a b c d e f] (size: 6) - Attributes Summary - Data array ( - ndarray).- True if the - dataarray is dimensionless - Readonly property (bool).- Return the data type. - True if the - dataarray is not empty.- True is the name has been defined (bool). - True if the - dataarray have units - Readonly property (bool).- Object identifier - Readonly property (str). - True if the - dataarray is empty or size=0, and if no label are present.- True if the - dataare real values - Readonly property (bool).- True if the - dataare integer values - Readonly property (bool).- True if the - dataarray have labels - Readonly property (bool).- Return larmor frequency in NMR spectroscopy context. - Laser frequency if needed (Quantity). - Range of the data (list). - Whether the coordinates axis is linear (i.e. regularly spaced). - Data array ( - ndarray).- Data array ( - ndarray).- Additional metadata ( - Meta).- A user-friendly name (str). - Whether the axis is reversed. - Region of interest (ROI) limits (list). - A tuple with the size of each dimension - Readonly property. - True if axis must discard values and show only datapoints. - Number of significant digits for rounding coordinate values. - Size of the underlying - dataarray - Readonly property (int).- Coordinate spacing. - An user-friendly title (str). - The actual array with mask and unit ( - Quantity).- bool- True if the- datadoes not have- units(Readonly property).- Unit- The units of the data.- Alias of - values.- Quantity- The actual values (data, units) contained in this object (Readonly property).- Methods Summary - amax(dataset[,Β dim,Β keepdims])- Return the maximum of the dataset or maxima along given dimensions. - amin(dataset[,Β dim,Β keepdims])- Return the maximum of the dataset or maxima along given dimensions. - arange([start,Β stop,Β step,Β dtype])- Return evenly spaced values within a given interval. - around(dataset[,Β decimals])- Evenly round to the given number of decimals. - astype([dtype])- Cast the data to a specified type. - copy([deep,Β keepname])- Make a disconnected copy of the current object. - fromfunction(cls,Β function[,Β shape,Β dtype,Β ...])- Construct a nddataset by executing a function over each coordinate. - fromiter(iterable[,Β dtype,Β count])- Create a new 1-dimensional array from an iterable object. - geomspace(start,Β stop[,Β num,Β endpoint,Β dtype])- Return numbers spaced evenly on a log scale (a geometric progression). - get_labels([level])- Get the labels at a given level. - is_units_compatible(other)- Check the compatibility of units with another object. - ito(other[,Β force])- Inplace scaling to different units. - Inplace rescaling to base units. - Quantity scaled in place to reduced units, inplace. - linearize([sigdigits])- Linearize the coordinate's data. - linspace(cls,Β start,Β stop[,Β num,Β endpoint,Β ...])- Return evenly spaced numbers over a specified interval. - loc2index(loc[,Β return_error])- Return the index corresponding to a given location. - logspace(cls,Β start,Β stop[,Β num,Β endpoint,Β ...])- Return numbers spaced evenly on a log scale. - max(dataset[,Β dim,Β keepdims])- Return the maximum of the dataset or maxima along given dimensions. - min(dataset[,Β dim,Β keepdims])- Return the maximum of the dataset or maxima along given dimensions. - ptp(dataset[,Β dim,Β keepdims])- Range of values (maximum - minimum) along a dimension. - round(dataset[,Β decimals])- Evenly round to the given number of decimals. - round_(dataset[,Β decimals])- Evenly round to the given number of decimals. - set_laser_frequency([frequency])- Set the laser frequency. - to(other[,Β inplace,Β force])- Return the object with data rescaled to different units. - to_base_units([inplace])- Return an array rescaled to base units. - to_reduced_units([inplace])- Return an array scaled in place to reduced units. - Attributes Documentation - dataο
- Data array ( - ndarray).- If there is no data but labels, then the labels are returned instead of data. . - Notes - The data are always returned as a 1D array of float rounded to the number of significant digits given by the - sigdigitsparameters. If the spacing between the data is constant with the accuracy given by the significant digits, the data are thus linearized and the- linearattribute is set to True.
 - dimensionlessο
- True if the - dataarray is dimensionless - Readonly property (bool).- Notes - Dimensionlessis different of- unitlesswhich means no unit.
 - dtypeο
- Return the data type. 
 - has_defined_nameο
- True is the name has been defined (bool). 
 - has_unitsο
- True if the - dataarray have units - Readonly property (bool).- See also - unitless
- True if the data has no unit. 
- dimensionless
- True if the data have dimensionless units. 
 
 - idο
- Object identifier - Readonly property (str). 
 - is_emptyο
- True if the - dataarray is empty or size=0, and if no label are present.- Readonly property (bool). 
 - labelsο
- An array of labels for - data(- ndarrayof str).- An array of objects of any type (but most generally string), with the last dimension size equal to that of the dimension of data. Note thatβs labelling is possible only for 1D data. One classical application is the labelling of coordinates to display informative strings instead of numerical values. 
 - larmorο
- Return larmor frequency in NMR spectroscopy context. 
 - laser_frequencyο
- Laser frequency if needed (Quantity). 
 - limitsο
- Range of the data (list). 
 - linearο
- Whether the coordinates axis is linear (i.e. regularly spaced). 
 - mο
- Data array ( - ndarray).- If there is no data but labels, then the labels are returned instead of data. 
 - magnitudeο
- Data array ( - ndarray).- If there is no data but labels, then the labels are returned instead of data. 
 - metaο
- Additional metadata ( - Meta).
 - nameο
- A user-friendly name (str). - When no name is provided, the - idof the object is returned instead.
 - reversedο
- Whether the axis is reversed. 
 - roiο
- Region of interest (ROI) limits (list). 
 - shapeο
- A tuple with the size of each dimension - Readonly property. - The number of - dataelement on each dimension (possibly complex). For only labelled array, there is no data, so it is the 1D and the size is the size of the array of labels.
 - show_datapointsο
- True if axis must discard values and show only datapoints. - Type:
- Bool 
 
 - sigdigitsο
- Number of significant digits for rounding coordinate values. - Notes - The number of significant digits is used when linearizing the coordinates. It is also used when setting the coordinates values at the Coord initialization or everytime the data array is changed. 
 - sizeο
- Size of the underlying - dataarray - Readonly property (int).- The total number of data elements (possibly complex or hypercomplex in the array). 
 - spacingο
- Coordinate spacing. - It will be a scalar if the coordinates are uniformly spaced, else an array of the different spacings. - Notes - The spacing is returned in the units of the coordinate. 
 - titleο
- An user-friendly title (str). - When the title is provided, it can be used for labeling the object, e.g., axe title in a matplotlib plot. 
 - Methods Documentation - amax(dataset, dim=None, keepdims=False, **kwargs)[source]ο
- Return the maximum of the dataset or maxima along given dimensions. - Parameters:
- dataset (array_like) β Input array or object that can be converted to an array. 
- dim (None or int or dimension name or tuple of int or dimensions, optional) β Dimension or dimensions along which to operate. By default, flattened input is used. If this is a tuple, the maximum is selected over multiple dimensions, instead of a single dimension or all the dimensions as before. 
- keepdims (bool, optional) β If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. 
 
- Returns:
- amax β Maximum of the data. If - dimis None, the result is a scalar value. If- dimis given, the result is an array of dimension- ndim - 1.
 - See also - amin
- The minimum value of a dataset along a given dimension, propagating NaNs. 
- minimum
- Element-wise minimum of two datasets, propagating any NaNs. 
- maximum
- Element-wise maximum of two datasets, propagating any NaNs. 
- fmax
- Element-wise maximum of two datasets, ignoring any NaNs. 
- fmin
- Element-wise minimum of two datasets, ignoring any NaNs. 
- argmax
- Return the indices or coordinates of the maximum values. 
- argmin
- Return the indices or coordinates of the minimum values. 
 - Notes - For dataset with complex or hypercomplex type type, the default is the value with the maximum real part. 
 - amin(dataset, dim=None, keepdims=False, **kwargs)[source]ο
- Return the maximum of the dataset or maxima along given dimensions. - Parameters:
- dataset (array_like) β Input array or object that can be converted to an array. 
- dim (None or int or dimension name or tuple of int or dimensions, optional) β Dimension or dimensions along which to operate. By default, flattened input is used. If this is a tuple, the minimum is selected over multiple dimensions, instead of a single dimension or all the dimensions as before. 
- keepdims (bool, optional) β If this is set to True, the dimensions which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. 
 
- Returns:
- amin β Minimum of the data. If - dimis None, the result is a scalar value. If- dimis given, the result is an array of dimension- ndim - 1.
 - See also - amax
- The maximum value of a dataset along a given dimension, propagating NaNs. 
- minimum
- Element-wise minimum of two datasets, propagating any NaNs. 
- maximum
- Element-wise maximum of two datasets, propagating any NaNs. 
- fmax
- Element-wise maximum of two datasets, ignoring any NaNs. 
- fmin
- Element-wise minimum of two datasets, ignoring any NaNs. 
- argmax
- Return the indices or coordinates of the maximum values. 
- argmin
- Return the indices or coordinates of the minimum values. 
 
 - arange(start=0, stop=None, step=None, dtype=None, **kwargs)[source]ο
- Return evenly spaced values within a given interval. - Values are generated within the half-open interval [start, stop). - Parameters:
- start (number, optional) β Start of interval. The interval includes this value. The default start value is 0. 
- stop (number) β End of interval. The interval does not include this value, except in some cases where step is not an integer and floating point round-off affects the length of out. It might be prefereble to use inspace in such case. 
- step (number, optional) β Spacing between values. For any output out, this is the distance between two adjacent values, out[i+1] - out[i]. The default step size is 1. If step is specified as a position argument, start must also be given. 
- dtype (dtype) β The type of the output array. If dtype is not given, infer the data type from the other input arguments. 
- **kwargs β Keywords argument used when creating the returned object, such as units, name, title, β¦ 
 
- Returns:
- arange β Array of evenly spaced values. 
 - See also - linspace
- Evenly spaced numbers with careful handling of endpoints. 
 - Examples - >>> scp.arange(1, 20.0001, 1, units='s', name='mycoord') NDDataset: [float64] s (size: 20) 
 - around(dataset, decimals=0)[source]ο
- Evenly round to the given number of decimals. - Parameters:
- dataset ( - NDDataset) β Input dataset.
- decimals (int, optional) β Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. 
 
- Returns:
- rounded_array β NDDataset containing the rounded values. The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float. If the dataset contains masked data, the mask remain unchanged. 
 - See also - numpy.round,- around,- spectrochempy.round,- spectrochempy.around,- methods.,- ceil,- fix,- floor,- rint,- trunc
 - astype(dtype=None, **kwargs)[source]ο
- Cast the data to a specified type. - Parameters:
- dtype (str or dtype) β Typecode or data-type to which the array is cast. 
 
 - copy(deep=True, keepname=False, **kwargs)[source]ο
- Make a disconnected copy of the current object. - Parameters:
- deep (bool, optional) β If True a deepcopy is performed which is the default behavior. 
- keepname (bool) β If True keep the same name for the copied object. 
 
- Returns:
- object β An exact copy of the current object. 
 - Examples - >>> nd1 = scp.NDArray([1. + 2.j, 2. + 3.j]) >>> nd1 NDArray: [complex128] unitless (size: 2) >>> nd2 = nd1 >>> nd2 is nd1 True >>> nd3 = nd1.copy() >>> nd3 is not nd1 True 
 - fromfunction(cls, function, shape=None, dtype=float, units=None, coordset=None, **kwargs)[source]ο
- Construct a nddataset by executing a function over each coordinate. - The resulting array therefore has a value - fn(x, y, z)at coordinate- (x, y, z).- Parameters:
- function (callable) β The function is called with N parameters, where N is the rank of - shapeor from the provided- CoordSet.
- shape ((N,) tuple of ints, optional) β Shape of the output array, which also determines the shape of the coordinate arrays passed to - function. It is optional only if- CoordSetis None.
- dtype (data-type, optional) β Data-type of the coordinate arrays passed to - function. By default,- dtypeis float.
- units (str, optional) β Dataset units. When None, units will be determined from the function results. 
- coordset ( - CoordSetinstance, optional) β If provided, this determine the shape and coordinates of each dimension of the returned- NDDataset. If shape is also passed it will be ignored.
- **kwargs β Other kwargs are passed to the final object constructor. 
 
- Returns:
- fromfunction β The result of the call to - functionis passed back directly. Therefore the shape of- fromfunctionis completely determined by- function.
 - See also - fromiter
- Make a dataset from an iterable. 
 - Examples - Create a 1D NDDataset from a function - >>> func1 = lambda t, v: v * t >>> time = scp.Coord.arange(0, 60, 10, units='min') >>> d = scp.fromfunction(func1, v=scp.Quantity(134, 'km/hour'), coordset=scp.CoordSet(t=time)) >>> d.dims ['t'] >>> d NDDataset: [float64] km (size: 6) 
 - fromiter(iterable, dtype=np.float64, count=-1, **kwargs)[source]ο
- Create a new 1-dimensional array from an iterable object. - Parameters:
- iterable (iterable object) β An iterable object providing data for the array. 
- dtype (data-type) β The data-type of the returned array. 
- count ( - int, optional) β The number of items to read from iterable. The default is -1, which means all data is read.
- **kwargs β Other kwargs are passed to the final object constructor. 
 
- Returns:
- fromiter β The output nddataset. 
 - See also - fromfunction
- Construct a nddataset by executing a function over each coordinate. 
 - Notes - Specify count to improve performance. It allows fromiter to pre-allocate the
- output array, instead of resizing it on demand. 
 - Examples - >>> iterable = (x * x for x in range(5)) >>> d = scp.fromiter(iterable, float, units='km') >>> d NDDataset: [float64] km (size: 5) >>> d.data array([ 0, 1, 4, 9, 16]) 
 - geomspace(start, stop, num=50, endpoint=True, dtype=None, **kwargs)[source]ο
- Return numbers spaced evenly on a log scale (a geometric progression). - This is similar to - logspace, but with endpoints specified directly. Each output sample is a constant multiple of the previous.- Parameters:
- start (number) β The starting value of the sequence. 
- stop (number) β The final value of the sequence, unless - endpointis False. In that case,- num + 1values are spaced over the interval in log-space, of which all but the last (a sequence of length- num) are returned.
- num (int, optional) β Number of samples to generate. Default is 50. 
- endpoint (bool, optional) β If true, - stopis the last sample. Otherwise, it is not included. Default is True.
- dtype (dtype) β The type of the output array. If - dtypeis not given, infer the data type from the other input arguments.
- **kwargs β Keywords argument used when creating the returned object, such as units, name, title, β¦ 
 
- Returns:
- geomspace β - numsamples, equally spaced on a log scale.
 
 - get_labels(level=0)[source]ο
- Get the labels at a given level. - Used to replace - datawhen only labels are provided, and/or for labeling axis in plots.- Parameters:
- level (int, optional, default:0) β Label level. 
- Returns:
- ndarrayβ The labels at the desired level or None.
 
 - is_units_compatible(other)[source]ο
- Check the compatibility of units with another object. - Parameters:
- other ( - ndarray) β The ndarray object for which we want to compare units compatibility.
- Returns:
- result β True if units are compatible. 
 - Examples - >>> nd1 = scp.NDDataset([1. + 2.j, 2. + 3.j], units='meters') >>> nd1 NDDataset: [complex128] m (size: 2) >>> nd2 = scp.NDDataset([1. + 2.j, 2. + 3.j], units='seconds') >>> nd1.is_units_compatible(nd2) False >>> nd1.ito('minutes', force=True) >>> nd1.is_units_compatible(nd2) True >>> nd2[0].values * 60. == nd1[0].values True 
 - ito(other, force=False)[source]ο
- Inplace scaling to different units. (same as - towith inplace= True).- Parameters:
 - See also - to
- Rescaling of the current object data to different units. 
- to_base_units
- Rescaling of the current object data to different units. 
- ito_base_units
- Inplace rescaling of the current object data to different units. 
- to_reduced_units
- Rescaling to reduced units. 
- ito_reduced_units
- Rescaling to reduced units. 
 
 - ito_base_units()[source]ο
- Inplace rescaling to base units. - See also - to
- Rescaling of the current object data to different units. 
- ito
- Inplace rescaling of the current object data to different units. 
- to_base_units
- Rescaling of the current object data to different units. 
- to_reduced_units
- Rescaling to redunced units. 
- ito_reduced_units
- Inplace rescaling to reduced units. 
 
 - ito_reduced_units()[source]ο
- Quantity scaled in place to reduced units, inplace. - Scaling to reduced units means one unit per dimension. This will not reduce compound units (e.g., βJ/kgβ will not be reduced to m**2/s**2). - See also - to
- Rescaling of the current object data to different units. 
- ito
- Inplace rescaling of the current object data to different units. 
- to_base_units
- Rescaling of the current object data to different units. 
- ito_base_units
- Inplace rescaling of the current object data to different units. 
- to_reduced_units
- Rescaling to reduced units. 
 
 - linearize(sigdigits=4)[source]ο
- Linearize the coordinateβs data. - Make coordinates with an equally distributed spacing, when possible, i.e., if the spacings are not too different when rounded to the number of significant digits passed in parameters. If the spacings are too different, the coordinates are not linearized. In this case, the - linearattribute is set to False.- Parameters:
- sigdigits (Int, optional, default=4) β The number of significant digit for coordinates values. 
 
 - linspace(cls, start, stop, num=50, endpoint=True, retstep=False, dtype=None, **kwargs)[source]ο
- Return evenly spaced numbers over a specified interval. - Returns num evenly spaced samples, calculated over the interval [start, stop]. The endpoint of the interval can optionally be excluded. - Parameters:
- start (array_like) β The starting value of the sequence. 
- stop (array_like) β The end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False. 
- num (int, optional) β Number of samples to generate. Default is 50. Must be non-negative. 
- endpoint (bool, optional) β If True, stop is the last sample. Otherwise, it is not included. Default is True. 
- retstep (bool, optional) β If True, return (samples, step), where step is the spacing between samples. 
- dtype (dtype, optional) β The type of the array. If dtype is not given, infer the data type from the other input arguments. 
- **kwargs β Keywords argument used when creating the returned object, such as units, - name, title, β¦ 
 
- Returns:
- linspace (ndarray) β There are num equally spaced samples in the closed interval [start, stop] or the half-open interval [start, stop) (depending on whether endpoint is True or False). 
- step (float, optional) β Only returned if retstep is True Size of spacing between samples. 
 
 
 - loc2index(loc, return_error=False)[source]ο
- Return the index corresponding to a given location. - Parameters:
- loc (float.) β Value corresponding to a given location on the coordinates axis. 
- Returns:
- index (int.) β The corresponding index. 
 - Examples - >>> dataset = scp.read("irdata/nh4y-activation.spg") >>> dataset.x.loc2index(1644.0) 4517 
 - logspace(cls, start, stop, num=50, endpoint=True, base=10.0, dtype=None, **kwargs)[source]ο
- Return numbers spaced evenly on a log scale. - In linear space, the sequence starts at - base ** start(- baseto the power of- start) and ends with- base ** stop(see- endpointbelow).- Parameters:
- start (array_like) β - base ** startis the starting value of the sequence.
- stop (array_like) β - base ** stopis the final value of the sequence, unless- endpointis False. In that case,- num + 1values are spaced over the interval in log-space, of which all but the last (a sequence of length- num) are returned.
- num (int, optional) β Number of samples to generate. Default is 50. 
- endpoint (bool, optional) β If true, - stopis the last sample. Otherwise, it is not included. Default is True.
- base (float, optional) β The base of the log space. The step size between the elements in - ln(samples) / ln(base)(or- log_base(samples)) is uniform. Default is 10.0.
- dtype (dtype) β The type of the output array. If - dtypeis not given, infer the data type from the other input arguments.
- **kwargs β Keywords argument used when creating the returned object, such as units, name, title, β¦ 
 
- Returns:
- logspace β - numsamples, equally spaced on a log scale.
 - See also - arange
- Similar to linspace, with the step size specified instead of the number of samples. Note that, when used with a float endpoint, the endpoint may or may not be included. 
- linspace
- Similar to logspace, but with the samples uniformly distributed in linear space, instead of log space. 
- geomspace
- Similar to logspace, but with endpoints specified directly. 
 
 - max(dataset, dim=None, keepdims=False, **kwargs)[source]ο
- Return the maximum of the dataset or maxima along given dimensions. - Parameters:
- dataset (array_like) β Input array or object that can be converted to an array. 
- dim (None or int or dimension name or tuple of int or dimensions, optional) β Dimension or dimensions along which to operate. By default, flattened input is used. If this is a tuple, the maximum is selected over multiple dimensions, instead of a single dimension or all the dimensions as before. 
- keepdims (bool, optional) β If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. 
 
- Returns:
- amax β Maximum of the data. If - dimis None, the result is a scalar value. If- dimis given, the result is an array of dimension- ndim - 1.
 - See also - amin
- The minimum value of a dataset along a given dimension, propagating NaNs. 
- minimum
- Element-wise minimum of two datasets, propagating any NaNs. 
- maximum
- Element-wise maximum of two datasets, propagating any NaNs. 
- fmax
- Element-wise maximum of two datasets, ignoring any NaNs. 
- fmin
- Element-wise minimum of two datasets, ignoring any NaNs. 
- argmax
- Return the indices or coordinates of the maximum values. 
- argmin
- Return the indices or coordinates of the minimum values. 
 - Notes - For dataset with complex or hypercomplex type type, the default is the value with the maximum real part. 
 - min(dataset, dim=None, keepdims=False, **kwargs)[source]ο
- Return the maximum of the dataset or maxima along given dimensions. - Parameters:
- dataset (array_like) β Input array or object that can be converted to an array. 
- dim (None or int or dimension name or tuple of int or dimensions, optional) β Dimension or dimensions along which to operate. By default, flattened input is used. If this is a tuple, the minimum is selected over multiple dimensions, instead of a single dimension or all the dimensions as before. 
- keepdims (bool, optional) β If this is set to True, the dimensions which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array. 
 
- Returns:
- amin β Minimum of the data. If - dimis None, the result is a scalar value. If- dimis given, the result is an array of dimension- ndim - 1.
 - See also - amax
- The maximum value of a dataset along a given dimension, propagating NaNs. 
- minimum
- Element-wise minimum of two datasets, propagating any NaNs. 
- maximum
- Element-wise maximum of two datasets, propagating any NaNs. 
- fmax
- Element-wise maximum of two datasets, ignoring any NaNs. 
- fmin
- Element-wise minimum of two datasets, ignoring any NaNs. 
- argmax
- Return the indices or coordinates of the maximum values. 
- argmin
- Return the indices or coordinates of the minimum values. 
 
 - ptp(dataset, dim=None, keepdims=False)[source]ο
- Range of values (maximum - minimum) along a dimension. - The name of the function comes from the acronym for βpeak to peakβ . - Parameters:
- dim (None or int or dimension name, optional) β Dimension along which to find the peaks. If None, the operation is made on the first dimension. 
- keepdims (bool, optional) β If this is set to True, the dimensions which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input dataset. 
 
- Returns:
- ptp β A new dataset holding the result. 
 
 - round(dataset, decimals=0)[source]ο
- Evenly round to the given number of decimals. - Parameters:
- dataset ( - NDDataset) β Input dataset.
- decimals (int, optional) β Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. 
 
- Returns:
- rounded_array β NDDataset containing the rounded values. The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float. If the dataset contains masked data, the mask remain unchanged. 
 - See also - numpy.round,- around,- spectrochempy.round,- spectrochempy.around,- methods.,- ceil,- fix,- floor,- rint,- trunc
 - round_(dataset, decimals=0)[source]ο
- Evenly round to the given number of decimals. - Parameters:
- dataset ( - NDDataset) β Input dataset.
- decimals (int, optional) β Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. 
 
- Returns:
- rounded_array β NDDataset containing the rounded values. The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float. If the dataset contains masked data, the mask remain unchanged. 
 - See also - numpy.round,- around,- spectrochempy.round,- spectrochempy.around,- methods.,- ceil,- fix,- floor,- rint,- trunc
 - set_laser_frequency(frequency=None)[source]ο
- Set the laser frequency. - This method is used to set the laser frequency of the dataset. The laser frequency is used to convert the x-axis from optical path difference to time. The laser frequency is also used to calculate the wavenumber axis. 
 - to(other, inplace=False, force=False)[source]ο
- Return the object with data rescaled to different units. - Parameters:
- other ( - Quantityor str) β Destination units.
- inplace (bool, optional, default=`False`) β Flag to say that the method return a new object (default) or not (inplace=True). 
- force (bool, optional, default=False) β If True the change of units is forced, even for incompatible units. 
 
- Returns:
- rescaled 
 - See also - ito
- Inplace rescaling of the current object data to different units. 
- to_base_units
- Rescaling of the current object data to different units. 
- ito_base_units
- Inplace rescaling of the current object data to different units. 
- to_reduced_units
- Rescaling to reduced_units. 
- ito_reduced_units
- Inplace rescaling to reduced units. 
 - Examples - >>> np.random.seed(12345) >>> ndd = scp.NDArray(data=np.random.random((3, 3)), ... mask=[[True, False, False], ... [False, True, False], ... [False, False, True]], ... units='meters') >>> print(ndd) NDArray: [float64] m (shape: (y:3, x:3)) - We want to change the units to seconds for instance but there is no relation with meters, so an error is generated during the change - >>> ndd.to('second') Traceback (most recent call last): ... pint.errors.DimensionalityError: Cannot convert from 'meter' ([length]) to 'second' ([time]) - However, we can force the change - >>> ndd.to('second', force=True) NDArray: [float64] s (shape: (y:3, x:3)) - By default the conversion is not done inplace, so the original is not modified : - >>> print(ndd) NDArray: [float64] m (shape: (y:3, x:3)) - . 
 - to_base_units(inplace=False)[source]ο
- Return an array rescaled to base units. - Parameters:
- inplace (bool) β If True the rescaling is done in place. 
- Returns:
- rescaled β A rescaled array. 
 
 - to_reduced_units(inplace=False)[source]ο
- Return an array scaled in place to reduced units. - Reduced units means one unit per dimension. This will not reduce compound units (e.g., βJ/kgβ will not be reduced to m**2/s**2). - Parameters:
- inplace (bool) β If True the rescaling is done in place. 
- Returns:
- rescaled β A rescaled array. 
 
 
Examples using spectrochempy.Coord
 
 
 
 
 
 
 
 
 
 
