pyROX.line_by_line
==================

.. py:module:: pyROX.line_by_line


Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/pyROX/line_by_line/lbl/index
   /autoapi/pyROX/line_by_line/lbl_exomol/index
   /autoapi/pyROX/line_by_line/lbl_hitran/index
   /autoapi/pyROX/line_by_line/lbl_kurucz/index


Classes
-------

.. autoapisummary::

   pyROX.line_by_line.LBL_Kurucz
   pyROX.line_by_line.LBL_HITRAN
   pyROX.line_by_line.LBL_ExoMol
   pyROX.line_by_line.LineByLine


Package Contents
----------------

.. py:class:: LBL_Kurucz(config, **kwargs)

   Bases: :py:obj:`pyROX.line_by_line.lbl.LineByLine`


   Class for handling line-by-line cross-sections from Kurucz data.


   .. py:attribute:: parent_dir


   .. py:attribute:: atoms_info


   .. py:method:: download_data(config)

      Download data from Kurucz.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: _read_configuration_parameters(config)

      Read parameters specific to Kurucz calculations from the configuration.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: _read_impact_info(impact_info={})

      Read impact width/shift information from the configuration.

      :param impact_info: Dictionary containing impact information.
      :type impact_info: dict

      :returns: Updated impact information.
      :rtype: dict



   .. py:method:: _read_partition_function(T_grid=np.arange(1, 7001 + 1e-06, 1))

      Read the partition function from the configuration file.

      :param T_grid: Temperature grid for partition function calculation.
      :type T_grid: array



   .. py:method:: _read_kurucz_transitions(input_file)

      Read transitions from a Kurucz input file.

      :param input_file: Path to the input file.
      :type input_file: str

      :returns: Arrays of transition parameters (nu_0, E_low, A, g_up, gamma_vdW, gamma_N).
      :rtype: tuple



   .. py:method:: _read_vald_transitions(input_file)
      :abstractmethod:


      Read transitions from a VALD input file.

      :param input_file: Path to the input file.
      :type input_file: str

      :raises NotImplementedError: If the method is not implemented.



   .. py:method:: compute_vdw_broadening(P, T, E_low, nu_0)

      Calculate Van der Waals broadening.

      :param P: Pressure in Pa.
      :type P: float
      :param T: Temperature in Kelvin.
      :type T: float
      :param E_low: Lower state energies in Joules.
      :type E_low: array
      :param nu_0: Transition frequencies in s^-1.
      :type nu_0: array

      :returns: Van der Waals broadening in s^-1.
      :rtype: array



   .. py:method:: compute_natural_broadening(A)

      Calculate natural broadening.

      :param A: Einstein A-coefficient in s^-1.
      :type A: float

      :returns: Natural broadening in s^-1.
      :rtype: float



   .. py:method:: pressure_shift(P, T, nu_0, delta=None)

      Apply pressure shift to the transition frequency.

      :param P: Pressure in Pa.
      :type P: float
      :param T: Temperature in Kelvin.
      :type T: float
      :param nu_0: Transition frequencies in s^-1.
      :type nu_0: array
      :param delta: Pressure shift coefficient.
      :type delta: float, optional

      :returns: Pressure-shifted frequencies.
      :rtype: array



   .. py:method:: _apply_impact_Allard_ea_2023(P, T, nu_0, gamma=None)

      Apply impact width/shift (Allard et al. 2023).

      :param P: Pressure in Pa.
      :type P: float
      :param T: Temperature in Kelvin.
      :type T: float
      :param nu_0: Transition frequencies in s^-1.
      :type nu_0: array
      :param gamma: Line widths.
      :type gamma: array, optional

      :returns: Modified transition frequencies or line widths.
      :rtype: array



   .. py:method:: process_transitions(input_file, **kwargs)

      Read transitions from the input file and compute cross-sections.

      :param input_file: Path to the input file.
      :type input_file: str
      :param \*\*kwargs: Additional arguments.



.. py:class:: LBL_HITRAN(config, **kwargs)

   Bases: :py:obj:`pyROX.line_by_line.lbl.LineByLine`


   Class for handling line-by-line cross-sections from HITRAN data.


   .. py:method:: download_data(config)

      Downloads data from HITRAN.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: _read_configuration_parameters(config)

      Reads parameters specific to HITRAN calculations from the configuration.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: process_transitions(input_file, **kwargs)

      Reads transitions from the input file and computes cross-sections.

      :param input_file: Path to the input file.
      :type input_file: str
      :param \*\*kwargs: Additional arguments.



