Some time ago I presented a python script for the analysis of meteor spectra. It worked as a pipeline, accepting input in a line by line form for the various parameters. It was described here (https://meteorspectroscopy.org/2018/11/18/meteor-spectraanalysed-with-python/ , referenced as m_pipe62). In the meantime it has been improved with a windows graphical user interface (GUI), which should appeal more to a user not used to the somewhat old fashioned line by line input. Another advantage of the GUI is, that the analysis can be done partially, without having to redo the complete pipeline, and is therefore more flexible (e.g. applying distortion to single images, calibrating spectra of different origin, plotting spectra). The look and use is more similar to other spectroscopic software (ISIS, RSpec, VSpec). The range of processing steps is about the same as in the previous version, but it should be easier to implement additional features. The main steps in the analysis of meteor spectra (usually obtain as a sequence of video images) are:
- Extraction of images from video sequence
- Subtraction of dark or background image
- Linearization of spectra by image transformation
- Registration of spectra of the moving meteor and summing rows to produce a 1-dimensional raw spectrum
- Wavelength calibration and plotting
Planned are the correction of spectra with instrument response or additional data analysis.
At the time of that publication, the present script for the analysis was not available, many things described there have been simplified considerably. One point should be emphasized here: The calibration of the camera – lens – grating combination is done with a separate python script which will be presented later, but the currently available script s_calib.py is compatible with the spectrum analysis script m_spec.py.
The details of the method, in particular the transformation of nonlinear spectra to linear spectra with a transformation of the images to an orthographic projection are described here:
Unfortunately I have not succeded yet to convert the script into a stand-alone executable program. It requires the installation of a Python environment and some additional software (ffmpeg for the video conversion and some python libraries). The installation is similar to the previous version and will be described in detail in the manual. As before, Pyzo is used for editing the script and running it but not needed for running the script only. Some familiarity with Python is not required but highly recommended.
Running the script
When you start the program, a window with several tabs appear, the tab Setup is shown first. It is assumed that you have done a calibration of the optics with a laser or a spectral lamp first, then the values of this calibration are shown here. You may fill out some additional info here which will be explained later. The information is stored in a configuration file, also used by the calibration program, by default m-set.ini is loaded at the start and saved when you leave the program.
In the next tab you can load a video file and extract the images to a temporary folder for later processing. You may also look at the images in order to see how many images you want to process and use for the background image. The images are stored as m_*.png, different from the earlier version of this program, which used a *.bmp format. The reason is mainly that the package used for the GUI (PySimpleGUI) accepts the png format, in addition it is stored more efficiently.
The spectra of meteors recorded with a grating in front of the camera are curved and show nonlinear dispersion. This is corrected here with a transformation of the images to a orthographic projection, as described in the reference above. In addition, the background of the images (illuminated night sky, moon light etc.) is reduced by subtracting a background image produced by averaging images before the appearance of the meteor. The resulting images show linear spectra with constant dispersion, independent of the position of the meteor in the field of view.
Once linearized, the spectra are ready for registration. This means they are stacked with the zero order in the same position in the image. For this, in each image the position (x,y) of the zero order is measured and the images shifted accordingly, so they match the first image. Instead of the zero order, another prominent and isolated spectral line can be used for registration, on case the zero order is not within the image area. Then the spectra can be added, improving the signal to noise ratio.
If the spectrum is not aligned parallel to the x-axis, the tilt can be corrected here. If the meteor moves diagonally across the image, the corresponding slant can be corrected as well. Once aligned, the rows containing the spectrum can be added column by column, producing a 1-dimensional raw spectrum.
Wavelength calibration and plotting
Knowing the position of the zero order and the dispersion in nm/pixel, the calibration is straightforward. In practice one measures several lines and fits a polynomial (first or second order) through the measured line positions and corresponding wavelengths. This corrects also for errors in the previous laser calibration or changes in the grating orientation or shift of focal length in the case of a zoom lens.
The calibrated spectrum can now be plotted.
2 thoughts on “Meteor spectra analysis, new version”