Skip to content

panoptes.pipeline.settings

panoptes.pipeline.settings

StampSettings

Bases: BaseModel

How the observation-level stamp cube is cut.

Deliberately not part of PipelineParams, so it is not in the per-frame fingerprint: a stamp size changes the cube and nothing else, and folding it into the frame fingerprint would make every frame look stale -- a full re-solve of the sequence -- for a change that touches no frame. The cube records these settings, and the frames' fingerprint, in its own metadata.

Source code in src/panoptes/pipeline/settings.py
class StampSettings(BaseModel):
    """How the observation-level stamp cube is cut.

    Deliberately **not** part of `PipelineParams`, so it is not in the per-frame
    fingerprint: a stamp size changes the cube and nothing else, and folding it
    into the frame fingerprint would make every frame look stale -- a full
    re-solve of the sequence -- for a change that touches no frame. The cube
    records these settings, and the frames' fingerprint, in its own metadata.
    """

    #: Stamp width and height as a multiple of the sequence's median FWHM, in
    #: pixels, rounded up to a whole number of superpixels. The one algorithm
    #: parameter about the detector grid is that the result must be even, so
    #: every stamp carries the same Bayer phase; everything else is in FWHM
    #: units, per improvement plan 1.4.
    fwhm_multiple: float = 4.0
    #: Never cut a stamp smaller than this many pixels on a side, however sharp
    #: the sequence: a stamp has to hold a complete superpixel border around the
    #: star for the color masks to mean anything.
    min_size: int = 6
    #: A source must be matched in at least this fraction of the usable frames
    #: to get a stamp. Its stamp is then cut from *every* frame -- the position
    #: is a property of the sequence, and the pixels are there whether or not
    #: detection found the star that frame -- so this is a quality cut, not a
    #: completeness requirement. 1.0 is unusable on real data: over the 124
    #: frames of PAN012 2018-08-24 no star at all was matched in every frame,
    #: 9 were in 98% and 2,047 in 90%, because a handful of cloudy frames
    #: matched a few hundred stars instead of three thousand.
    min_frame_fraction: float = 0.9

PipelineParams

Bases: BaseSettings

Source code in src/panoptes/pipeline/settings.py
class PipelineParams(BaseSettings):
    camera: CameraSettings = CameraSettings()
    catalog: CatalogSettings = CatalogSettings()
    background: BackgroundSettings = BackgroundSettings()

    @property
    def fingerprint(self) -> str:
        """A short digest of every parameter that affects a product.

        This is the cache key, not decoration. The old flow stored `params` in
        every document and never compared them, so changing a setting left
        stale products behind with no signal that they no longer matched the
        settings that were supposed to have produced them. See data contract
        3.4.

        Keys are sorted so the digest depends on the values and not on field
        declaration order -- otherwise reordering a model would invalidate the
        entire archive.
        """
        canonical = json.dumps(json.loads(self.model_dump_json()), sort_keys=True)
        digest = hashlib.sha256(canonical.encode()).hexdigest()
        return digest[:FINGERPRINT_LENGTH]

fingerprint property

fingerprint: str

A short digest of every parameter that affects a product.

This is the cache key, not decoration. The old flow stored params in every document and never compared them, so changing a setting left stale products behind with no signal that they no longer matched the settings that were supposed to have produced them. See data contract 3.4.

Keys are sorted so the digest depends on the values and not on field declaration order -- otherwise reordering a model would invalidate the entire archive.