petitRADTRANS.validation
========================

.. py:module:: petitRADTRANS.validation

.. autoapi-nested-parse::

   This module provides sanity checks on inputs for the Radtrans class.



Attributes
----------

.. autoapisummary::

   petitRADTRANS.validation._UNSET
   petitRADTRANS.validation._DEPRECATED_CLOUD_PARTICLE_ARGUMENTS


Functions
---------

.. autoapisummary::

   petitRADTRANS.validation._warn_deprecated_cloud_particle_argument
   petitRADTRANS.validation._resolve_deprecated_cloud_particle_argument
   petitRADTRANS.validation._normalize_deprecated_cloud_particle_arguments
   petitRADTRANS.validation._normalize_deprecated_cloud_particle_parameter_keys
   petitRADTRANS.validation._warn_scattering_in_emission_without_cloud_species
   petitRADTRANS.validation._warn_partial_cloud_coverage_without_patchy_clouds
   petitRADTRANS.validation._check_anisotropic_cloud_scattering
   petitRADTRANS.validation._check_line_opacity_mode
   petitRADTRANS.validation._check_input_data_file_existence
   petitRADTRANS.validation._check_path_input_data
   petitRADTRANS.validation._check_pressures
   petitRADTRANS.validation._check_return_clear_spectrum_relevance
   petitRADTRANS.validation._check_wavelength_boundaries
   petitRADTRANS.validation._sanitize_frequency_surface_input
   petitRADTRANS.validation._sanitize_emission_surface_inputs
   petitRADTRANS.validation._normalize_optional_mapping
   petitRADTRANS.validation._normalize_optional_scalar
   petitRADTRANS.validation._normalize_optional_mapping_or_scalar
   petitRADTRANS.validation._normalize_cloud_species_selection
   petitRADTRANS.validation._sanitize_flux_opacity_inputs
   petitRADTRANS.validation._handle_grid_misalignment


Module Contents
---------------

.. py:data:: _UNSET

.. py:data:: _DEPRECATED_CLOUD_PARTICLE_ARGUMENTS

.. py:function:: _warn_deprecated_cloud_particle_argument(deprecated_name: str, canonical_name: str)

.. py:function:: _resolve_deprecated_cloud_particle_argument(*, deprecated_name: str, canonical_name: str, deprecated_value: Any, canonical_value: Any, canonical_default: Any = _UNSET)

.. py:function:: _normalize_deprecated_cloud_particle_arguments(*, cloud_particle_mean_radii, cloud_particle_radius_distribution_std, cloud_particle_radius_distribution, cloud_particle_number_density_grid, cloud_particles_mean_radii=_UNSET, cloud_particles_radius_distribution_std=_UNSET, cloud_particles_radius_distribution=_UNSET, cloud_particles_number_density_grid=_UNSET)

.. py:function:: _normalize_deprecated_cloud_particle_parameter_keys(cloud_parameters: dict[str, Any]) -> dict[str, Any]

.. py:function:: _warn_scattering_in_emission_without_cloud_species(scattering_in_emission: bool, cloud_species: list[str] | tuple[str] | None)

.. py:function:: _warn_partial_cloud_coverage_without_patchy_clouds(cloud_fraction: float, patchy_clouds: tuple[str, Ellipsis], has_partial_coverage_background_cloud: bool = False)

.. py:function:: _check_anisotropic_cloud_scattering(mode: Union[str, bool])

   Check if the anisotropic cloud scattering mode is valid.

   Args:
       mode: The anisotropic cloud scattering mode.


.. py:function:: _check_line_opacity_mode(mode: str)

   Check if the line opacity mode is valid.

   Args:
       mode: The line opacity mode.


.. py:function:: _check_input_data_file_existence(path: str)

   Check if an input data file exists.

   Args:
       path: The path to the input data file.


.. py:function:: _check_path_input_data(path: str)

   Check if the input data path exists.

   Args:
       path: The path to the input data directory.


.. py:function:: _check_pressures(pressures: jax.typing.ArrayLike)

   Check if the pressures are in increasing order.

   Args:
       pressures: The array of pressures.


.. py:function:: _check_return_clear_spectrum_relevance(return_clear_spectrum: bool, clouds_have_effect: bool, opaque_cloud_top_pressure: Optional[float], cloud_fraction: float)

   Check if returning a clear spectrum is relevant and issue warnings if not.

   Args:
       return_clear_spectrum: If True, a clear spectrum will be returned in addition to the cloudy one.
       clouds_have_effect: If True, clouds have an effect on the spectrum.
       opaque_cloud_top_pressure: The pressure of the opaque cloud top.
       cloud_fraction: The cloud fraction.


.. py:function:: _check_wavelength_boundaries(boundaries: jax.typing.ArrayLike)

   Check if the wavelength boundaries are valid.

   Args:
       boundaries: The wavelength boundaries.


.. py:function:: _sanitize_frequency_surface_input(values, frequencies, default_value, quantity_name)

.. py:function:: _sanitize_emission_surface_inputs(frequencies, scattering_in_emission, star_irradiation_angle, stellar_intensities, star_effective_temperature, star_radius, orbit_semi_major_axis, reflectances, emissivities)

.. py:function:: _normalize_optional_mapping(mapping, dtype=WORKING_JAX_DTYPE)

.. py:function:: _normalize_optional_scalar(value, missing_value, dtype=WORKING_JAX_DTYPE)

.. py:function:: _normalize_optional_mapping_or_scalar(value, missing_value, dtype=WORKING_JAX_DTYPE)

.. py:function:: _normalize_cloud_species_selection(selection, default_species)

.. py:function:: _sanitize_flux_opacity_inputs(patchy_clouds, cloud_particle_mean_radii, cloud_hansen_a, cloud_hansen_b, clouds_particle_porosity_factor, cloud_f_sed, eddy_diffusion_coefficients, opaque_cloud_top_pressure, cloud_particle_radius_distribution_std, power_law_opacity_350nm, power_law_opacity_coefficient, gray_opacity, cloud_photosphere_median_optical_depth, cloud_particle_number_density_grid, additional_absorption_opacities_function, additional_scattering_opacities_function, target_particle_radii, target_pressure, cloud_species, missing_float, missing_neg_inf, noop_opacity_fn: Callable)

.. py:function:: _handle_grid_misalignment(indices: numpy.typing.NDArray[bool], frequencies_reference: jax.typing.ArrayLike, frequencies_test: jax.typing.ArrayLike) -> numpy.typing.NDArray[bool]

   Handle frequency grid misalignment by extending the selection of indices.

   This function is a workaround for cases where the frequency grid of the model does not perfectly align with the
   frequency grid of the opacity data, even after selecting the closest frequencies. It extends the selection of
   indices to include one more frequency to the left or right to ensure that the model's frequency range is
   fully covered by the opacity data.

   Args:
       indices: The boolean array of indices selecting the frequencies from the opacity data.
       frequencies_reference: The frequency grid of the model.
       frequencies_test: The frequency grid of the opacity data.

   Returns:
       The updated boolean array of indices.


