pyrh API

pyrh.hse(cwd, atm_scale, scale, temp, pg_top=0.1, fudge_wave=None, fudge_value=None, atomic_number=None, atomic_abundance=None, full_output=False)

Set the atmosphere in hydrostatic equilibrium (HSE) by computing the electron and total hydrogen densities from given temperature, assuming an ideal gas law and LTE populations of species in the atmosphere.

Parameters:
  • cwd (str) – Relative path to directory containing RH input files.

  • atm_scale (int) – Type of an atmosphere scale. atm_scale=0 for the optical depth, atm_scale=1 for the column mass density and atm_scale=2 for the height.

  • scale (C contiguouse float64 numpy.ndarray) – Array containing the atmosphere scale.

  • temp (C contiguouse float64 numpy.ndarray) – Array containing a temperature in K for each depth point specified in scale.

  • pg_top (default, double) – Gas pressure at the top of the atmosphere in Pa. It is used to start the HSE iterative solution. By default pg_top=0.1.

  • fudge_wave (default, C contiguouse float64 numpy.ndarray) – Wavelength grid for the fudge factors used to alter the continuum opacity. By default fudge_wave=None.

  • fudge_value (default, C contiguouse float64 numpy.ndarray) – The opacity fudge coefficients for each wavelength given in fudge_wave. This is 2D array with three columns, each giving the fudge coefficients for H-, scattering and metals continuum opacity sources, respectively. By default fudge_value=None.

  • atomic_number (default, C contiguouse int32 numpy.ndarray) – The array containing the atomic number of elements for which we want to alter the abundance from the default ones found in the pyrh/rh/Atoms/abundance.dat file.

  • atomic_abundance (default, C contiguouse float64 numpy.ndarray) – The array containing the abundances of the elements listed in atomic_number.

  • full_output (default, bool) – Flag for the amount of output provided. If True, the method return electron density, total hydrogen density, mass density and gas pressure, respectively. By default full_output=False and the method returns only electron density and total hydrogen density.

Returns:

Electron and total hydrogen density. If full_output=True, then it returns electron density, total hydrogen density, mass density and gas pressure.

pyrh.get_scales(cwd, atm_scale, scale, atmosphere, lam_ref, atomic_number=None, atomic_abundance=None)

Compute the atmospheric scales: optical depth, height and column mass density at a given reference wavelength. From the provided scale, method computes opacity and converts it to the other two scales.

Parameters:
  • cwd (str) – Relative path to directory containing RH input files.

  • atm_scale (int) – Type of an atmosphere scale. atm_scale=0 for the optical depth, atm_scale=1 for the column mass density and atm_scale=2 for the height.

  • scale (C contiguouse float64 numpy.ndarray) – Array containing the atmosphere scale.

  • atmosphere (C contiguouse float64 numpy.ndarray) – MULTI type atmosphere (check … for more details).

  • lam_ref (double) – Reference wavelength in vacuum in nanometer units for which we give scales (optical depth and column mass) or at which we want to compute them.

  • atomic_number (default, C contiguouse int32 numpy.ndarray) – The array containing the atomic number of elements for which we want to alter the abundance from the default ones found in the pyrh/rh/Atoms/abundance.dat file.

  • atomic_abundance (default, C contiguouse float64 numpy.ndarray) – The array containing the abundances of the elements listed in atomic_number.

Returns:

The scales in this order: optical depth, height in meters and column mass in kg/m2.

Return type:

C contiguouse float64 numpy.ndarray

pyrh.get_ne_from_nH(cwd, atm_scale, scale, temperature, nH)

Compute the LTE electron density from given temperature and total hydrogen density.

Parameters:
  • cwd (str) – Relative path to directory containing RH input files.

  • atm_scale (int) – Type of an atmosphere scale. atm_scale=0 for the optical depth, atm_scale=1 for the column mass density and atm_scale=2 for the height.

  • scale (C contiguouse float64 numpy.ndarray) – Array containing the atmosphere scale.

  • temp (C contiguouse float64 numpy.ndarray) – Array containing a temperature in K for each depth point specified in scale.

  • nH (C contiguouse float64 numpy.ndarray) – The total hydrogen density in 1/cm3.

Returns:

The electron density in 1/cm3.

Return type:

C contiguouse float64 numpy.ndarray

pyrh.compute1d(cwd, mu, atm_scale, atmosphere, wave, loggf_ids=None, loggf_values=None, lam_ids=None, lam_values=None, fudge_wave=None, fudge_value=None, atomic_number=None, atomic_abundance=None, get_atomic_rfs=False)

Synthesise a spectrum and return the Stokes vector.

Parameters:
  • cwd (str) – Relative path to directory containing RH input files.

  • mu (double) – Angle for which we are computing the spectrum.

  • atm_scale (int) – Type of an atmosphere scale. atm_scale=0 for the optical depth, atm_scale=1 for the column mass density and atm_scale=2 for the height.

  • atmosphere (C contiguouse float64 numpy.ndarray) – MULTI type atmosphere (check … for more details).

  • wave (C contiguouse float64 numpy.ndarray) – Wavelength in vacuum in nanometer units for which to synthesise a spectrum.

  • loggf_ids (C contiguouse float64 numpy.ndarray) – Spectral line number from a Kurucz line list for which we provide log(gf) value different from the one found in a line list. Default None.

  • loggf_values (C contiguouse float64 numpy.ndarray) – log(gf) values for each line from loggf_ids. Default None.

  • lam_ids (C contiguouse float64 numpy.ndarray) – Spectral line number from a Kurucz line list for which we alter the central wavelength. Default None.

  • lam_values (C contiguouse float64 numpy.ndarray) – The wavelength shift in mA for all lines given in lam_ids.

  • fudge_wave (default, C contiguouse float64 numpy.ndarray) – Wavelength grid for the fudge factors used to alter the continuum opacity. By default fudge_wave=None.

  • fudge_value (default, C contiguouse float64 numpy.ndarray) – The opacity fudge coefficients for each wavelength given in fudge_wave. This is 2D array with three columns, each giving the fudge coefficients for H-, scattering and metals continuum opacity sources, respectively. By default fudge_value=None.

  • atomic_number (default, C contiguouse int32 numpy.ndarray) – The array containing the atomic number of elements for which we want to alter the abundance from the default ones found in the pyrh/rh/Atoms/abundance.dat file.

  • atomic_abundance (default, C contiguouse float64 numpy.ndarray) – The array containing the abundances of the elements listed in atomic_number.

  • get_atomic_rfs (bool) – Flag if we want to compute the analytical response functions to log(gf) for lines given in loggf_ids. Default False.

Returns:

The Stokes vector and wavelength in vacuum in nanometers.