sheap.Utils.extras.can_be_usefull module
This module handles basic operations.
- build_cube_from_fits_header_comments(template_dir, output_file='miles_cube_log.npz', log_age_bins=None, z_bins=None)[source]
Read MILES-like template FITS files, build a (n_Z, n_age, n_pix) cube on a log-lambda grid, resample all templates to the max FWHM, and save as constant-resolution .npz.
- Parameters:
template_dir (str)
output_file (str)
log_age_bins (int)
z_bins (int)
- Return type:
Tuple[ndarray, ndarray, ndarray, ndarray]
- resample_to_log_lambda_npinterp(wave, flux, wdisp_kms, npix=None)[source]
Resample a linearly spaced spectrum to a log(λ) grid using numpy.interp.
- Parameters:
wave (ndarray) – Original wavelength array in Ångstroms (linearly spaced).
flux (ndarray) – Flux array (same length as wave).
wdisp_kms (float) – Instrumental dispersion in km/s (σ).
npix (int, optional) – Number of output pixels. Defaults to len(wave).
- Returns:
wave_log (ndarray) – Logarithmically spaced wavelength array.
flux_log (ndarray) – Resampled flux on log(λ) grid.
velscale (float) – Velocity scale in km/s per pixel.
fwhm_lambda (ndarray) – FWHM in Ångstroms at each pixel.
- Return type:
Tuple[ndarray, ndarray, float, ndarray]