Load a fiting file

This script demonstrates how to use functionalities from the PyThea library to work with fitting data stored in JSON format.

Import Required Modules

from IPython.display import display

from PyThea.data.sample_data import json_fitting_file_sample_data
from PyThea.utils import model_fittings
/home/docs/checkouts/readthedocs.org/user_builds/pythea/checkouts/docs/PyThea/version.py:12: UserWarning: could not determine PyThea package version; this indicates a broken installation
  warnings.warn(

The script imports a sample JSON fitting file using json_fitting_file_sample_data.fetch() method. This sample data contains a series of fitted ellipsoids for a selected event.

json_fitting_file = json_fitting_file_sample_data.fetch('FLX1p0D20211028T153500MEllipsoid.json')
Downloading file 'FLX1p0D20211028T153500MEllipsoid.json' from 'https://github.com/AthKouloumvakos/PyThea-sample-data/raw/main/data/FLX1p0D20211028T153500MEllipsoid.json' to '/home/docs/PyThea/sample_data'.

The model_fittings.load_from_json(json_fitting_file) loads the model fittings from the JSON file. The result is stored in the variable model_fittings_class.

model_fittings_class = model_fittings.load_from_json(json_fitting_file)

Print the information about the selected event and geometrical model using print() statements and the parameters of the model fittings using display(model_fittings_class.parameters)

print(f'Selected Event: {model_fittings_class.event_selected}')
print(f'Geometrical Model: {model_fittings_class.geometrical_model}')
display(model_fittings_class.parameters)
Selected Event: FLX1.0|2021-10-28T15:35:00
Geometrical Model: Ellipsoid
                         hgln   hglt        crln  ...  alpha  imager  fits_file
2021-10-28 15:48:18.842  3.62 -25.07  274.118677  ...   0.86     LC2
2021-10-28 16:00:17.986  3.62 -23.56  274.008914  ...   0.78     LC2
2021-10-28 16:06:14.730  3.62 -22.35  273.954464  ...   0.78     LC3
2021-10-28 16:12:18.325  3.62 -21.25  273.898969  ...   0.77     LC2
2021-10-28 16:18:14.323  3.62 -21.00  273.844633  ...   0.77     LC3
2021-10-28 16:30:14.364  3.62 -20.34  273.734733  ...   0.77     LC3

[6 rows x 15 columns]

Total running time of the script: (0 minutes 2.618 seconds)

Gallery generated by Sphinx-Gallery