Class PhotometryModel

Inheritance Relationships

Derived Types

Class Documentation

class PhotometryModel

Subclassed by lsst::jointcal::ConstrainedPhotometryModel, lsst::jointcal::SimplePhotometryModel

Public Functions

PhotometryModel(LOG_LOGGER log, double errorPedestal_ = 0)

Parameters
  • log: Logger to send messages to, to keep names consistent when logging.

  • errorPedestal_: Pedestal on flux/magnitude error (percent of flux or delta magnitude).

virtual Eigen::Index assignIndices(std::string const &whatToFit, Eigen::Index firstIndex) = 0

Assign indices in the full matrix to the parameters being fit in the mappings, starting at firstIndex.

Return

The highest assigned index.

Parameters
  • [in] whatToFit: String containing parameters to fit.

  • [in] firstIndex: Index to start assigning at.

virtual void offsetParams(Eigen::VectorXd const &delta) = 0

Offset the parameters by the provided amounts (by -delta).

The shifts are applied according to the indices given in assignIndices.

Parameters
  • [in] delta: vector of offsets to apply

virtual void offsetFittedStar(FittedStar &fittedStar, double delta) const = 0

Offset the appropriate flux or magnitude (by -delta).

Parameters
  • fittedStar: The star to update.

  • delta: The amount to update by.

virtual double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const = 0

Compute the residual between the model applied to a star and its associated fittedStar.

\[ residual = Model(measuredStar) - fittedStar \]

Return

The residual.

Parameters
  • ccdImage: The ccdImage where measuredStar resides.

  • measuredStar: The measured star position to compute the residual of.

virtual double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const = 0

Return the on-sky transformed flux for measuredStar on ccdImage.

Return

The on-sky flux transformed from instFlux at measuredStar’s position.

Parameters
  • [in] ccdImage: The ccdImage where measuredStar resides.

  • measuredStar: The measured star position to transform.

virtual double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const = 0

Return the on-sky transformed flux uncertainty for measuredStar on ccdImage. Identical to transform() until freezeErrorTransform() is called.

Return

The on-sky flux transformed from instFlux at measuredStar’s position.

Parameters
  • [in] ccdImage: The ccdImage where measuredStar resides.

  • measuredStar: The measured star position to transform.

virtual void freezeErrorTransform() = 0

Once this routine has been called, the error transform is not modified by offsetParams().

The routine can be called when the mappings are roughly in place. After the call, the transformations used to propagate errors are no longer affected when updating the mappings. This allows an exactly linear fit, which can be necessary for some model+data combinations.

virtual void getMappingIndices(CcdImage const &ccdImage, IndexVector &indices) const = 0

Get how this set of parameters (of length Npar()) map into the “grand” fit.

Parameters
  • [in] ccdImage: The ccdImage to look up.

  • [out] indices: The indices of the mapping associated with ccdImage.

virtual void computeParameterDerivatives(MeasuredStar const &measuredStar, CcdImage const &ccdImage, Eigen::VectorXd &derivatives) const = 0

Compute the parametric derivatives of this model.

Parameters
  • [in] measuredStar: The measured star with the position and flux to compute at.

  • [in] ccdImage: The ccdImage containing the measured star, to find the correct mapping.

  • [out] derivatives: The computed derivatives. Must be pre-allocated to the correct size.

virtual double getRefError(RefStar const &refStar) const = 0

Return the refStar error appropriate for this model (e.g. fluxErr or magErr).

virtual double computeRefResidual(FittedStar const &fittedStar, RefStar const &refStar) const = 0

Return the fittedStar - refStar residual appropriate for this model (e.g. flux - flux or mag - mag).

virtual std::shared_ptr<afw::image::PhotoCalib> toPhotoCalib(CcdImage const &ccdImage) const = 0

Return the mapping of ccdImage represented as a PhotoCalib.

std::size_t getNpar(CcdImage const &ccdImage) const

Return the number of parameters in the mapping of CcdImage.

PhotometryMappingBase const &getMapping(CcdImage const &ccdImage) const

Get the mapping associated with ccdImage.

virtual std::size_t getTotalParameters() const = 0

Return the total number of parameters in this model.

virtual void dump(std::ostream &stream = std::cout) const = 0

Dump the contents of the transforms, for debugging.

bool validate(CcdImageList const &ccdImageList, int ndof) const

Return true if this is a “reasonable” model.

A valid photometry model is positive within each sensor’s bounding box.

Return

True if the model is valid on all ccdImages.

Parameters
  • ccdImageList: The ccdImages to test the model validity on.

  • ndof: The number of degrees of freedom in the fit, e.g. from Fitterbase.computeChi2().

bool checkPositiveOnBBox(CcdImage const &ccdImage) const

Check that the model is positive on the ccdImage bbox.

Return

True if the image is positive on a sampling of points of the ccdImage bbox.

Parameters
  • ccdImage: The ccdImage to test.

double getErrorPedestal()
double tweakFluxError(jointcal::MeasuredStar const &measuredStar) const

Add a fraction of the instrumental flux to the instrumental flux error, in quadrature.

double tweakMagnitudeError(jointcal::MeasuredStar const &measuredStar) const

Add a small magnitude offset to the “instrumental magnitude” error, in quadrature.

Protected Functions

virtual PhotometryMappingBase *findMapping(CcdImage const &ccdImage) const = 0

Return a pointer to the mapping associated with this ccdImage.

Protected Attributes

LOG_LOGGER _log

lsst.logging instance, to be created by a subclass so that messages have consistent name.

double errorPedestal

Friends

std::ostream &operator<<(std::ostream &s, PhotometryModel const &model)