Read spectra
The examples below show how to read out different types of spectra from the Monipa 1 and give more information on how they are acquired. We recommend using the regions from 900 cm⁻¹ to 2000 cm⁻¹ for most applications. Outside of this range, the signal-to-noise ratio can be too low for reliable analysis.
import requests
mode = "standard_v2" # processing mode
response = requests.get(
f"http://10.0.0.2:5555/api/spectrometer/spectra/processed/{mode}",
params={
"n_scans": 5,
},
).json()
print(f"Absorbance: {response}")
When requesting an absorbance spectrum, you can change number of scans to average via the parameter n_scans. You can also request different processing modes.
standard_v2: Processing with drift stabilization.evaluation: Fast processing.
In the next section, we will use the spectra read endpoints for an interactive plot.
import requests
response = requests.get(
"http://10.0.0.2:5555/api/spectrometer/spectra/averaged/standard_v2",
params={
"n_scans": 5,
},
).json()
p, s = response
print("Polarization spectra:")
print(f"P energies: {p}")
print(f"S energies: {s}")
Note
You can also request the raw energy spectrum via the endpoint /api/spectrometer/spectra/averaged. This returns the energies without any optical calibration at a specific polarization angle. These can be set using the endpoint /api/microcontroller/polarizer/steps.
import requests
response = requests.get(
"http://10.0.0.2:5555/api/spectrometer/wavenumbers",
).json()
print(f"Wavenumbers: {response}")
The wavenumbers depend on the spectrometer resolution setting. You can change the resolution via the endpoint PUT /api/spectrometer/resolution.
For the default resolution of 3.5 cm⁻¹, the wavenumbers range from approximately 834 cm⁻¹ to 5000 cm⁻¹, with a step size of 1.75 cm⁻¹.
import requests
response = requests.get(
"http://10.0.0.2:5555/api/spectrometer/interferogram",
).json()
print(f"Interferogram size: {len(response)}")
print(f"Interferogram: {response}")
You can also request the displacements via the endpoint /api/spectrometer/interferogram/displacements.