autolens.twins.ReferenceModel#

class ReferenceModel[source]#

Bases: Frozen

A fitted lens frozen as the parent of twins.

Attribute assignment raises. provenance is returned as a copy, so the stored record cannot be edited through it. The tracer and setup are shared objects and must be treated as read-only; Twin.baseline takes its own copy of the tracer.

Parameters:
  • tracer – The maximum-likelihood al.Tracer with solved linear intensities.

  • setup (ObservationSetup) – How the lens was observed.

  • provenance (Dict) – lens_id, labels, roles (galaxy name -> role), fit_path, dataset_sha256, tracer_sha256, ingested_at (ISO-8601 UTC) and versions (library and Python versions); see provenance_from.

Methods

from_directory

Reload a reference written by output_to.

from_fit_directory

Ingest a model-fit output directory (the folder holding files/tracer.json and image/dataset.fits).

from_result

Ingest an in-memory result and the dataset it fitted.

output_to

Write tracer.json, setup/ (mask.fits, noise_map.fits, psf.fits for inspection and setup.json, the complete setup that from_directory reads), provenance.json and labels.yaml.

Attributes

property provenance: Dict#
property lens_id: str#
classmethod from_fit_directory(path, lens_id, labels=(), roles=None)[source]#

Ingest a model-fit output directory (the folder holding files/tracer.json and image/dataset.fits). The tracer is loaded from tracer.json and therefore carries the solved linear intensities; the hashes are of the two files’ bytes.

classmethod from_result(result, dataset, lens_id, labels=(), roles=None, fit_path=None)[source]#

Ingest an in-memory result and the dataset it fitted. With no files to hash, dataset_sha256 hashes the native data, noise map, PSF kernel and mask arrays and tracer_sha256 hashes the tracer’s canonical dictable JSON.

output_to(directory)[source]#

Write tracer.json, setup/ (mask.fits, noise_map.fits, psf.fits for inspection and setup.json, the complete setup that from_directory reads), provenance.json and labels.yaml.

classmethod from_directory(directory)[source]#

Reload a reference written by output_to.