Skip to content

Commit

Permalink
Added more details on Python trgtools module.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeoranday committed Feb 27, 2024
1 parent de7a70e commit d10cf85
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/py-trgtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ tc_data.ta_data
ta0_contents = ta_data.tp_data[0]
tc0_contents = tc_data.ta_data[0]
```
Data accessing follows a very similar procedure between the different readers. The TAReader and TCReader also contain the secondary information about the TPs and TAs that formed the TAs and TCs, respectively. For the `np.ndarray` objects, one can also specify the member data they want to access. For example
Data accessing follows a very similar procedure between the different readers. The TAReader and TCReader also contain the secondary information about the TPs and TAs that formed the TAs and TCs, respectively. For the `np.ndarray` objects, one can also specify the member data they want to access. For example,
```python
ta_data.ta_data['time_start'] # Returns a np.ndarray of the time_starts for all read TAs
```
The available data members for each reader can be used (and shown) with `tp_data.tp_dt`, `ta_data.ta_dt` and `ta_data.tp_dt`, and `tc_data.tc_dt` and `tc_data.ta_dt`.

Look at the contents of `*_dump.py` for more detailed examples of their usage
Look at the contents of `*_dump.py` for more detailed examples of data member usage.

While using interactive Python, one can do `help(tp_data)` and `help(tp_data.read_fragment)` for documentation on their usage (and similarly for the other readers and plotters).

# Plotting
There is also a submodule `trgtools.plot` that features a class `PDFPlotter`. This class contains common plotting that was repeated between the `*_dump.py`. Loading this class requires `matplotlib` to be installed, but simply doing `import trgtools` does not have this requirement.
Expand All @@ -75,3 +78,6 @@ pdf_plotter.plot_histogram(tp_data['adc_peak'], plot_style_dict)
```

By design, the `plot_style_dict` requires the keys `title`, `xlabel`, and `ylabel` at a minimum. More options are available to further change the style of the plot, and examples of this are available in the `*_dump.py`.

### Development
The common plots available in `PDFPlotter` is rather limited right now. At this moment, these plots are sufficient, but more common plotting functions can be added.

0 comments on commit d10cf85

Please sign in to comment.