LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.jointcal.jointcal.JointcalTask Class Reference
Inheritance diagram for lsst.jointcal.jointcal.JointcalTask:

Public Member Functions

def __init__ (self, butler=None, initInputs=None, **kwargs)
 
def runQuantum (self, butlerQC, inputRefs, outputRefs)
 
def run (self, inputSourceTableVisit, inputVisitSummary, inputCamera, tract=None)
 
def loadData (self, dataRefs, associations, jointcalControl)
 
def runDataRef (self, dataRefs)
 

Public Attributes

 astrometryRefObjLoader
 
 photometryRefObjLoader
 
 job
 
 focalPlaneBBox
 

Static Public Attributes

 ConfigClass = JointcalConfig
 
 RunnerClass = JointcalRunner
 

Detailed Description

Astrometricly and photometricly calibrate across multiple visits of the
same field.

Parameters
----------
butler : `lsst.daf.persistence.Butler`
    The butler is passed to the refObjLoader constructor in case it is
    needed. Ignored if the refObjLoader argument provides a loader directly.
    Used to initialize the astrometry and photometry refObjLoaders.
initInputs : `dict`, optional
    Dictionary used to initialize PipelineTasks (empty for jointcal).

Definition at line 654 of file jointcal.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.jointcal.jointcal.JointcalTask.__init__ (   self,
  butler = None,
  initInputs = None,
**  kwargs 
)

Definition at line 672 of file jointcal.py.

672  def __init__(self, butler=None, initInputs=None, **kwargs):
673  super().__init__(**kwargs)
674  self.makeSubtask("sourceSelector")
675  if self.config.doAstrometry:
676  if initInputs is None:
677  # gen3 middleware does refcat things internally (and will not have a butler here)
678  self.makeSubtask('astrometryRefObjLoader', butler=butler)
679  self.makeSubtask("astrometryReferenceSelector")
680  else:
681  self.astrometryRefObjLoader = None
682  if self.config.doPhotometry:
683  if initInputs is None:
684  # gen3 middleware does refcat things internally (and will not have a butler here)
685  self.makeSubtask('photometryRefObjLoader', butler=butler)
686  self.makeSubtask("photometryReferenceSelector")
687  else:
688  self.photometryRefObjLoader = None
689 
690  # To hold various computed metrics for use by tests
691  self.job = Job.load_metrics_package(subset='jointcal')
692 

Member Function Documentation

◆ loadData()

def lsst.jointcal.jointcal.JointcalTask.loadData (   self,
  dataRefs,
  associations,
  jointcalControl 
)
Read the data that jointcal needs to run. (Gen2 version)

Definition at line 1135 of file jointcal.py.

1135  def loadData(self, dataRefs, associations, jointcalControl):
1136  """Read the data that jointcal needs to run. (Gen2 version)"""
1137  visit_ccd_to_dataRef = {}
1138  oldWcsList = []
1139  filters = []
1140  load_cat_prof_file = 'jointcal_loadData.prof' if self.config.detailedProfile else ''
1141  with pipeBase.cmdLineTask.profile(load_cat_prof_file):
1142  # Need the bounding-box of the focal plane (the same for all visits) for photometry visit models
1143  camera = dataRefs[0].get('camera', immediate=True)
1144  self.focalPlaneBBox = camera.getFpBBox()
1145  for dataRef in dataRefs:
1146  data = self._readDataId(dataRef.getButler(), dataRef.dataId)
1147  result = self._build_ccdImage(data, associations, jointcalControl)
1148  if result is None:
1149  continue
1150  oldWcsList.append(result.wcs)
1151  visit_ccd_to_dataRef[result.key] = dataRef
1152  filters.append(data.filter)
1153  if len(filters) == 0:
1154  raise RuntimeError("No data to process: did source selector remove all sources?")
1155  filters = collections.Counter(filters)
1156 
1157  return oldWcsList, filters, visit_ccd_to_dataRef
1158 

◆ run()

def lsst.jointcal.jointcal.JointcalTask.run (   self,
  inputSourceTableVisit,
  inputVisitSummary,
  inputCamera,
  tract = None 
)

Definition at line 797 of file jointcal.py.

