:py:mod:`exo_k.xtable` ====================== .. py:module:: exo_k.xtable .. autoapi-nested-parse:: @author: jeremy leconte Module Contents --------------- .. py:class:: 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) Bases: :py:obj:`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. :param filename: Relative or absolute path to the input file. :type filename: :class:`str` :param filename_filters: As many strings as necessary to uniquely define a file in the global search path defined in :class:`~exo_k.settings.Settings`. This path will be searched for a file with all the filename_filters in the name. The filename_filters can contain '*'. :type filename_filters: :class:`sequence` of :class:`string` If there is no filename or filename_filters provided, just creates an empty object to be filled later See :class:`~exo_k.ktable.Ktable` __init__ mehthod for documentation on `p_unit`, `file_p_unit`, `kdata_unit`, `file_kdata_unit`, `remove_zeros`, `search_path`, and `mol` keywords. .. py:method:: read_hdf5(filename=None, mol=None, wn_range=None, wl_range=None) Initializes k coeff table and supporting data from an Exomol hdf5 file :param filename: Name of the input hdf5 file :type filename: :class:`str` :param mol: Overrides the name of the molecule to be put in the :class:`Xtable` object. :type mol: :class:`str`, *optional* .. py:method:: write_hdf5(filename, compression='gzip', compression_level=9, kdata_unit=None, p_unit=None, exomol_units=False) Saves data in a hdf5 format :param filename: Name of the file to be created and saved :type filename: :class:`str` :param exomol_units: If True, data are converted back to cm^2 and bar units before being written. :type exomol_units: :class:`bool (optional)` .. py:method:: read_exo_transmit(filename, mol=None) 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 :param filename: Name of the input file. :type filename: :class:`str` :param mol: Overrides the name of the molecule to be put in the :class:`Xtable` object. :type mol: :class:`str` .. py:method:: 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) 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 :func:`exo_k.ktable.Ktable.hires_to_ktable` method for details on the arguments and options. .. py:method:: bin_down(wnedges=None, remove_zeros=False, write=0) Method to bin down a xsec table to a new grid of wavenumbers (inplace). :param wnedges: 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] :type wnedges: :class:`array`, :class:`np.ndarray` :param remove_zeros: If True, remove zeros in kdata. :type remove_zeros: :class:`bool`, *optional* .. py:method:: sample(wngrid, remove_zeros=False, log_interp=None) Method to re sample a xsec table to a new grid of wavenumbers (inplace). :param wngrid: Location of the new wavenumbers points (cm-1) :type wngrid: :class:`array`, :class:`np.ndarray` .. py:method:: sample_cp(wngrid, **kwargs) Creates a copy of the instance before resampling it. :param See sample method for details.: :returns: :class:`Xtable` object the re-sampled :class:`Xtable` .. py:method:: spectrum_to_plot(p=1e-05, t=200.0, x=1.0, g=None) provide the spectrum for a given point to be plotted :param p: Pressure (Ktable pressure unit) :type p: :class:`float` :param t: Temperature(K) :type t: :class:`float` :param x: Volume mixing ratio of the species :type x: :class:`float` :param g: :type g: :class:`is unused but here` to :class:`be consistent with the method in data_table` .. py:method:: copy(cp_kdata=True) Creates a new instance of :class:`Xtable` object and (deep) copies data into it :param cp_kdata: If false, the kdata table is not copied and only the structure and metadata are. :type cp_kdata: :class:`bool`, *optional* :returns: :class:`Xtable` A new :class:`Xtable` instance with the same structure as self. .. py:method:: read_pickle(filename=None) Initializes xsec table and supporting data from an Exomol pickle file :param filename: Relative or absolute name of the input pickle file :type filename: :class:`str` :param mol: Overrides the name of the molecule to be put in the :class:`Xtable` object. :type mol: :class:`str`, *optional* .. py:method:: write_pickle(filename) Saves data in a pickle format :param filename: Relative or absolute name of the file to be created and saved :type filename: :class:`str`