CUBE3DΒΆ

class cube3d.Cube3D(config, stellar_map=None, gas_map=None)ΒΆ

Class for constructing 3D spectral data cubes (RA Γ— DEC Γ— Wavelength) including stellar continuum and/or ionized gas emission.

Parameters
  • config (object) – Configuration object defining spatial and spectral grids. Must contain attributes: nx, ny, dpix, wave, dlam, inst_fwhm.

  • stellar_map (object, optional) – 2D maps of stellar population properties with shape (nx, ny).

  • gas_map (object, optional) – 2D maps of ionized gas properties with shape (nx, ny).

  • objname (str, optional) – Object name. Used for FITS header and default filename.

  • ra (float, optional) – Right Ascension of cube center (in degrees). Default is 0.0 if not specified.

  • dec (float, optional) – Declination of cube center (in degrees). Default is 0.0 if not specified.

Notes

  • Internal cube shape is (nx, ny, nz), where:
    • nx: number of RA pixels (x-axis)

    • ny: number of DEC pixels (y-axis)

    • nz: number of wavelength bins

  • flux[i, j, :] corresponds to the spectrum at pixel (i_RA, j_DEC).

  • Units of output flux: 1e-17 erg/s/cm^2/Γ….

insert_spec(spec, dx_arcsec=0.0, dy_arcsec=0.0)ΒΆ

Add a 1D spectrum into the cube center with optional spatial offset (in arcsec).

Parameters
  • spec (object) – Must contain .flux of shape (nz,)

  • dx_arcsec (float) – Offset in RA direction [arcsec] (positive = east)

  • dy_arcsec (float) – Offset in DEC direction [arcsec] (positive = north)

Notes

The spectrum is inserted at the pixel nearest to (center + offset).

make_cube(stellar_tem=None, hii_tem=None)ΒΆ

Generate the full spectral cube by summing stellar and ionized gas components.

At least one of stellar_map or gas_map must be provided. If both are provided, their spectra are summed. If only one is present, only that component is used.

Parameters
  • stellar_tem (object) – Template used by StellarContinuum.

  • hii_tem (object) – Template used by HII_Region.

Raises

ValueError – If both stellar_map and gas_map are None.

savefits(filename=None, path='./')ΒΆ

Save the spectral cube into a FITS file with WCS and metadata.

Parameters
  • filename (str, optional) – Output FITS filename (with or without .fits suffix). If None, defaults to β€œ<object_name>.fits”

  • path (str, optional) – Output directory. Default is current directory.

wcs_info()ΒΆ

Construct a WCS header consistent with FITS axis order.

FITS convention: - Axis 1 β†’ WAVE (fastest axis in memory) - Axis 2 β†’ DEC (Y) - Axis 3 β†’ RA (X)

Stores result in self.wcs_header.