Metadata-Version: 2.1
Name: fitlistreader
Version: 0.1.0
Summary: A package for reading and evaluating fitlist.xml files as generated by hdtv.
License: GNU General Public License v3.0
Author: Markus Muellenmeister
Requires-Python: >=3.8.14,<4.0.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: numpy (>=1.19.4,<2.0.0)
Requires-Dist: scipy (>=1.5.4,<2.0.0)
Description-Content-Type: text/markdown

# fitlistreader

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

## Installation

```bash
$ 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  
```bash 
$ 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` <br> `--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` <br> `--Calibrations ` |   Switches to read out the calibrations of respective spectra contained in the fitlist  |
|`-h` <br> `--help         ` |   Displays this help text and exits.   |
|`   --noheader     ` |   Ommit printing the header line  |
|`-l [args]`<br>` --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`. 
```python
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](docs). 

## 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`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).

