exo_k.xtable

@author: jeremy leconte

Module Contents

class exo_k.xtable.Xtable(*filename_filters, filename=None, p_unit='unspecified', file_p_unit='unspecified', kdata_unit='unspecified', file_kdata_unit='unspecified', remove_zeros=False, search_path=None, mol=None, **kwargs)[source]

Bases: exo_k.data_table.Data_table

A class that handles tables of cross sections.

Initializes cross section table and supporting data from a file based on its extension.

Parameters:
  • filename (str) – Relative or absolute path to the input file.

  • filename_filters (sequence of string) – As many strings as necessary to uniquely define a file in the global search path defined in Settings. This path will be searched for a file with all the filename_filters in the name. The filename_filters can contain ‘*’.

If there is no filename or filename_filters provided, just creates an empty object to be filled later

See Ktable __init__ mehthod for documentation on p_unit, file_p_unit, kdata_unit, file_kdata_unit, remove_zeros, search_path, and mol keywords.

read_hdf5(filename=None, mol=None, wn_range=None, wl_range=None)[source]

Initializes k coeff table and supporting data from an Exomol hdf5 file

Parameters:
  • filename (str) – Name of the input hdf5 file

  • mol (str, optional) – Overrides the name of the molecule to be put in the Xtable object.

write_hdf5(filename, compression='gzip', compression_level=9, kdata_unit=None, p_unit=None, exomol_units=False)[source]

Saves data in a hdf5 format

Parameters:
  • filename (str) – Name of the file to be created and saved

  • exomol_units (bool (optional)) – If True, data are converted back to cm^2 and bar units before being written.

read_exo_transmit(filename, mol=None)[source]

Creates an xsec object from an exo_transmit like spectra. See https://github.com/elizakempton/Exo_Transmit or Kempton et al. (2016) for details. Pressures are expected to be in Pa and cross sections in m^2/molecule

Parameters:
  • filename (str) – Name of the input file.

  • mol (str) – Overrides the name of the molecule to be put in the Xtable object.

hires_to_xtable(path=None, filename_grid=None, logpgrid=None, tgrid=None, write=0, mol=None, grid_p_unit='Pa', p_unit='unspecified', kdata_unit='unspecified', file_kdata_unit='unspecified', **kwargs)[source]

Loads an Xtable from high-resolution spectra (inplace).

Warning

By default, log pressures are specified in Pa in logpgrid!!! If you want to use another unit, do not forget to specify it with the grid_p_unit keyword.

see exo_k.ktable.Ktable.hires_to_ktable() method for details on the arguments and options.

bin_down(wnedges=None, remove_zeros=False, write=0)[source]

Method to bin down a xsec table to a new grid of wavenumbers (inplace).

Parameters:
  • wnedges (array, np.ndarray) – Edges of the new bins of wavenumbers (cm-1) onto which the xsec should be binned down. if you want Nwnew bin in the end, wngrid.size must be Nwnew+1 wnedges[0] should be greater than self.wnedges[0] wnedges[-1] should be lower than self.wnedges[-1]

  • remove_zeros (bool, optional) – If True, remove zeros in kdata.

sample(wngrid, remove_zeros=False, log_interp=None)[source]

Method to re sample a xsec table to a new grid of wavenumbers (inplace).

Parameters:

wngrid (array, np.ndarray) – Location of the new wavenumbers points (cm-1)

sample_cp(wngrid, **kwargs)[source]

Creates a copy of the instance before resampling it.

Parameters:

details. (See sample method for)

Returns:

Xtable object

the re-sampled Xtable

spectrum_to_plot(p=1e-05, t=200.0, x=1.0, g=None)[source]

provide the spectrum for a given point to be plotted

Parameters:
  • p (float) – Pressure (Ktable pressure unit)

  • t (float) – Temperature(K)

  • x (float) – Volume mixing ratio of the species

  • g (is unused but here to be consistent with the method in data_table)

copy(cp_kdata=True)[source]

Creates a new instance of Xtable object and (deep) copies data into it

Parameters:

cp_kdata (bool, optional) – If false, the kdata table is not copied and only the structure and metadata are.

Returns:

Xtable

A new Xtable instance with the same structure as self.

read_pickle(filename=None)[source]

Initializes xsec table and supporting data from an Exomol pickle file

Parameters:
  • filename (str) – Relative or absolute name of the input pickle file

  • mol (str, optional) – Overrides the name of the molecule to be put in the Xtable object.

write_pickle(filename)[source]

Saves data in a pickle format

Parameters:

filename (str) – Relative or absolute name of the file to be created and saved