rubix.spectra package#

Subpackages#

Submodules#

rubix.spectra.ifu module#

rubix.spectra.ifu.calculate_cube(spectra: Float[Array, 'n_stars n_wave_bins'], spaxel_index: Int[Array, 'n_stars'], num_spaxels: int) Float[Array, 'num_spaxels num_spaxels n_wave_bins'][source]#

Calculate the spectral data cube, which implies to sum up the spectra of all stars in each spaxel to get the spectral data cube.

Parameters:
  • spectra (array-like) – The spectra of all stars.

  • spaxel_index (array-like) – The spaxel index of each star. This defines into which telescope pixel the star falls.

  • num_spaxels (int) – The number of spaxels in one direction of the telescope aperture. The resulting number of telescope bins is num_spaxels^2. Assumes that the maximum value in spaxel_index does not exceed this value.

Returns:

The spectral data cube in an array-like format with shape (num_spaxels, num_spaxels, n_wave_bins).

rubix.spectra.ifu.calculate_diff(vec: Float[Array, '...'], pad_with_zero: bool = True) Float[Array, '...'][source]#

Calculate the difference between each element in a vector.

Parameters:
  • vec (array-like) – The input vector.

  • pad_with_zero (bool, optional) – Whether to prepend the first element of the vector to the differences. Default is True.

Returns:

The differences between each element in the vector (array-like).

rubix.spectra.ifu.convert_luminoisty_to_flux(luminosity: Float[Array, '...'], observation_lum_dist: Float[Array, '...'] | float, observation_z: float, pixel_size: float, CONSTANTS={'ADIABATIC_INDEX': 1.6666666666666667, 'BOLTZMANN_CONSTANT': 1.38066e-16, 'CMS_TO_KMS': '1e-5', 'CM_TO_KPC': 3.24078e-22, 'GCM1_TO_MSOLKM1': 5.02785e-29, 'GCM3_TO_MSOLKM3': 5.02785e-28, 'GCM3_TO_MSOLKPC3': '1.477e31', 'G_CONSTANT_CGS': 6.6743e-11, 'G_IN_KPCMSOLKMS2': 4.3009e-06, 'G_TO_MSOL': 5.02785e-34, 'LSOL_TO_ERG': '3.828e33', 'MASS_OF_PROTON': 1.67262e-24, 'MPC_TO_CM': '3.08568e24', 'SPEED_OF_LIGHT': 299792.458, 'S_TO_YR': 3.171e-08}) Float[Array, '...'][source]#

Convert luminosity to flux in units erg/s/cm^2/Angstrom as observed by the telescope. The luminosity is object specific, the flux depends on the distance to the object, the redshift, and the pixel size of the telescope.

Parameters:
  • luminosity (array-like) – The luminosity of the object.

  • observation_lum_dist (float) – The luminosity distance to the object in Mpc.

  • observation_z (float) – The redshift of the object.

  • pixel_size (float) – The pixel size of the telescope in cm.

  • CONSTANTS (dict, optional) – A dictionary containing the constants used in the calculation. Defaults to config[“constants”].

Returns:

The flux of the object in units erg/s/cm^2/Angstrom as observed by the telescope (array-like).

rubix.spectra.ifu.cosmological_doppler_shift(z: float, wavelength: Float[Array, 'n_bins']) Float[Array, 'n_bins'][source]#

Calculate the cosmological Doppler shift of a wavelength.

Parameters:
  • z (float) – The redshift.

  • wavelength (array-like) – The wavelength in Angstrom.

Returns:

The Doppler shifted wavelength in Angstrom.

rubix.spectra.ifu.get_velocity_component(vec: Float[Array, '...'], direction: str) Float[Array, '...'][source]#

This function returns the velocity component in a given direction.

Parameters:
  • vec (array-like) – The velocity vector.

  • direction (str) – The direction in which to get the velocity component. Supported directions are ‘x’, ‘y’, or ‘z’.

Returns:

The velocity component in the given direction (array-like).

rubix.spectra.ifu.resample_spectrum(initial_spectrum: Float[Array, 'n_bins_initial'], initial_wavelength: Float[Array, 'n_bins_initial'], target_wavelength: Float[Array, 'n_bins_target']) Float[Array, 'n_bins_target'][source]#

Resample a spectrum to the wavelength grid of a telescope.

Parameters:
  • initial_spectrum (array-like) – The initial spectrum.

  • initial_wavelength (array-like) – The initial wavelength grid.

  • target_wavelength (array-like) – The target wavelength grid.

Returns:

The resampled spectrum (array-like).

rubix.spectra.ifu.velocity_doppler_shift(wavelength: Float[Array, '...'], velocity: Float[Array, '* 3'], direction: str = 'y', SPEED_OF_LIGHT: float = 299792.458) Float[Array, '...'][source]#

Calculate the Doppler shift of a wavelength due to a velocity.

Parameters:
  • wavelength (array-like) – The wavelength in Angstrom.

  • velocity (array-like) – The velocity in km/s.

  • direction (str, optional) – The direction in which the velocity acts. Default is “y”.

  • SPEED_OF_LIGHT (float, optional) – The speed of light in km/s. Default is config[“constants”][“SPEED_OF_LIGHT”].

Returns:

The Doppler shifted wavelength in Angstrom (array-like).

Module contents#