Skip to content

Setting polarity to "positive" in DetectAndMeasureConfig() results in an error due to deblending #404

Description

@peppedilillo

Dears. Consider this snippet:

config = DetectAndMeasureConfig()
config.detection.thresholdValue = 5.
# the next line should select only positive sources but it's causing an error. maybe open an issue
# config.detection.thresholdPolarity = "positive"
results = DetectAndMeasureTask(config=config).run(calexp_injected, template, calexp_difference)

Setting thresholdPolarity to "positive" result in an error which seems to be due to the deblending task not checking for empty negatives.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[120], line 5
      3 # the next line should select only positive sources but it's causing an error. maybe open an issue
      4 config.detection.thresholdPolarity = "positive"
----> 5 results = DetectAndMeasureTask(config=config).run(calexp_injected, template, calexp_difference)

File [/opt/lsst/software/stack/conda/envs/lsst-scipipe-10.0.0/share/eups/Linux64/utils/ge138a012be](https://data.lsst.cloud/opt/lsst/software/stack/conda/envs/lsst-scipipe-10.0.0/share/eups/Linux64/utils/ge138a012be)+fcb1d3bbc8[/python/lsst/utils/timer.py:307](https://data.lsst.cloud/python/lsst/utils/timer.py#line=306), in timeMethod.<locals>.decorator_timer.<locals>.timeMethod_wrapper(self, *args, **keyArgs)
    298 logInfo(
    299     obj=self,
    300     prefix=func.__name__ + "Start",
   (...)
    304     stacklevel=stacklevel,
    305 )
    306 try:
--> 307     res = func(self, *args, **keyArgs)
    308 finally:
    309     logInfo(
    310         obj=self,
    311         prefix=func.__name__ + "End",
   (...)
    315         stacklevel=stacklevel,
    316     )

File [/opt/lsst/software/stack/conda/envs/lsst-scipipe-10.0.0/share/eups/Linux64/ip_diffim/g216c3ac8a7](https://data.lsst.cloud/opt/lsst/software/stack/conda/envs/lsst-scipipe-10.0.0/share/eups/Linux64/ip_diffim/g216c3ac8a7)+b9c470ee50[/python/lsst/ip/diffim/detectAndMeasure.py:414](https://data.lsst.cloud/python/lsst/ip/diffim/detectAndMeasure.py#line=413), in DetectAndMeasureTask.run(self, science, matchedTemplate, difference, idFactory)
    412 results.positive.makeSources(positives)
    413 negatives = afwTable.SourceCatalog(self.schema)
--> 414 results.negative.makeSources(negatives)
    415 return self.processResults(science, matchedTemplate, difference,
    416                            results.sources, idFactory,
    417                            positives=positives,
    418                            negatives=negatives)

AttributeError: 'NoneType' object has no attribute 'makeSources'

I got this on the VM Weekly 2025_17 [f02e0429...] (sciplat-lab:w_2025_17) Medium (2.0 CPU, 8Gi RAM) data.lsst.cloud.

Hope that's useful.

Ciao,
Peppe

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions