specsr.data.build¶
Build paired training products from the raw JADES release.
Pipeline:
discover x1d files
-> group by (field, target_id) # one galaxy, whatever the tier
-> attach catalogue redshift # secure flags only
-> resample prism onto the log grid # flux-conserving, upsampling
-> stitch the medium gratings # inverse-variance, with a mask
-> quality cuts
-> augment # explicit parent_id
-> write .npz
Every stage is deliberate about provenance and about not inventing data; the
reasoning lives in the modules that do the work (ingest,
grid, stitch,
augment).
Redshifts¶
Taken from Combined_DR4_external_v1.2.1.fits as z_Spec, keeping only
quality flags A, B and C. That selection yields 3,297 galaxies across the
catalogue, which is the “robust spectroscopic redshifts” sample the paper
already quotes, so the definition is inherited rather than invented. Flag E is
almost entirely z_Spec = -1 (no redshift) and is dropped.
The redshift matters beyond bookkeeping: SR2 places its line tokens using it, so an insecure redshift puts the physics prior in the wrong place.
Module Attributes
|
Catalogue redshift-quality flags accepted as secure. |
Functions
|
Build one |
|
Map |
|
CLI entry point for |
Classes
|
Options for a dataset build. |
- class specsr.data.build.BuildConfig(release='DR4', fields=('goods-n', 'goods-s'), require_gratings=3, min_coverage=0.5, min_valid_fraction=0.5, secure_z_flags=('A', 'B', 'C'), grid=<factory>, augment=<factory>, limit=None, augment_train_only=True, train_frac=0.8, split_seed=42)[source]¶
Bases:
objectOptions for a dataset build.
- Parameters:
- min_valid_fraction: float = 0.5¶
Minimum fraction of the grid that must be genuinely measured in the reference. A galaxy covering only a sliver contributes almost nothing but still costs a full row.
- grid: LogWavelengthGrid¶
- augment: AugmentationConfig¶
- augment_train_only: bool = True¶
Augment only the galaxies that will be trained on. The held-out galaxies then contribute exactly one row each – their real spectrum – and no synthetic copy of a held-out galaxy exists anywhere in the product.
Augmenting everything and filtering at split time is behaviourally identical, but it leaves ~11k rows in the file that nothing may use, and a row that must never be read is a mistake waiting for someone who does not know that.