797  def run(self, inputSourceTableVisit, inputVisitSummary, inputCamera, tract=None):
798  # Docstring inherited.
799 
800  # We take values out of the Parquet table, and put them in "flux_",
801  # and the config.sourceFluxType field is used during that extraction,
802  # so just use "flux" here.
803  sourceFluxField = "flux"
804  jointcalControl = lsst.jointcal.JointcalControl(sourceFluxField)
805  associations = lsst.jointcal.Associations()
806  self.focalPlaneBBox = inputCamera.getFpBBox()
807  oldWcsList, bands = self._load_data(inputSourceTableVisit,
808  inputVisitSummary,
809  associations,
810  jointcalControl,
811  inputCamera)
812 
813  boundingCircle, center, radius, defaultFilter, epoch = self._prep_sky(associations, bands)
814 
815  if self.config.doAstrometry:
816  astrometry = self._do_load_refcat_and_fit(associations, defaultFilter, center, radius,
817  name="astrometry",
818  refObjLoader=self.astrometryRefObjLoader,
819  referenceSelector=self.astrometryReferenceSelector,
820  fit_function=self._fit_astrometry,
821  tract=tract,
822  epoch=epoch)
823  astrometry_output = self._make_output(associations.getCcdImageList(),
824  astrometry.model,
825  "makeSkyWcs")
826  else:
827  astrometry_output = None
828 
829  if self.config.doPhotometry:
830  photometry = self._do_load_refcat_and_fit(associations, defaultFilter, center, radius,
831  name="photometry",
832  refObjLoader=self.photometryRefObjLoader,
833  referenceSelector=self.photometryReferenceSelector,
834  fit_function=self._fit_photometry,
835  tract=tract,
836  epoch=epoch,
837  reject_bad_fluxes=True)
838  photometry_output = self._make_output(associations.getCcdImageList(),
839  photometry.model,
840  "toPhotoCalib")
841  else:
842  photometry_output = None
843 
844  return pipeBase.Struct(outputWcs=astrometry_output,
845  outputPhotoCalib=photometry_output,
846  job=self.job,
847  astrometryRefObjLoader=self.astrometryRefObjLoader,
848  photometryRefObjLoader=self.photometryRefObjLoader)
849 
The class that implements the relations between MeasuredStar and FittedStar.
Definition: Associations.h:54
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

◆ runDataRef()

def lsst.jointcal.jointcal.JointcalTask.runDataRef (   self,
  dataRefs 
)
Jointly calibrate the astrometry and photometry across a set of images.

NOTE: this is for gen2 middleware only.

Parameters
----------
dataRefs : `list` of `lsst.daf.persistence.ButlerDataRef`
    List of data references to the exposures to be fit.

Returns
-------
result : `lsst.pipe.base.Struct`
    Struct of metadata from the fit, containing:

    ``dataRefs``
        The provided data references that were fit (with updated WCSs)
    ``oldWcsList``
        The original WCS from each dataRef
    ``metrics``
        Dictionary of internally-computed metrics for testing/validation.

Definition at line 1187 of file jointcal.py.

