autolens.twins.SimulatedTwin#
- class SimulatedTwin[source]#
Bases:
FrozenA simulated observation of
twin.- Parameters:
dataset (
Imaging) – The simulatedal.Imaging, masked and over-sampled like the twin’s setup.truth – The ground-truth tracer that was observed (
twin.tracer).seed (
int) – The noise seed.noise (
str) –"observed"or"poisson".simulator (
Dict) – The route and settings used (route,exposure_time, …).twin (
Twin) – The twin that was simulated.
Methods
The
autonerves.dictabledictionary.Reload a simulated twin written by
output_to.Write the observation and everything needed to reproduce it:
Simulate the same twin again with the stored seed and noise route.
The provenance written to
twin.json: the reference provenance (lens id, fit path, hashes, ingest time, labels, roles, library versions at ingest), the library versions now, the transformation records (dictable dictionaries), the setup fields that differ from the reference setup, and the seed, noise route and simulator settings.- dict()[source]#
The
autonerves.dictabledictionary.al.Imagingdoes not round-trip through the dictable contract, so thedatasetargument is written as a call ofdataset_via_setup_from(a functional.from_dictresolves by class path and calls with its arguments) holding the setup, data and noise map; reloading rebuilds the masked, over-sampled dataset withObservationSetup.dataset_from.
- twin_json()[source]#
The provenance written to
twin.json: the reference provenance (lens id, fit path, hashes, ingest time, labels, roles, library versions at ingest), the library versions now, the transformation records (dictable dictionaries), the setup fields that differ from the reference setup, and the seed, noise route and simulator settings."truth"lists, flat and in chain order, the ground-truth parameters each transformation reports (TransformationRecord.truth), each with its"transformation"name and"record_index"; records with none are skipped.
- output_to(directory)[source]#
Write the observation and everything needed to reproduce it:
data.fits,noise_map.fits,psf.fits,mask.fits: native arrays (no visualisation zoom) with the mask’s pixel scales in the header.truth_tracer.json: the ground truth.twin.json: seetwin_json.setup.json: the twin’s complete setup. The FITS files alone cannot rebuild it (over-sampling, cosmology, exposure time and sky level are not in them, and a Poisson noise map differs from the setup’s).reference_setup.json/reference_tracer.json: only when the twin’s setup / tracer differ from the reference’s, so the reference can be rebuilt without the original fit directory.
- classmethod from_directory(directory)[source]#
Reload a simulated twin written by
output_to.The reference is resolved from its
fit_pathwhen that directory still holds adataset.fitsandtracer.jsonwhose SHA-256 match the stored provenance (setup fields not in the FITS are taken from the stored reference setup); otherwise it is rebuilt from the embedded provenance, the stored reference tracer (or the truth tracer, when they are the same) and the stored reference setup (or the twin setup).