Package: lifespec-fl
Lifespec FLParse.FLfiles from a Lifespec TRPL machine.Install withpython -m pip install lifespec-flParserThelifespec_fl.parse(<file>)method is used to parse a .FL file.
This is the main function of this package.File format descriptionParsing the .FL binary file uses theparse_binary_filepackage. This package uses configuration files to describe the structure of a binary file format for parsing.You can find this configuration file atlifespec_fl/data/fl_descriptor.yaml.CLIInstalls a command line interface (CLI) namedlifespec_flthat can be used to
convert .FL files to .csv.ExampleLibraryimportpandasaspdimportlifespec_flasfl# parse the 'my_trpl.FL' file(counts,data)=fl.parse('my_trpl.FL')# place counts into a pandas Seriesdf=pd.Series(counts[:,1],index=counts[:,0])CLIConvert all .FL files in the current directory to .csv.lifespec_flConvert all .FL files ending intrplin the current directly into a single .csv.lifespec_fl--join*trpl.FLFile Format Notes3 lines separated by\r\n(0d0a)Little Endianlatin-1encodedHeads of lines 1 and 2 follow similar patternLine 0 (0x00 - 0x14, 0x15 bytes)EAI Multiple Scansnull terminated (0x00) string followed by\r\nLine 1 (0x15 - 0x60, 0x4d bytes)head (0x34 bytes)bytes 0x00 - 0x01 (0x02 bytes):dc05bytes 0x02 - 0x05 (0x04 bytes):0000 0033bytes 0x06 - 0x09 (0x04 bytes):0000 0096bytes 0x0a - 0x10 (0x07 bytes): nullbytes 0x11 - 0x14 (0x04 bytes): Stop time as a floatbytes 0x15 - 0x19 (0x05 bytes): X axis label (e.g.'Time') as a null terminated stringbytes 0x1a - 0x1c (0x03 bytes): Time scale (e.g.'ns','us') as a null terminated stringbytes 0x1d - 0x20 (0x04 bytes): nullbytes 0x21 - 0x24 (0x04 bytes): ?, possibly no. of counts in 1000 as floatbytes 0x25 - 0x2b (0x07 bytes): Y axis label (e.g.'Counts') as a null terminated stringbytes 0x2c - 0x33 (0x08 bytes):'1.4.5.0'null terminated string, version?bodybytes 0x36 - 0x3d (0x08 bytes): Seems to always be6400 0000 0100 0000bytes 0x3e - 0x4c (0x0d bytes): Scan type as null terminated stringbytes 0x4d - 0x4e (0x02 bytes):\r\nto end lineLine 2 (0x61 - end)head (0x34 bytes)bytes 0x00 - 0x01 (0x02 bytes):8813bytes 0x02 - 0x06 (0x04 bytes): ?, floatbytes 0x07 - 0x09 (0x04 bytes):0100 0096, control sequence?bytes 0x0a - 0x10 (0x07 bytes): nullbytes 0x11 - 0x14 (0x04 bytes): Stop time as a floatbytes 0x15 - 0x19 (0x05 bytes): X axis label (e.g.'Time') as a null terminated stringbytes 0x1a - 0x1c (0x03 bytes): Time scale (e.g.'ns','us') as a null terminated stringbytes 0x1d - 0x24 (0x08 bytes): nullbytes 0x25 - 0x2b (0x07 bytes): Y axis label (e.g.'Counts') null terminated stringbytes 0x2c - 0x33 (0x08 bytes):'1.4.5.0'null terminated string, version?bodyOriginal file name, null terminated(0x01 bytes)2c(0x04 bytes)0100 0000, control secquence?(0x02 bytes)0400(0x02 bytes) null(0x0f bytes) ?(0x02 bytes)4090, control sequence?(0x04 bytes)0100 0000, control sequence?(0x04 bytes) ?, null terminated(0x07 bytes) null(0x04 bytes)f401 0000, control sequence?(0x0c bytes)'TCSPC Diode'string, null terminated(0x0a bytes) null(0x0a bytes)'Reference'string, null terminated(0x02 bytes) null(0x03 bytes)'HC'string, null terminated(0x04 bytes)f6ff ffff, control sequence?(0x02 bytes)1000(0x03 bytes) null(0x02 bytes)000c(0x0c bytes)'TCSPC Diode'sting, null t2rminated(0x06 bytes) null(0x01 bytes)fe, control sequence?(0x04 bytes)'K B'string, null terminated(0x01 bytes) null(0x0a bytes)'HS PMT920'string, null terminated(0x05 bytes) ?, float(0x06 bytes)00f6 ffff ff0d 00control sequence?(0x03 bytes) null(0x0d bytes)'200nm-1000nm'string, null terminated(0x01 bytes)05, control sequence?(0x12 bytes)'High Speed PMT920'string, null terminated(0x02 bytes)0001(0x16 bytes) null002c 0100 0001 0000 00control sequence?(0x04 bytes) ?, float?(0x04 bytes) ?, float?(0x0d bytes)c220 b043 2000 0000Time scale string (e.g.'50ns','100ns'), null terminated(0x01 bytes) Data paddingIf30, skip next byteIf31If2e39, skip next byteif392e, skip next 2 bytesdataEach 4 bytes should be interpreted as a float