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_x num_spaxels_y n_wave_bins'][source]#
Aggregate stellar spectra into a spatial data cube.
- Parameters:
spectra (Float[Array, STAR_WAVE_AXES]) – Individual spectra.
spaxel_index (Int[Array, SPAXEL_INDEX_AXIS]) – Flat spaxel indices per star.
num_spaxels (int) – Number of spaxels per axis.
- Returns:
Summed cube.
- Return type:
Float[Array, SPAXEL_CUBE_AXES]
- rubix.spectra.ifu.calculate_diff(vec: Float[Array, '...'], pad_with_zero: bool = True) Float[Array, '...'][source]#
Calculate consecutive differences along a vector.
- Parameters:
vec (Float[Array, "..."]) – Input grid.
pad_with_zero (bool, optional) – If
Trueprepend the first element so the output matches the input length. Defaults toTrue.
- Returns:
Finite differences of
vec.- Return type:
Float[Array, “…”]
- rubix.spectra.ifu.convert_luminoisty_to_flux(luminosity: Float[Array, '...'], observation_lum_dist: Float[Array, '...'] | float, observation_z: float, pixel_size: float, CONSTANTS: dict = {'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, 'KPC_TO_CM': '3.08568e21', 'LSOL_TO_ERG': '3.828e33', 'MASS_OF_PROTON': 1.67262e-24, 'MPC_TO_CM': '3.08568e24', 'MSUN_TO_GRAMS': '1.989e33', '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 (Float[Array, "..."]) – Intrinsic luminosity per bin.
observation_lum_dist (Union[Float[Array, "..."], float]) – Luminosity distance in Mpc.
observation_z (float) – Object redshift.
pixel_size (float) – Telescope pixel size in cm.
CONSTANTS (dict, optional) – Conversion constants. Defaults to
config["constants"].
- Returns:
Flux in erg/s/cm^2/Å.
- Return type:
Float[Array, “…”]
- rubix.spectra.ifu.convert_luminoisty_to_flux_factor(observation_lum_dist, observation_z, pixel_size, 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, 'KPC_TO_CM': '3.08568e21', 'LSOL_TO_ERG': '3.828e33', 'MASS_OF_PROTON': 1.67262e-24, 'MPC_TO_CM': '3.08568e24', 'MSUN_TO_GRAMS': '1.989e33', 'SPEED_OF_LIGHT': 299792.458, 'S_TO_YR': 3.171e-08})[source]#
Convert luminosity to flux in units erg/s/cm^2/Å.
- rubix.spectra.ifu.cosmological_doppler_shift(z: float, wavelength: Float[Array, 'n_bins']) Float[Array, 'n_bins'][source]#
Apply the cosmological Doppler shift to a wavelength grid.
- Parameters:
z (float) – Object redshift.
wavelength (Float[Array, N_BINS_AXIS]) – Wavelengths in Å.
- Returns:
Doppler-shifted wavelengths in Å.
- Return type:
Float[Array, N_BINS_AXIS]
- 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 (Float[Array, "..."]) – The velocity vector.
direction (str) – The direction in which to get the velocity component. Supported directions are ‘x’, ‘y’, or ‘z’.
- Returns:
Component extracted from
vec.- Return type:
Float[Array, “…”]
- Raises:
ValueError – If
vecdoes not have 1 or 2 dimensions or the direction is invalid.
- 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 onto a target wavelength grid.
- Parameters:
initial_spectrum (Float[Array, N_BINS_INITIAL_AXIS]) – Input spectrum.
initial_wavelength (Float[Array, N_BINS_INITIAL_AXIS]) – Input grid in Å.
target_wavelength (Float[Array, N_BINS_TARGET_AXIS]) – Target grid in Å.
- Returns:
Flux conserved on the new grid.
- Return type:
Float[Array, N_BINS_TARGET_AXIS]
- rubix.spectra.ifu.velocity_doppler_shift(wavelength: Float[Array, '...'], velocity: Float[Array, '... 3'], direction: str = 'z', SPEED_OF_LIGHT: float = 299792.458) Float[Array, '...'][source]#
Vectorized Doppler shift over multiple velocity vectors.
- Parameters:
wavelength (Float[Array, "..."]) – Rest wavelengths in Å.
velocity (Float[Array, ELLIPSIS_THREE_AXES]) – Velocity components per sample.
direction (str, optional) – Axis to project onto. Defaults to
config["ifu"]["doppler"]["velocity_direction"].SPEED_OF_LIGHT (float, optional) – Speed of light in km/s. Defaults to
config["constants"]["SPEED_OF_LIGHT"].
- Returns:
Doppler shifted wavelengths per velocity entry.
- Return type:
Float[Array, “…”]