In [1]:
import specdal
from matplotlib import pyplot as plt
In [2]:
s = specdal.Spectrum(filepath="/home/young/data/specdal/aidan_data/SVC/ACPA_F_B_SU_20160617_003.sig")
print(s)
The print output shows the four components of the Spectrum object. For example, we can access the measurements as follows.
In [3]:
print(type(s.measurement))
print(s.measurement.head())
Spectrum object provides several methods for processing the measurements. Let's start by linearly resampling to the nearest integer (nm) wavelengths.
In [4]:
s.interpolate(method='linear')
print(s.measurement.head())
We can visualize the spectrum using pyplot. spectrum.plot is just a wrapper around spectrum.measurements.plot, so you can pass any arguments for plotting pandas.Series objects.
In [5]:
s.plot()
plt.show()
There are folds in the spectrum near 1000 and 1900 wavelengths. This happens because the three bands in the spectrometer has overlapping wavelengths. We can fix this using the stitch method of the Spectrum class.
In [6]:
s.stitch(method='mean')
s.plot()
plt.show()