fitlistreader

A package for reading and evaluating fitlist.xml files as generated by hdtv.

Installation

$ pip install fitlistreader

Requirements

  • python 3.8.14 or newer

  • numpy 1.19.4 or newer

  • scipy 1.5.4 or newer (for interpolation background models)

All requirements will automatically install with the pip command above, given you have a supported python version.

Usage

For basic usage in a terminal, CLI integration is available with the command

$ fitlistreader [-h] [-I] [-C] [--noheader] [-l args] path/to/fitlist.xml

The output is of a form that can be used directly or imported into excel or similar.

Options

Flag

Description

-I
--Integrals   

Switches to integral mode. Only the recorded integrals are listed. This is different from the int_* options for -l, as all integrals are listed and not only the ones belonging to peaks.

-C
--Calibrations

Switches to read out the calibrations of respective spectra contained in the fitlist

-h
--help        

Displays this help text and exits.

  --noheader   

Ommit printing the header line

-l [args]
--labels

Change printed values to those specified in labels arg (see below). By default, pos, dpos, vol, dvol, width, dwidth, bg, dbg and bg_model are used.

Labels:

With the -l/–labels option, the values which are extracted from the fitlist.xml file can be changed. The values will be printed in order of specification. Available labels are:

Label

Description

pos

Peak position

dpos

Uncertainty in peak position

vol

Peak volume

dvol

Uncertainty in peak volume

width

Peak width

dwidth

Uncertainty in peak width

bg

Background volume under the peak

dbg

Uncertainty in background volume under peak

bg_model

Background model used in fitting

spc

Spectrum name from which the peaks were fitted

cal

Calibration coefficients (polynomial, 0 order first) of the spectrum

int_id

ID of corresponding Integral

int_pos

Position of corresponding Integral

int_dpos

Uncertainty in position of corresponding Integral

int_vol

Volume of corresponding Integral

int_dvol

Uncertainty in volume of corresponding Integral

int_width

Width of corresponding Integral

int_dwidth

Uncertainty in width of corresponding Integral

int_skew

Skew of corresponding Integral

int_dskew

Uncertainty in skew of corresponding Integral

Usage as a package

If you want to programatically interact with the data stored in a fitlist.xml file without parsing the datastructure yourself, filistreader offers full access to all stored data with a quick, iterable and freely addressable datastructure called a fitlist.

from fitlistreader.fitlist import fitlist

fl = fitlist('path/to/fitlist.xml')
for peak in fl:
    print(peak.pos)

The fitlist object parses the supplied xml file and determines the basic structure of the fitlist like its length. The actual data, however, is only read on demand and then cached, improving reading times. For further details on the included objects, consult the documentation.

License

fitlistreader was created by Markus Muellenmeister. It is licensed under the terms of the GNU General Public License v3.0 license.

Credits

fitlistreader was created with cookiecutter and the py-pkgs-cookiecutter template.