Пример #1
0
 def fittingLatex(self):
     from taurex.util.util import decode_string_array
     if not self.is_retrieval:
         raise Exception(
             'HDF5 was not generated from retrieval, no fitting latex found'
         )
     return decode_string_array(self.fd['Optimizer']['fit_parameter_latex'])
Пример #2
0
def load_generic_profile_from_hdf5(loc,
                                   module,
                                   identifier,
                                   profile_type=None,
                                   premade_dict=None,
                                   replacement_dict=None):

    if profile_type is None:
        profile_type = loc[identifier][()]

    temp_keys = list(loc.keys())
    klass = class_for_name(module, profile_type)

    klass_kwargs = get_klass_args(klass)

    args_dict = premade_dict or {}
    repl_dict = replacement_dict or {}

    for kw in klass_kwargs:

        if kw in temp_keys:
            v = loc[kw][()]
            if isinstance(v, np.ndarray) and v.dtype.type is np.string_:
                from taurex.util.util import decode_string_array
                v = decode_string_array(v)
            if kw in repl_dict:
                args_dict[kw] = repl_dict[kw]
            else:
                args_dict[kw] = v

    return klass(**args_dict)
Пример #3
0
def load_chemistry_from_hdf5(loc, replacement_dict=None):
    from taurex.data.profiles.chemistry import TaurexChemistry
    from taurex.util.util import decode_string_array
    chemistry = load_generic_profile_from_hdf5(
        loc['Chemistry'],
        'taurex.data.profiles.chemistry',
        'chemistry_type',
        replacement_dict=replacement_dict)

    if isinstance(chemistry, TaurexChemistry):
        for mol in decode_string_array(loc['Chemistry']['active_gases'][()]):
            if mol not in chemistry._fill_gases:
                chemistry.addGas(load_gas_from_hdf5(loc['Chemistry'], mol))
        for mol in decode_string_array(loc['Chemistry']['inactive_gases']):
            if mol not in chemistry._fill_gases:
                chemistry.addGas(load_gas_from_hdf5(loc['Chemistry'], mol))

    return chemistry
Пример #4
0
 def derivedLatex(self):
     from taurex.util.util import decode_string_array
     if not self.is_retrieval:
         raise Exception(
             'HDF5 was not generated from retrieval, no fitting latex found'
         )
     try:
         array = decode_string_array(
             self.fd['Optimizer']['derived_parameter_latex'])
         return [f'{c} (derived)' for c in array]
     except KeyError:
         return ['$\mu$ (derived)']
Пример #5
0
 def inactiveGases(self):
     return decode_string_array(
         self.fd['ModelParameters']['Chemistry']['inactive_gases'])
Пример #6
0
 def condensates(self):
     return decode_string_array(
         self.fd['ModelParameters']['Chemistry']['condensates'])