Notebook .. _data-format:
The data are treated using two classes from the module :mod:`.data_loader` - :class:`jetset.data_loader.Data` class - :class:`jetset.data_loader.ObsData` class The class :class:`jetset.data_loader.Data` is in charge of storing the data, giving access to the I/O functionalities, and provides an interface to the astropy Table class (see the `astropy table <https://docs.astropy.org/en/stable/table/>`_. documentation, for further information) The class :class:`jetset.data_loader.ObsData` uses the information stored in :class:`jetset.data_loader.Data`, and can perform several operations This is the class to use for model fitting and in general in Jetset - rebinning (grouping) of the data - selection of time ranges - selection of datasets - transformation from linear to logarithmic representation - handling of errors and systematics .. note:: old version of data file in non `ecsv` astropy table format, can be easily converted by importing them using the method described in :ref:`import` and saving them
.. note:: starting from version 1.1.0 ``src`` to ``obs`` transformation is available
As you can see there are three 3 files. We use in this example the file for Mrk 421, and we use class:`jetset.data_loader.Data` class
this is an extract of the astropy table saved in the format ``ascii.ecsv``
.. _import:
we can use the importing tool in the :class:`jetset.data_loader.Data`. We just need to have the file downloaded from the asi ssdc sedtool, and to know the redshift of the object, the scale we selected (lin-lin, or log-log). Assume that we downloaded the data for Mrk421, in observed fluxes and linear scale, and the data are saved in the file 'MRK421_asdc.txt', we only have to do:
.. note:: starting from version 1.1.0 ``src`` to ``obs`` transformation is available
.. note:: When importing data from the ``src`` frame, the Data constructor will not convert units, but will assume that input units are erg/s. If this is not the case an error message will be displayed
Once we have a data table built with the class:`jetset.data_loader.Data`, following one of the method described above, you can create SED data using the :class:`jetset.data_loader.ObsData` class. In the example we use one of the test SEDs provided by the package:We start to loading the SED of Mrk 421, and we pass to ``ObsData`` directly the path to the file, because this is already in the format that we need and that we have discussed above.
if you want to use a cosmology model different from the default one please read the :ref:`cosmology` section
We can now plot our SED using the :class:`BlazarSEDFit.plot_sedfit.Plot` class
with this command we add 20% systematics for data between :math:`10^{6}<\nu<10^{29}` Hz