1187  def runDataRef(self, dataRefs):
1188  """
1189  Jointly calibrate the astrometry and photometry across a set of images.
1190 
1191  NOTE: this is for gen2 middleware only.
1192 
1193  Parameters
1194  ----------
1195  dataRefs : `list` of `lsst.daf.persistence.ButlerDataRef`
1196  List of data references to the exposures to be fit.
1197 
1198  Returns
1199  -------
1200  result : `lsst.pipe.base.Struct`
1201  Struct of metadata from the fit, containing:
1202 
1203  ``dataRefs``
1204  The provided data references that were fit (with updated WCSs)
1205  ``oldWcsList``
1206  The original WCS from each dataRef
1207  ``metrics``
1208  Dictionary of internally-computed metrics for testing/validation.
1209  """
1210  if len(dataRefs) == 0:
1211  raise ValueError('Need a non-empty list of data references!')
1212 
1213  exitStatus = 0 # exit status for shell
1214 
1215  sourceFluxField = "slot_%sFlux" % (self.config.sourceFluxType,)
1216  jointcalControl = lsst.jointcal.JointcalControl(sourceFluxField)
1217  associations = lsst.jointcal.Associations()
1218 
1219  oldWcsList, filters, visit_ccd_to_dataRef = self.loadData(dataRefs,
1220  associations,
1221  jointcalControl)
1222 
1223  boundingCircle, center, radius, defaultFilter, epoch = self._prep_sky(associations, filters)
1224 
1225  tract = dataRefs[0].dataId['tract']
1226 
1227  if self.config.doAstrometry:
1228  astrometry = self._do_load_refcat_and_fit(associations, defaultFilter, center, radius,
1229  name="astrometry",
1230  refObjLoader=self.astrometryRefObjLoader,
1231  referenceSelector=self.astrometryReferenceSelector,
1232  fit_function=self._fit_astrometry,
1233  tract=tract,
1234  epoch=epoch)
1235  self._write_astrometry_results(associations, astrometry.model, visit_ccd_to_dataRef)
1236  else:
1237  astrometry = Astrometry(None, None, None)
1238 
1239  if self.config.doPhotometry:
1240  photometry = self._do_load_refcat_and_fit(associations, defaultFilter, center, radius,
1241  name="photometry",
1242  refObjLoader=self.photometryRefObjLoader,
1243  referenceSelector=self.photometryReferenceSelector,
1244  fit_function=self._fit_photometry,
1245  tract=tract,
1246  epoch=epoch,
1247  reject_bad_fluxes=True)
1248  self._write_photometry_results(associations, photometry.model, visit_ccd_to_dataRef)
1249  else:
1250  photometry = Photometry(None, None)
1251 
1252  return pipeBase.Struct(dataRefs=dataRefs,
1253  oldWcsList=oldWcsList,
1254  job=self.job,
1255  astrometryRefObjLoader=self.astrometryRefObjLoader,
1256  photometryRefObjLoader=self.photometryRefObjLoader,
1257  defaultFilter=defaultFilter,
1258  epoch=epoch,
1259  exitStatus=exitStatus)
1260 

◆ runQuantum()

def lsst.jointcal.jointcal.JointcalTask.runQuantum (   self,
  butlerQC,
  inputRefs,
  outputRefs 
)

Definition at line 693 of file jointcal.py.

693  def runQuantum(self, butlerQC, inputRefs, outputRefs):
694  # We override runQuantum to set up the refObjLoaders and write the
695  # outputs to the correct refs.
696  inputs = butlerQC.get(inputRefs)
697  # We want the tract number for writing debug files
698  tract = butlerQC.quantum.dataId['tract']
699  if self.config.doAstrometry:
700  self.astrometryRefObjLoader = ReferenceObjectLoader(
701  dataIds=[ref.datasetRef.dataId
702  for ref in inputRefs.astrometryRefCat],
703  refCats=inputs.pop('astrometryRefCat'),
704  config=self.config.astrometryRefObjLoader,
705  log=self.log)
706  if self.config.doPhotometry:
707  self.photometryRefObjLoader = ReferenceObjectLoader(
708  dataIds=[ref.datasetRef.dataId
709  for ref in inputRefs.photometryRefCat],
710  refCats=inputs.pop('photometryRefCat'),
711  config=self.config.photometryRefObjLoader,
712  log=self.log)
713  outputs = self.run(**inputs, tract=tract)
714  self._put_metrics(butlerQC, outputs.job, outputRefs)
715  if self.config.doAstrometry:
716  self._put_output(butlerQC, outputs.outputWcs, outputRefs.outputWcs,
717  inputs['inputCamera'], "setWcs")
718  if self.config.doPhotometry:
719  self._put_output(butlerQC, outputs.outputPhotoCalib, outputRefs.outputPhotoCalib,
720  inputs['inputCamera'], "setPhotoCalib")
721 

Member Data Documentation

◆ astrometryRefObjLoader

lsst.jointcal.jointcal.JointcalTask.astrometryRefObjLoader

Definition at line 681 of file jointcal.py.

◆ ConfigClass

lsst.jointcal.jointcal.JointcalTask.ConfigClass = JointcalConfig
static

Definition at line 668 of file jointcal.py.

◆ focalPlaneBBox

lsst.jointcal.jointcal.JointcalTask.focalPlaneBBox

Definition at line 806 of file jointcal.py.

◆ job

lsst.jointcal.jointcal.JointcalTask.job

Definition at line 691 of file jointcal.py.

◆ photometryRefObjLoader

lsst.jointcal.jointcal.JointcalTask.photometryRefObjLoader

Definition at line 688 of file jointcal.py.

◆ RunnerClass

lsst.jointcal.jointcal.JointcalTask.RunnerClass = JointcalRunner
static

Definition at line 669 of file jointcal.py.


The documentation for this class was generated from the following file: