hispecdrp.datamodels.extensions
Functions
|
Build an image extension descriptor. |
|
Build a table extension descriptor. |
|
Strip a trailing '.' so a derived title (e.g. '{base} error.') doesn't get a stray one mid-sentence. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 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 aX | Yunion (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 byDataModel._resolve_shape(). May be omitted (None) when this extension’s real shape is always identical to the model’s primary extension’s (seeDataModel.primary_extension_name) – e.g.KTCnext toBIAS, orRATE_ERRnext toRATE– in which case it’s filled in from the primary’s ownshape=at construction time instead of being repeated here (seeDataModel._populate_shape_info()). Only useful on a model whoseprimary_extension_nameis knowable without first resolving any extension’s shape (the base first-declared-key default); a model with a dynamic per-fiber override (returningNoneuntil some fiber’s data is set) can’t use this and must always give its ownshape=.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 ofshaperesolves to a concrete size (an unresolvable axis – e.g. containingANY, or a symbol with no source available on this model – means this automatic path doesn’t apply). Defaults toNone. Regardless of whetherdefaultis given, building the array falls toDataModel.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 nodefaultand no such override, the attribute staysNoneuntil explicitly assigned.enumerate (str | None, optional) – If given, declare this extension once (without a suffix) and let
DataModel._get_extensionsexpand it into one<NAME>_<enumerate>{n}entry per fiber (the format is alwaysprefix_{enumerate}#), forn in 1..model.num_fibers.title (str | None, optional) – Short human-readable description, purely for documentation – shown as the “Description” column of the
Extensionstable thatDataModel.extensions_table()generates fromEXTENSIONSand 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,objectfor a variable-length array per row, as used by theCCFcolumn).enumerate (str | None, optional) – If given, declare this extension once (without a suffix) and let
DataModel._get_extensionsexpand it into one<NAME>_<enumerate>{n}entry per fiber (the format is alwaysprefix_{enumerate}#), forn 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()’stitle.units (str | None, optional) – Physical units, purely for documentation – see
IMAGE_HDU()’sunits.
- _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]