<div dir="ltr">I think this should be just a matter of setting<div><br></div><div><span style="font-size:12.8000001907349px">detectSourcesConfig.reEstimateBackground = False</span><br></div><div><br></div><div><br></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Jim</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 11, 2015 at 5:41 PM, Will Dawson <span dir="ltr"><<a href="mailto:will@dawsonresearch.com" target="_blank">will@dawsonresearch.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I am trying to use DM Stack detect and analyze in object in a small postage stamp (see attached example, log scale). I know I can use lsst.afw.detection.Threshold() with lsst.afw.detection.FootprintSet() to create a footprint for the detected object. But I also (first) tried lsst.meas.algorithms.SourceDetectionTask(config=detectSourcesConfig, "other args") with config set as:<div><br><div>detectSourcesConfig   = measAlg.SourceDetectionConfig(thresholdType='value’)</div><div>or</div><div>detectSourcesConfig   = measAlg.SourceDetectionConfig(thresholdType='value',thresholdValue=0)</div><div><br></div><div>and got the error at the end of this email. I am not entirely sure how to parse this error statement, but if I had to guess: no objects are being detected because it is trying to estimate the background based on this stamp which contains primary just the object thus when it does image - background there is nothing above threshold left to detect. Or it chokes when trying to estimate the background.</div><div><div><br></div><div>Is there an option to run lsst.meas.algorithms.SourceDetectionTask with the background estimation/ subtraction process turned off? For example when detecting objects on an image that already has the background subtracted. Perhaps the only option is to stick with the detection.FootprintSet method. </div><div><br></div><div>Thanks,</div><div>Will</div><div><br><div><br></div><div> <img height="252" width="303" src="cid:07C12B78-8C24-473E-AF09-D46481010D52@physics.ucdavis.edu"></div></div><div><br></div><div><pre style="overflow:auto;font-size:14px;padding:0px;margin-top:0px;margin-bottom:0px;line-height:17.000059127807617px;word-break:break-all;word-wrap:break-word;border:0px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;white-space:pre-wrap;vertical-align:baseline"><span style="color:rgb(139,0,0)">---------------------------------------------------------------------------</span>
<span style="color:rgb(139,0,0)">InvalidParameterError</span>                     Traceback (most recent call last)
<span style="color:rgb(0,100,0)"><ipython-input-66-d08d86b9540f></span> in <span style="color:rgb(70,130,180)"><module><span style="color:rgb(0,0,139)">()</span>
<span style="color:rgb(0,100,0)">      2</span> <span style="color:rgb(139,0,0)"># catalog atually stores stuff)</span><span style="color:rgb(0,0,139)"></span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">      3</span> table   <span style="color:rgb(0,0,139)">=</span> afwTable<span style="color:rgb(0,0,139)">.</span>SourceTable<span style="color:rgb(0,0,139)">.</span>make<span style="color:rgb(0,0,139)">(</span>schema<span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">----> 4<span style="color:rgb(139,0,0)"> </span>catalog <span style="color:rgb(0,0,139)">=</span> detect<span style="color:rgb(0,0,139)">.</span>makeSourceCatalog<span style="color:rgb(0,0,139)">(</span>table<span style="color:rgb(0,0,139)">,</span> exposure<span style="color:rgb(0,0,139)">,</span> sigma<span style="color:rgb(0,0,139)">=</span><span style="color:rgb(70,130,180)">3</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>

<span>/Users/dawson/lsst/DarwinX86/pipe_base/10.0+2/python/lsst/pipe/base/timer.pyc</span> in <span style="color:rgb(70,130,180)">wrapper<span style="color:rgb(0,0,139)">(self, *args, **keyArgs)</span>
<span style="color:rgb(0,100,0)">    116</span>         logInfo<span style="color:rgb(0,0,139)">(</span>obj <span style="color:rgb(0,0,139)">=</span> self<span style="color:rgb(0,0,139)">,</span> prefix <span style="color:rgb(0,0,139)">=</span> func<span style="color:rgb(0,0,139)">.</span>__name__ <span style="color:rgb(0,0,139)">+</span> <span style="color:rgb(0,0,139)">"Start"</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">    117</span>         <span style="color:rgb(0,100,0)">try</span><span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">--> 118<span style="color:rgb(139,0,0)">             </span>res <span style="color:rgb(0,0,139)">=</span> func<span style="color:rgb(0,0,139)">(</span>self<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">*</span>args<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">**</span>keyArgs<span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span>    119</span>         <span>finally</span><span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)"></span>
<span>    120</span>             logInfo<span style="color:rgb(0,0,139)">(</span>obj <span style="color:rgb(0,0,139)">=</span> self<span style="color:rgb(0,0,139)">,</span> prefix <span style="color:rgb(0,0,139)">=</span> func<span style="color:rgb(0,0,139)">.</span>__name__ <span style="color:rgb(0,0,139)">+</span> <span style="color:rgb(0,0,139)">"End"</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>

<span>/Users/dawson/lsst/DarwinX86/meas_algorithms/10.0+2/python/lsst/meas/algorithms/detection.pyc</span> in <span style="color:rgb(70,130,180)">run<span style="color:rgb(0,0,139)">(self, table, exposure, doSmooth, sigma, clearMask)</span>
<span style="color:rgb(0,100,0)">    313</span>             <span style="color:rgb(0,100,0)">raise</span> ValueError<span style="color:rgb(0,0,139)">(</span><span style="color:rgb(0,0,139)">"Table has incorrect Schema"</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">    314</span>         fpSets = self.detectFootprints(exposure=exposure, doSmooth=doSmooth, sigma=sigma,
<span style="color:rgb(0,100,0)">--> 315<span style="color:rgb(139,0,0)">                                        clearMask=clearMask)
</span><span>    316</span>         sources <span style="color:rgb(0,0,139)">=</span> afwTable<span style="color:rgb(0,0,139)">.</span>SourceCatalog<span style="color:rgb(0,0,139)">(</span>table<span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span>    317</span>         table<span style="color:rgb(0,0,139)">.</span>preallocate<span style="color:rgb(0,0,139)">(</span>fpSets<span style="color:rgb(0,0,139)">.</span>numPos <span style="color:rgb(0,0,139)">+</span> fpSets<span style="color:rgb(0,0,139)">.</span>numNeg<span style="color:rgb(0,0,139)">)</span> <span style="color:rgb(139,0,0)"># not required, but nice</span><span style="color:rgb(0,0,139)"></span>

<span>/Users/dawson/lsst/DarwinX86/pipe_base/10.0+2/python/lsst/pipe/base/timer.pyc</span> in <span style="color:rgb(70,130,180)">wrapper<span style="color:rgb(0,0,139)">(self, *args, **keyArgs)</span>
<span style="color:rgb(0,100,0)">    116</span>         logInfo<span style="color:rgb(0,0,139)">(</span>obj <span style="color:rgb(0,0,139)">=</span> self<span style="color:rgb(0,0,139)">,</span> prefix <span style="color:rgb(0,0,139)">=</span> func<span style="color:rgb(0,0,139)">.</span>__name__ <span style="color:rgb(0,0,139)">+</span> <span style="color:rgb(0,0,139)">"Start"</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">    117</span>         <span style="color:rgb(0,100,0)">try</span><span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">--> 118<span style="color:rgb(139,0,0)">             </span>res <span style="color:rgb(0,0,139)">=</span> func<span style="color:rgb(0,0,139)">(</span>self<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">*</span>args<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">**</span>keyArgs<span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span>    119</span>         <span>finally</span><span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)"></span>
<span>    120</span>             logInfo<span style="color:rgb(0,0,139)">(</span>obj <span style="color:rgb(0,0,139)">=</span> self<span style="color:rgb(0,0,139)">,</span> prefix <span style="color:rgb(0,0,139)">=</span> func<span style="color:rgb(0,0,139)">.</span>__name__ <span style="color:rgb(0,0,139)">+</span> <span style="color:rgb(0,0,139)">"End"</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>

<span>/Users/dawson/lsst/DarwinX86/meas_algorithms/10.0+2/python/lsst/meas/algorithms/detection.pyc</span> in <span style="color:rgb(70,130,180)">detectFootprints<span style="color:rgb(0,0,139)">(self, exposure, doSmooth, sigma, clearMask)</span>
<span style="color:rgb(0,100,0)">    443</span>             fpSets<span style="color:rgb(0,0,139)">.</span>background <span style="color:rgb(0,0,139)">=</span> bkgd<span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">    444</span>             self<span style="color:rgb(0,0,139)">.</span>log<span style="color:rgb(0,0,139)">.</span>log<span style="color:rgb(0,0,139)">(</span>self<span style="color:rgb(0,0,139)">.</span>log<span style="color:rgb(0,0,139)">.</span>INFO<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">"Resubtracting the background after object detection"</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">--> 445<span style="color:rgb(139,0,0)">             </span>mi <span style="color:rgb(0,0,139)">-=</span> bkgd<span style="color:rgb(0,0,139)">.</span>getImageF<span style="color:rgb(0,0,139)">(</span><span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span>    446</span>             <span>del</span> mi<span style="color:rgb(0,0,139)"></span>
<span>    447</span> <span style="color:rgb(0,0,139)"></span>

<span>/Users/dawson/lsst/DarwinX86/afw/10.0+3/python/lsst/afw/math/mathLib.pyc</span> in <span style="color:rgb(70,130,180)">getImageF<span style="color:rgb(0,0,139)">(self, *args)</span>
<span style="color:rgb(0,100,0)">   5736</span>         getImageF<span style="color:rgb(0,0,139)">(</span>Background self<span style="color:rgb(0,0,139)">)</span> <span style="color:rgb(0,0,139)">-</span><span style="color:rgb(0,0,139)">></span> boost<span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)">:</span>shared_ptr<span style="color:rgb(0,0,139)"><</span> lsst<span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)">:</span>afw<span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)">:</span>image<span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)">:</span>Image<span style="color:rgb(0,0,139)"><</span> float <span style="color:rgb(0,0,139)">></span> <span style="color:rgb(0,0,139)">></span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">   5737</span>         """
<span style="color:rgb(0,100,0)">-> 5738<span style="color:rgb(139,0,0)">         <span style="color:rgb(0,100,0)">return</span> _mathLib<span style="color:rgb(0,0,139)">.</span>Background_getImageF<span style="color:rgb(0,0,139)">(</span>self<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">*</span>args<span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">   5739</span> <span style="color:rgb(0,0,139)"></span>
<span style="color:rgb(0,100,0)">   5740</span>     <span style="color:rgb(0,100,0)">def</span> getImageI<span style="color:rgb(0,0,139)">(</span>self<span style="color:rgb(0,0,139)">,</span> <span style="color:rgb(0,0,139)">*</span>args<span style="color:rgb(0,0,139)">)</span><span style="color:rgb(0,0,139)">:</span><span style="color:rgb(0,0,139)"></span>

<span>InvalidParameterError</span>: 
  File "src/math/<a href="http://Interpolate.cc" target="_blank">Interpolate.cc</a>", line 60, in std::pair<std::vector<double>, std::vector<double> > lsst::afw::math::(anonymous namespace)::recenter(const std::vector<double> &, const std::vector<double> &)
    You must provide at least 1 point {0}
  File "src/math/<a href="http://BackgroundMI.cc" target="_blank">BackgroundMI.cc</a>", line 196, in void lsst::afw::math::BackgroundMI::_setGridColumns(const Interpolate::Style, const lsst::afw::math::UndersampleStyle, const int, const std::vector<int> &) const
    setting _gridcolumns {1}
lsst::pex::exceptions::InvalidParameterError: 'You must provide at least 1 point {0}; setting _gridcolumns {1}'
</span></span></span></span></span></span></span></span></span></span></span></span></span></pre></div><div><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(139,0,0)"><br></span></span></span></span></span></span></span></span></span></span></span></span></span></div></div></div></div><br>_______________________________________________<br>
dm-users mailing list<br>
<a href="mailto:dm-users@lists.lsst.org">dm-users@lists.lsst.org</a><br>
<a href="https://lists.lsst.org/mailman/listinfo/dm-users" target="_blank">https://lists.lsst.org/mailman/listinfo/dm-users</a><br></blockquote></div><br></div>