Reference / File formats
File formats¶
This page lists the files that DOROTHY reads and writes: the super-catalogue,
the checkpoint directory, the predictions CSV and the FITS input of
dorothy predict.
Super-catalogue¶
One HDF5 file, one row per star. What is in the super-catalogue explains the layout; this table lists it. N is the number of stars and P the number of parameters.
Path |
Shape and type |
Content |
|---|---|---|
|
(N,) int64 |
Gaia DR3 source ID of each row, sorted |
|
(N,) float64 |
Degrees; 0 where unknown |
|
(N, n_wavelengths) float32 |
0 where the survey has no spectrum |
|
(N, n_wavelengths) float32 |
Inverse variance; 0 at masked or missing pixels |
|
(n_wavelengths,) float32 |
Å |
|
(N,) float32 |
Median S/N of the spectrum; 0 where missing |
|
(N, 4, max(n_b, n_r)) float32 |
flux_b, ivar_b, flux_r, ivar_r, each arm padded to the longer one |
|
(n_b,), (n_r,) float32 |
Å |
|
(N, P) float32 |
0 where missing |
|
(N, P) float32 |
0 where missing |
|
(N, P) uint8 |
0 = no warning |
|
(N,) int64 |
Equal to |
The file attributes are n_stars, parameter_names, abundance_scale,
survey_names, label_sources, creation_date and version (2.0.0).
Checkpoint directory¶
dorothy train writes <output_dir>/<name>/<name>_final/.
Trainer.save_checkpoint
writes the files without a note in the last column.
File |
Content |
Note |
|---|---|---|
|
PyTorch state dict of the epoch with the lowest validation loss |
|
|
State dict of the last epoch |
|
|
Calibration factors of |
Absent with |
|
The completed configuration |
|
|
Label normalization: parameter → |
|
|
Training history: a dict with |
|
|
The learning rate of every optimizer step, as a list |
|
|
Training, validation and test rows ( |
Written by |
|
Training plots |
Written by |
|
Evaluation plots |
Written by |
With training.ema_decay, both weight files hold the averaged weights. The
.pkl files are pickles: load only files that you trust.
With training.save_every: N, training also writes
<output_dir>/<name>/epoch_<N>/ every N epochs. Each holds
model_epoch_<N>.pth (the weights at that epoch),
best_model_epoch_<N>.pth (the best weights so far), config.yaml,
normalizer.pkl, history_train_val.pkl and learning_rates.pkl, but no
calibration factors. Pass the weights file to
load_checkpoint() with model_file.
Old checkpoints lists how directories from older versions load.
Predictions CSV¶
dorothy predict writes one row per spectrum, in the order of the input
file.
Column |
Content |
|---|---|
|
The ID of the spectrum (see FITS input) |
|
The prediction, one column per parameter in the catalogue’s order |
|
Its uncertainty: the calibration factor times the predicted scatter, or the predicted scatter alone |
|
|
The values are in physical units, the units of the catalogue’s labels, with
Teff in K. With --normalized they are in normalized units.
FITS input¶
dorothy predict reads binary-table extensions by name, with one row per
spectrum.
Extension |
Column |
Required |
Content |
|---|---|---|---|
|
|
yes |
Flux, one array of n_wavelengths per row |
|
|
yes |
Inverse variance, same shape |
|
|
no |
The star IDs |
|
the first column |
no |
The star IDs, read when there is no |
|
|
no |
The wavelength grid; not used for prediction |
The spectra must be on the wavelength grid of the model’s survey in the catalogue. The command checks only the number of bins.
A pixel is valid when its flux is finite and its ivar is finite and positive; other pixels are masked.
Without an ID column,
star_idis the row number, from 0.The reader takes one
SPECTRAextension. For LAMOST MRS, write the blue arm followed by the red arm in oneFLUXrow, each trimmed to its own wavelength grid, as the catalogue loader joins them.