Base file loader

class rapoc.loaders.DictLoader(input_data)[source]

Dict loader class. The dictionary should contain the following information under certain keys:


default units

supported keys

molecular name


pressure grid


p, P, pressure, pressure_grid

temperature grid


t, T, temperature, temperature_grid

wavenumber grid


wn, wavenumber, wavenumbers, wavenumbers_grid, wavenumber_grid




If the input data has no units attached, the defaults units are assume. If they have units, a simple conversion is performed by the code to match the default values.


This class is implicitly called by the model when initialised if the matched input is used.


First we prepare a data dictionary. Please be aware that this are not representative of any molecule.

>>> import numpy as np
>>> data_dict = {'mol': 'None',
>>>              'mol_mass':42,
>>>              'pressure': np.array([1.00000000e+00, 1.00000000e+01, 1.00000000e+02, 1.00000000e+03,
>>>                                   1.00000000e+04, 1.00000000e+05, 1.00000000e+06, 1.00000000e+07]),
>>>              'temperature': np.array([500, 1000, 1500, 2000, 3000]),
>>>              'wavenumber': np.array([100000, 1000])}
>>> opac = np.ones((data_dict['pressure'].size,data_dict['temperature'].size,data_dict['wavenumber'].size,))
>>> data_dict['opacities'] = opac

Let’s build the Planck method using the dictionary as input

>>> from rapoc import Planck
>>> model = Planck(input_data=data_dict)

Now the model is ready to be used


input_data (dict) – input_data dictionary


Reads the dict content and returns the needed valued for the opacity models.


  • str – molecule name

  • astropy.units.Quantity – molecular mass

  • astropy.units.Quantity – data pressure grid in si units

  • astropy.units.Quantity – data temperature grid in si units

  • astropy.units.Quantity – data wavenumber grid

  • astropy.units.Quantity – data opacities grid in si units