This section summarizes various useful functions implemented in LumiSpy.
In case several spectra (or spectral images) where subsequently recorded for
different, but overlapping spectral windows, LumiSpy provides a utility
join_spectra() to merge these into a single spectrum. The
main argument is a list of two or more spectral objects. Spectra are joined at
the centre of the overlapping range along the signal axis. To avoid steps in the
intensity, several parameters (see docstring:
allow to tune the scaling of the later signals with respect to the previous ones.
By default, the scaling parameter is determined as average ratio between the two
signals in the range of +/- 50 pixels around the centre of the overlapping region.
>>> import lumispy as lum >>> s = lum.join_spectra((s1,s2))
Scaling and normalizing signal data
For comparative plotting or a detailed analysis, the intensity of spectra may
need to be either scaled by the respective integration times or
normalized. The luminescence signal classes provide these functionalities in the
Both functions can operate directly on the signal (
inplace=True), but as default
a new signal is returned.
The scaling function can use the
integration_time (unit: seconds) provided in the
LumiSpy metadata structure (
Otherwise, the appropriate parameter has to be passed to the function.
>>> scaled = s.scale_by_exposure(integration_time=0.5, inplace=True)
Normalization is performed for the pixel with maximum intensity, Alternatively,
pos in calibrated units of the signal axis can be given to
normalize the intensity at this position. Normalization may be convenient for
plotting, but should usually not be performed on signals used as input for further
analysis (therefore the default is
Replacing negative data values
Log-scale plotting fails in the presence of negative values in the dataset
(e.g. introduced after background removal). In this case, the utility function
all negative values in the data array by a
The default operational mode is
inplace=False (a new signal object is returned).
Utilities for spectral maps
removes the specified number of pixels from all four edges of a spectral map.
It is a convenience wrapper for
[TODO: add possibility to crop different amounts of pixels on different sides]
For convenience, LumiSpy provides functions that convert between different units commonly used for the signal axis. Namely,
For the energy axis, the conversion uses the correct permittivity of air.