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 | List of all members
lsst.ip.diffim.utils.DipoleTestImage Class Reference
Inheritance diagram for lsst.ip.diffim.utils.DipoleTestImage:

Public Member Functions

def __init__ (self, w=101, h=101, xcenPos=[27.], ycenPos=[25.], xcenNeg=[23.], ycenNeg=[25.], psfSigma=2., flux=[30000.], fluxNeg=None, noise=10., gradientParams=None)
 
def fitDipoleSource (self, source, **kwds)
 
def detectDipoleSources (self, doMerge=True, diffim=None, detectSigma=5.5, grow=3, minBinSize=32)
 

Public Attributes

 w
 
 h
 
 xcenPos
 
 ycenPos
 
 xcenNeg
 
 ycenNeg
 
 psfSigma
 
 flux
 
 fluxNeg
 
 noise
 
 gradientParams
 

Detailed Description

Utility class for dipole measurement testing.

Generate an image with simulated dipoles and noise; store the original
"pre-subtraction" images and catalogs as well.
Used to generate test data for DMTN-007 (http://dmtn-007.lsst.io).

Definition at line 924 of file utils.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.ip.diffim.utils.DipoleTestImage.__init__ (   self,
  w = 101,
  h = 101,
  xcenPos = [27.],
  ycenPos = [25.],
  xcenNeg = [23.],
  ycenNeg = [25.],
  psfSigma = 2.,
  flux = [30000.],
  fluxNeg = None,
  noise = 10.,
  gradientParams = None 
)

Definition at line 932 of file utils.py.

933  psfSigma=2., flux=[30000.], fluxNeg=None, noise=10., gradientParams=None):
934  self.w = w
935  self.h = h
936  self.xcenPos = xcenPos
937  self.ycenPos = ycenPos
938  self.xcenNeg = xcenNeg
939  self.ycenNeg = ycenNeg
940  self.psfSigma = psfSigma
941  self.flux = flux
942  self.fluxNeg = fluxNeg
943  if fluxNeg is None:
944  self.fluxNeg = self.flux
945  self.noise = noise
946  self.gradientParams = gradientParams
947  self._makeDipoleImage()
948 

Member Function Documentation

◆ detectDipoleSources()

def lsst.ip.diffim.utils.DipoleTestImage.detectDipoleSources (   self,
  doMerge = True,
  diffim = None,
  detectSigma = 5.5,
  grow = 3,
  minBinSize = 32 
)
Utility function for detecting dipoles.

Detect pos/neg sources in the diffim, then merge them. A
bigger "grow" parameter leads to a larger footprint which
helps with dipole measurement for faint dipoles.

Parameters
----------
doMerge : `bool`
   Whether to merge the positive and negagive detections into a single
   source table.
diffim : `lsst.afw.image.exposure.exposure.ExposureF`
   Difference image on which to perform detection.
detectSigma : `float`
   Threshold for object detection.
grow : `int`
   Number of pixels to grow the footprints before merging.
minBinSize : `int`
   Minimum bin size for the background (re)estimation (only applies if
   the default leads to min(nBinX, nBinY) < fit order so the default
   config parameter needs to be decreased, but not to a value smaller
   than ``minBinSize``, in which case the fitting algorithm will take
   over and decrease the fit order appropriately.)

Returns
-------
sources : `lsst.afw.table.SourceCatalog`
   If doMerge=True, the merged source catalog is returned OR
detectTask : `lsst.meas.algorithms.SourceDetectionTask`
schema : `lsst.afw.table.Schema`
   If doMerge=False, the source detection task and its schema are
   returned.

Definition at line 1005 of file utils.py.

