hispecdrp.datamodels.extensions

Functions

IMAGE_HDU(dtype[, shape, default, ...])

Build an image extension descriptor.

TABLE_HDU(columns[, enumerate, title, units])

Build a table extension descriptor.

_base_title(title)

Strip a trailing '.' so a derived title (e.g. '{base} error.') doesn't get a stray one mid-sentence.

_units_squared(units)

create_L0_extensions([name, title, units])

create_barycorr_extensions()

create_chebyshev_extensions()

create_dataspec_extensions([prefix, title, ...])

create_drift_extensions()

create_etalonfitparam_extensions()

create_fluxabs_extensions([units])

create_lfcfitparam_extensions()

create_midtime_extensions([title, units])

create_rv_extensions()

create_sky_extensions([title, units])

create_specdq_extensions([title, prefix])

create_starmodel_extensions([title, units])

create_telluric_extensions([title])

create_throughput_extensions(**kwargs)

create_trans_extensions([title])

create_wave_extensions(**kwargs)

IMAGE_HDU(dtype, shape=None, default=None, enumerate=None, title=None, units=None)[source]

Build an image extension descriptor.

Parameters:
  • dtype – Numpy dtype of the array (np.float64, np.int32, etc.). For an extension with more than one legitimate dtype (e.g. RampModel.DATA, uint16 for real detector data vs. float32 for simulations run with convert_to_uint16=False), pass a precedence-ordered tuple or a X | Y union (e.g. np.uint16 | np.float32); the first entry is canonical – used to build auto-initialized default arrays, and as the dtype-correction target when the actual array matches none of them. A single dtype is stored as-is (not wrapped in a tuple).

  • shape (tuple | None, optional) – The array’s shape, as a tuple of literal ints and/or the symbolic axis-name strings 'DETECTOR_SIZE_Y', 'DETECTOR_SIZE_X', 'N_ORDERS', 'N_FIBERS', 'N_READS', 'ANY' (matched case-insensitively, but write them uppercase by convention), e.g. ('N_ORDERS', 'DETECTOR_SIZE_Y') or ('N_READS', 'DETECTOR_SIZE_Y', 'DETECTOR_SIZE_X'). Axis order is always Y before X. Resolved per-instance by DataModel._resolve_shape(). May be omitted (None) when this extension’s real shape is always identical to the model’s primary extension’s (see DataModel.primary_extension_name) – e.g. KTC next to BIAS, or RATE_ERR next to RATE – in which case it’s filled in from the primary’s own shape= at construction time instead of being repeated here (see DataModel._populate_shape_info()). Only useful on a model whose primary_extension_name is knowable without first resolving any extension’s shape (the base first-declared-key default); a model with a dynamic per-fiber override (returning None until some fiber’s data is set) can’t use this and must always give its own shape=.

  • default (float | int | None, optional) – Fill value used to lazily auto-initialize the array to np.full(resolved_shape, default, dtype=dtype) the first time the attribute is accessed, once every axis of shape resolves to a concrete size (an unresolvable axis – e.g. containing ANY, or a symbol with no source available on this model – means this automatic path doesn’t apply). Defaults to None. Regardless of whether default is given, building the array falls to DataModel.make_default_array() whenever the automatic path doesn’t apply – override it in a subclass for extensions needing custom construction (e.g. polynomial coefficients, whose axis sizes are a per-instance fit result with no symbol at all). With no default and no such override, the attribute stays None until explicitly assigned.

  • enumerate (str | None, optional) – If given, declare this extension once (without a suffix) and let DataModel._get_extensions expand it into one <NAME>_<enumerate>{n} entry per fiber (the format is always prefix_{enumerate}#), for n in 1..model.num_fibers.

  • title (str | None, optional) – Short human-readable description, purely for documentation – shown as the “Description” column of the Extensions table that DataModel.extensions_table() generates from EXTENSIONS and splices into the model class’s docstring. Never read by any auto-init or I/O logic.

  • units (str | None, optional) – Physical units, purely for documentation – shown as the “Units” column of the same generated table. Never read by any auto-init or I/O logic.

TABLE_HDU(columns, enumerate=None, title=None, units=None)[source]

Build a table extension descriptor.

Parameters:
  • columns (dict) – Mapping of column name -> dtype (e.g. str, np.float64, object for a variable-length array per row, as used by the CCF column).

  • enumerate (str | None, optional) – If given, declare this extension once (without a suffix) and let DataModel._get_extensions expand it into one <NAME>_<enumerate>{n} entry per fiber (the format is always prefix_{enumerate}#), for n in 1..model.config.num_fibers. Table extensions are always eagerly initialized as an empty (0-row) Table at datamodel construction, regardless of this flag.

  • title (str | None, optional) – Short human-readable description, purely for documentation – see IMAGE_HDU()’s title.

  • units (str | None, optional) – Physical units, purely for documentation – see IMAGE_HDU()’s units.

_base_title(title)[source]

Strip a trailing ‘.’ so a derived title (e.g. ‘{base} error.’) doesn’t get a stray one mid-sentence.

_units_squared(units)[source]
create_L0_extensions(name='RATE', title='Rate map.', units='e-/s')[source]
create_barycorr_extensions()[source]
create_chebyshev_extensions()[source]
create_dataspec_extensions(prefix='SPEC', title=None, units=None, **kwargs)[source]
create_drift_extensions()[source]
create_etalonfitparam_extensions()[source]
create_fluxabs_extensions(units='W/m^2/micron')[source]
create_lfcfitparam_extensions()[source]
create_midtime_extensions(title='Exposure mid-point times.', units='MJD')[source]
create_rv_extensions()[source]
create_sky_extensions(title=None, units=None, **kwargs)[source]
create_specdq_extensions(title='Data quality.', prefix='SPEC', **kwargs)[source]
create_starmodel_extensions(title='Stellar model spectrum.', units=None)[source]
create_telluric_extensions(title='Telluric model spectrum.')[source]
create_throughput_extensions(**kwargs)[source]
create_trans_extensions(title='Transmission correction.', **kwargs)[source]
create_wave_extensions(**kwargs)[source]