Python script to extract data from ORTEC MAESTRO List Mode files (.Lis). Specifically tailored to operation of the ORTEC IDM-200-V, which shares file formats with ORTEC DSpec Pro and DSpec 50/502 instruments.
python process_listmode.py inputFile.Lis outFileName.csv
process_listmode.py
: Python script to be run on the list mode (binary) file.sample_data/
: folder with sample input list mode file and corresponding output .csv file.
The .Lis file encoding provided by MAESTRO is outlined in the hardware manual that accompanies each device, as well as here: https://www.ortec-online.com/-/media/ametekortec/manuals/l/list-mode-file-formats.pdf?la=en&revision=0b78b32a-9ee7-4243-b4ac-a8adb886381d
The file is a byte-stream of data that is parsed into a 256-byte header and subsequent data. This script is written for the ORTEC IDM-200-V (and other PRO List formats), which has data consisting of a string of 32-bit words. Words are encoded by type. The currently supported data that are parsed to the output .csv file are
- ADC value
- Time stamp (combining the coarse and fine time stamps provided by the device)
(Added 05/08/2024) Now additionally parses, but does not save to the .csv:
- each Windows time stamp, generated by the computer upon data request from the computer to the spectrometer
- each Hardware time stamp, generated by the spectrometer upon data request delivery
The additional file outFileName_metadata.txt
provides:
- the first Windows time stamp of data request
- mean, standard deviation, and spread (min and max value) of these delays (Hardware-Windows), which can be used to characterize the response time of the spectrometer.
(Added 02/24/2025) Added modified script version, process_listmode_chunks.py
, to be used for large input files. Script runs by loading the .Lis file in chunks of N MB, where N is a user-defined variable specified with -chunk-size
or -c
. For example, to use 1-MB chunks:
python process_listmode_chunks.py inputFile.Lis outFileName.csv -c 1
- The default chunk size is 2 MB.
- An input file may be large if
$8\times$ (displayed .Lis file size) exceeds or is on the order of your computer's available RAM, or if the non-chunk script otherwise fails. - Anecdotal benchmark: a 2 GB file was processed in ~40 min, using a computer with 16 GB RAM and AMD Ryzen 7 3800X 8-Core Processor (3.90 GHz).
- ADC values are cast to Int16 to reduce the file size of the output .csv. Please take note if ADC values are expected to exceed 215.
- The previous
process_listmode.py
script remains available for more verbose progress bars and debugging.