# exo_k.cia_table¶

@author: jeremy leconte

A class to handle continuum absorption (CIA)

## Module Contents¶

class Cia_table(*filename_filters, filename=None, molecule_pair=None, search_path=None, mks=False, remove_zeros=False, old_cia_unit='cm^5')[source]

A class to handle CIA opacity data tables.

Initialization for Cia_tables.

Parameters
• filename (str, optional) – Relative or absolute name of the file to be loaded.

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

• molecule_pair (list of size 2, optional) – The molecule pair we want to consider, specified as an array with two strings (like [‘H2’,’H2’] or [‘N2’,’H2O’]). The order of the molecules in the pair is irrelevant.

Other Parameters
• old_cia_unit (str, optional) – String to specify the current cia unit if it is unspecified or if you have reasons to believe it is wrong (e.g. you just read a file where you know that the cia grid and the cia unit do not correspond). Available units are: ‘cm^5’, ‘cm^2’ that stand for cm^2/amagat, and ‘cm^-1’ that stand for cm^-1/amagat^2.

• remove_zeros (boolean, optional) –

If True, the zeros in the kdata table are replaced by

a value 10 orders of magnitude smaller than the smallest positive value

• search_path (str, optional) – If search_path is provided, it locally overrides the global search path defined with exo_k.settings.Settings.set_cia_search_path() and only files in search_path are returned.

read_hitran_cia(self, filename, old_cia_unit='cm^5')[source]

Reads hitran cia files and load temperature, wavenumber, and absorption coefficient grid.

Parameters
• filename (str) – Name of the file to be read.

• old_cia_unit (str, optional) – Units found in the file.

read_hdf5(self, filename)[source]

Reads hdf5 cia files and load temperature, wavenumber, and absorption coefficient grid.

Parameters

filename (str) – Name of the file to be read.

write_hdf5(self, filename)[source]

Writes hdf5 cia files.

Parameters

filename (str) – Name of the file to be written.

sample(self, wngrid, remove_zeros=False, use_grid_filter=False, **kwargs)[source]

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

Parameters
• wngrid (array) – new wavenumber grid (cm-1)

• use_grid_filter (boolean, optional) – If true, the table is sampled only within the boundaries of its current wavenumber grid. The coefficients are set to zero elswere (except if remove_zeros is set to True). If false, the values at the boundaries are used when sampling outside the grid.

sample_cp(self, wngrid, **kwargs)[source]

Creates a copy of the object before resampling it.

Parameters

sample method for details. (See) –

Returns

the re-sampled Cia_table

Return type

Cia_table object

interpolate_cia(self, t_array=None, log_interp=None, wngrid_limit=None)[source]

interpolate_cia interpolates the kdata at on a given temperature profile.

Parameters
• t_array (float or array) – Temperature array to interpolate to. If a float is given, it is interpreted as an array of size 1.

• wngrid_limit (array, optional) – If an array is given, interpolates only within this array.

• log_interp (bool, optional) – Whether the interpolation is linear in kdata or in log(kdata).

Returns

The interpolated kdata.

Return type

array of shape (logp_array.size, self.Nw)

equivalent_xsec(self, logP, T, x_mol2, wngrid_limit=None)[source]

Computes the cross section due to CIA in area per molecule of type 1.

effective_cross_section(self, logP, T, x_mol1, x_mol2, wngrid_limit=None)[source]

Computes the total cross section for a molecule pair (in m^2 per total number of molecules; assumes data in MKS).

Parameters
• logP (float or array) – Log10 of the pressure (Pa).

• T (float or array) – Temperature (K).

• x_mol1/2 (float or array) – Volume mixing ratio of the 1st and 2nd molecule of the pair.

• wngrid_limit (array, optional) – If an array is given, interpolates only within this array.

Returns

total cross section for the molecule pair in m^2 per total number of molecules.

Return type

float or array

plot_spectrum(self, ax, t=200.0, x_axis='wls', xscale=None, yscale=None, **kwarg)[source]

Plot the spectrum for a given point

Parameters
• ax (pyplot.Axes) – A pyplot axes instance where to put the plot.

• t (float) – temperature(K)

• x_axis (str, optional) – If ‘wls’, x axis is wavelength. Wavenumber otherwise.

• x/yscale (str, optional) – If ‘log’ log axes are used.

convert_abs_coeff_unit(self, abs_coeff_unit='unspecified', old_abs_coeff_unit='unspecified')[source]

Converts abs_coeff to a new unit (inplace).

Parameters
• abs_coeff_unit (str) – String to identify the units to convert to. Accepts ‘cm^5’, ‘m^5’. or any length^5 unit recognized by the astropy.units library. If =’unspecified’, no conversion is done.

• old_abs_coeff_unit (str, optional) – String to specify the current kdata unit if it is unspecified or if you have reasons to believe it is wrong (e.g. you just read a file where you know that the kdata grid and the kdata unit do not correspond)

convert_to_mks(self)[source]

Converts units to MKS

remove_zeros(self, deltalog_min_value=0.0)[source]

Finds zeros in the abs_coeff and set them to (10.^-deltalog_min_value) times the minimum positive value in the table (inplace). This is to be able to work in logspace.

copy(self)[source]

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

read_CKD_cia(self, filename, old_cia_unit='cm^2')[source]

Reads hitran cia files and load temperature, wavenumber, and absorption coefficient grid.

Parameters

filename (str) – Name of the file to be read.

effective_cross_section2(self, logP, T, x_mol1, x_mol2, wngrid_limit=None)[source]

Obsolete.

Computes the total cross section for a molecule pair (in m^2 per total number of molecules; assumes data in MKS).