This is development documentation. Some features are not available in the stable release. View stable documentation.

spectrochempy.align

align(dataset, *others, **kwargs)[source]

Align individual NDDataset along given dimensions using various methods.

Parameters:
  • dataset (NDDataset) – Dataset on which we want to align other objects.

  • *others (NDDataset) – Objects to align.

  • dim (str. Optional, default=’x’) – Along which axis to perform the alignment.

  • dims (list of str, optional, default=None) – Align along all dims defined in dims (if dim is also defined, then dims have higher priority).

  • method (enum [‘outer’, ‘inner’, ‘first’, ‘last’, ‘interpolate’], optional, default=’outer’) – Which method to use for the alignment.

    If align is defined :

    • ‘outer’ means that a union of the different coordinates is achieved (missing values are masked).

    • ‘inner’ means that the intersection of the coordinates is used.

    • ‘first’ means that the first dataset is used as reference.

    • ‘last’ means that the last dataset is used as reference.

    • ‘interpolate’ means that interpolation is performed relative to the first dataset.

  • interpolate_method (enum [‘linear’,’pchip’]. Optional, default=’linear’) – Method of interpolation to performs for the alignment.

  • interpolate_sampling ({‘auto’}, optional, default=’auto’) – Sampling of the target coordinate when method='interpolate'. 'auto' uses the first dataset coordinate unchanged. Numeric target sampling is not implemented and is explicitly refused; use NDDataset.interpolate with an explicit target coordinate instead.

  • coord (Coord , optional, default=None) – Coordinates to use for alignment. Ignore those corresponding to the dimensions to align.

  • copy (bool, optional, default=True) – If False then the returned objects will share memory with the original objects, whenever it is possible : in principle only if reindexing is not necessary.

Returns:

tuple of NDDataset – Same objects as datasets with dimensions aligned.

Raises:
  • ValueError – Issued when the dimensions given in dim or dims argument are not compatibles (units, titles, etc.).

  • NotImplementedError – Issued when interpolate_sampling is not 'auto'.