.. py:class:: LBL_ExoMol(config, **kwargs)

   Bases: :py:obj:`pyROX.line_by_line.lbl.LineByLine`


   Class for handling line-by-line cross-sections from ExoMol data.


   .. py:method:: download_data(config)

      Downloads data from ExoMol.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: _read_configuration_parameters(config)

      Reads parameters specific to ExoMol calculations from the configuration.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: _read_broadening_per_transition(J_l, J_u, chunk_size=100000)

      Reads broadening parameters for each transition.

      :param J_l: Lower state rotational quantum numbers.
      :type J_l: array
      :param J_u: Upper state rotational quantum numbers.
      :type J_u: array
      :param chunk_size: Size of chunks to process at a time.
      :type chunk_size: int



   .. py:method:: _read_states()

      Reads the states from the states file.



   .. py:method:: process_transitions(input_file, **kwargs)

      Reads transitions from the input file and compute cross-sections.

      :param input_file: Path to the input file.
      :type input_file: str
      :param \*\*kwargs: Additional arguments.



.. py:class:: LineByLine(config, **kwargs)

   Bases: :py:obj:`pyROX.CrossSections`, :py:obj:`LineProfileHelper`


   Base class for line-by-line cross-sections.


   .. py:method:: _read_configuration_parameters(config)

      Reads parameters specific to line-by-line calculations from the configuration.

      :param config: Configuration object containing parameters.
      :type config: object



   .. py:method:: _read_equation_of_state()

      Reads the equation of state for the gas mixture.



   .. py:method:: _read_mass()

      Reads the mass of the species from the configuration or database.



   .. py:method:: _read_pressure_broadening_info()

      Reads the pressure broadening parameters from the configuration.



   .. py:method:: _read_partition_function()

      Reads the partition function from the configuration file.



   .. py:method:: iterate_over_PT_grid(function, progress_bar=True, **kwargs)

      Iterate over the pressure-temperature grid in parallel and apply a function.

      :param function: Function to apply at each grid point.
      :type function: callable
      :param progress_bar: Whether to show a progress bar.
      :type progress_bar: bool
      :param \*\*kwargs: Additional arguments for the function.



   .. py:method:: calculate_cross_sections(P, T, nu_0, S_0, E_low, A, delta=None, **kwargs)

      Computes the cross-sections for given parameters.

      :param P: Pressure in Pa.
      :type P: float
      :param T: Temperature in Kelvin.
      :type T: float
      :param nu_0: Transition frequencies in s^-1.
      :type nu_0: array
      :param S_0: Line strengths at reference temperature.
      :type S_0: array
      :param E_low: Lower state energies in Joules.
      :type E_low: array
      :param A: Einstein A-coefficients in s^-1.
      :type A: array
      :param delta: Pressure shift coefficients.
      :type delta: array, optional
      :param \*\*kwargs: Additional arguments.



   .. py:method:: calculate_temporary_outputs(overwrite=False, save_in_one_file=False, files_range=None, **kwargs)

      Calculates temporary outputs for cross-sections.

      :param overwrite: Whether to overwrite existing files.
      :type overwrite: bool
      :param save_in_one_file: Whether to save all outputs in one file.
      :type save_in_one_file: bool
      :param files_range: Range of files to process.
      :type files_range: tuple, optional
      :param \*\*kwargs: Additional arguments.



   .. py:method:: save_combined_outputs(**kwargs)

      Saves the merged outputs to a file.

      :param \*\*kwargs: Additional arguments for saving.



   .. py:method:: plot_combined_outputs(fig=None, ax=None, return_fig_ax=False, cmaps=['coolwarm', 'viridis'], xscale='log', yscale='log', xlim=None, ylim=None, ls='-', lw=0.7, **kwargs)

      Plots the merged outputs.

      :param fig: Figure object for plotting.
      :type fig: matplotlib.figure.Figure
      :param ax: Axes object for plotting.
      :type ax: matplotlib.axes.Axes
      :param return_fig_ax: Whether to return the figure and axes.
      :type return_fig_ax: bool
      :param cmaps: List of colormaps for plotting.
      :type cmaps: list
      :param xscale: Scale for the x-axis.
      :type xscale: str
      :param yscale: Scale for the y-axis.
      :type yscale: str
      :param xlim: Limits for the x-axis.
      :type xlim: tuple, optional
      :param ylim: Limits for the y-axis.
      :type ylim: tuple, optional
      :param ls: Line style for plotting.
      :type ls: str
      :param \*\*kwargs: Additional arguments for plotting.



   .. py:method:: convert_to_pRT3(contributor=None, **kwargs)

      Converts the cross-sections to petitRADTRANS v3.0 format.

      :param contributor: Name of the contributor for these data.
      :type contributor: str
      :param \*\*kwargs: Additional arguments for conversion.

      :raises ValueError: If required metadata is missing in the configuration.
      :raises KeyError: If required keys are missing in the metadata.