1005  def detectDipoleSources(self, doMerge=True, diffim=None, detectSigma=5.5, grow=3, minBinSize=32):
1006  """Utility function for detecting dipoles.
1007 
1008  Detect pos/neg sources in the diffim, then merge them. A
1009  bigger "grow" parameter leads to a larger footprint which
1010  helps with dipole measurement for faint dipoles.
1011 
1012  Parameters
1013  ----------
1014  doMerge : `bool`
1015  Whether to merge the positive and negagive detections into a single
1016  source table.
1017  diffim : `lsst.afw.image.exposure.exposure.ExposureF`
1018  Difference image on which to perform detection.
1019  detectSigma : `float`
1020  Threshold for object detection.
1021  grow : `int`
1022  Number of pixels to grow the footprints before merging.
1023  minBinSize : `int`
1024  Minimum bin size for the background (re)estimation (only applies if
1025  the default leads to min(nBinX, nBinY) < fit order so the default
1026  config parameter needs to be decreased, but not to a value smaller
1027  than ``minBinSize``, in which case the fitting algorithm will take
1028  over and decrease the fit order appropriately.)
1029 
1030  Returns
1031  -------
1032  sources : `lsst.afw.table.SourceCatalog`
1033  If doMerge=True, the merged source catalog is returned OR
1034  detectTask : `lsst.meas.algorithms.SourceDetectionTask`
1035  schema : `lsst.afw.table.Schema`
1036  If doMerge=False, the source detection task and its schema are
1037  returned.
1038  """
1039  if diffim is None:
1040  diffim = self.diffim
1041 
1042  # Start with a minimal schema - only the fields all SourceCatalogs need
1043  schema = afwTable.SourceTable.makeMinimalSchema()
1044 
1045  # Customize the detection task a bit (optional)
1046  detectConfig = measAlg.SourceDetectionConfig()
1047  detectConfig.returnOriginalFootprints = False # should be the default
1048 
1049  psfSigma = diffim.getPsf().computeShape().getDeterminantRadius()
1050 
1051  # code from imageDifference.py:
1052  detectConfig.thresholdPolarity = "both"
1053  detectConfig.thresholdValue = detectSigma
1054  # detectConfig.nSigmaToGrow = psfSigma
1055  detectConfig.reEstimateBackground = True # if False, will fail often for faint sources on gradients?
1056  detectConfig.thresholdType = "pixel_stdev"
1057  # Test images are often quite small, so may need to adjust background binSize
1058  while ((min(diffim.getWidth(), diffim.getHeight()))//detectConfig.background.binSize
1059  < detectConfig.background.approxOrderX and detectConfig.background.binSize > minBinSize):
1060  detectConfig.background.binSize = max(minBinSize, detectConfig.background.binSize//2)
1061 
1062  # Create the detection task. We pass the schema so the task can declare a few flag fields
1063  detectTask = measAlg.SourceDetectionTask(schema, config=detectConfig)
1064 
1065  table = afwTable.SourceTable.make(schema)
1066  catalog = detectTask.run(table, diffim, sigma=psfSigma)
1067 
1068  # Now do the merge.
1069  if doMerge:
1070  fpSet = catalog.fpSets.positive
1071  fpSet.merge(catalog.fpSets.negative, grow, grow, False)
1072  sources = afwTable.SourceCatalog(table)
1073  fpSet.makeSources(sources)
1074 
1075  return sources
1076 
1077  else:
1078  return detectTask, schema
int min
int max

◆ fitDipoleSource()

def lsst.ip.diffim.utils.DipoleTestImage.fitDipoleSource (   self,
  source,
**  kwds 
)

Definition at line 1000 of file utils.py.

1000  def fitDipoleSource(self, source, **kwds):
1001  alg = DipoleFitAlgorithm(self.diffim, self.posImage, self.negImage)
1002  fitResult = alg.fitDipole(source, **kwds)
1003  return fitResult
1004 

Member Data Documentation

◆ flux

lsst.ip.diffim.utils.DipoleTestImage.flux

Definition at line 941 of file utils.py.

◆ fluxNeg

lsst.ip.diffim.utils.DipoleTestImage.fluxNeg

Definition at line 942 of file utils.py.

◆ gradientParams

lsst.ip.diffim.utils.DipoleTestImage.gradientParams

Definition at line 946 of file utils.py.

◆ h

lsst.ip.diffim.utils.DipoleTestImage.h

Definition at line 935 of file utils.py.

◆ noise

lsst.ip.diffim.utils.DipoleTestImage.noise

Definition at line 945 of file utils.py.

◆ psfSigma

lsst.ip.diffim.utils.DipoleTestImage.psfSigma

Definition at line 940 of file utils.py.

◆ w

lsst.ip.diffim.utils.DipoleTestImage.w

Definition at line 934 of file utils.py.

◆ xcenNeg

lsst.ip.diffim.utils.DipoleTestImage.xcenNeg

Definition at line 938 of file utils.py.

◆ xcenPos

lsst.ip.diffim.utils.DipoleTestImage.xcenPos

Definition at line 936 of file utils.py.

◆ ycenNeg

lsst.ip.diffim.utils.DipoleTestImage.ycenNeg

Definition at line 939 of file utils.py.

◆ ycenPos

lsst.ip.diffim.utils.DipoleTestImage.ycenPos

Definition at line 937 of file utils.py.


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