<div dir="ltr"><div>meas_modelfit contains three different components you might be interested in: </div><div><br></div><div> - A collection of low-level model-fitting utility classes (optimizers, model evaluation classes, Bayesian priors).</div><div><br></div><div> - Some bitrotted Python command-line Tasks that I once used to run the model-fitting code for some one-off performance tests (this is the MeasureImage Tasks you've been working with).</div><div><br></div><div> - A single high-level fitting algorithm (CModel) built out of the low-level components that can be run as a measurement plugin alongside the ones in meas_base.</div><div><br></div><div>I'm afraid the command-line Tasks aren't going to be something you'll be able to just use.  At best, they'll be useful as example code for how to write your own driver script that makes use of the low-level components, but even for that, well, they're bitrotted, and slated for removal in the fairly near future.</div><div><br></div><div>The CModel algorithm is very much usable, and you can run it just like the algorithms in meas_base using the meas_base tasks, but just modifying your meas_base configuration:</div><div><br></div><div>import lsst.meas.modelfit  # import registers the CModel algorithm with meas_base</div><div>import lsst.meas.base</div><div><span style="font-size:12.8000001907349px">measureConfig = lsst.meas.base.</span><span style="font-size:12.8000001907349px">SingleFrameMeasurementConfig()</span><br></div><div>measureConfig.plugins.names += ["modelfit_ShapeletPsfApprox", "modelfit_CModel"]</div><div><br></div><div>You can then create SingleFrameMeasurementTask and proceed as usual with that; the CModel model fitting will automatically be included.  And you can tweak the CModel parameters via the multitude of options in </div><div><br></div><div>measureConfig.plugins["modelfit_CModel"].*</div><div><br></div><div>You'll note that we also enabled the "ShapeletPsfApprox" algorithm, which constructs a multi-shapelet approximation to the PSF model that CModel uses for convolving models.</div><div><br></div><div>CModel is a fairly sleazy algorithm.  We fit an exponential and a de Vaucouleur separately, then just fit a linear combination of the two while holding the ellipse parameters fixed at the best fit values from the independent fitting.  But it worked pretty well for SDSS, and it was easy to code up.  You can find more information in the description of the SDSS implementation here:</div><div><br></div><div><a href="http://classic.sdss.org/dr7/algorithms/photometry.html#mag_model">http://classic.sdss.org/dr7/algorithms/photometry.html#mag_model</a><br></div><div><br></div><div>By the way, I'm not sure why the Doxygen for meas_modelfit isn't included in the main LSST Doxygen page, but I just created an issue (DM-2790) to get that fixed.  Not sure how useful it would be to you if it was there, though.</div><div><br></div><div>Finally, the LSST version of CModel hasn't really received much testing - we've basically just tested that it works a few fairly artificial cases (i.e. unit tests).  But it is very similar to a very well-tested HSC algorithm (only the ShapeletPsfApprox part is different), so hopefully it will just work.</div><div><br></div><div><br></div><div>Jim</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 25, 2015 at 1:45 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 the DM Stack to measure the Sersic profile of a galaxy in a postage stamp. It looks like meas_modelfit (rather than e.g. meas_base) is what I want since it contains things like:<div><br></div><div><table style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:13px;line-height:18px"><tbody><tr><td style="padding:0px 10px;vertical-align:top;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal"><span style="color:rgb(121,93,163)">@</span><span style="color:rgb(121,93,163)">registerModel</span>(<span style="color:rgb(24,54,145)"><span>"</span>fixed-sersic<span>"</span></span>)</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;white-space:nowrap;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal"><span style="color:rgb(167,29,93)">class</span> <span style="color:rgb(121,93,163)">FixedSersicModelConfig</span>(<span style="color:rgb(121,93,163)">FixedSersicConfig</span>):</td></tr></tbody></table><div>and</div></div><div><table style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:13px;line-height:18px"><tbody><tr><td style="padding:0px 10px;vertical-align:top;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal"><span style="color:rgb(121,93,163)">@</span><span style="color:rgb(121,93,163)">registerModel</span>(<span style="color:rgb(24,54,145)"><span>"</span>bulge+disk<span>"</span></span>)</td></tr><tr><td style="padding:0px 10px;width:50px;min-width:50px;white-space:nowrap;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;border-style:solid;border-color:rgb(238,238,238);border-width:0px 1px 0px 0px"></td><td style="padding:0px 10px;vertical-align:top;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal"><span style="color:rgb(167,29,93)">class</span> <span style="color:rgb(121,93,163)">BulgeDiskModelConfig</span>(<span style="color:rgb(121,93,163)">lsst.pex.config.Config</span>):</td></tr></tbody></table><div><br></div></div><div>But I am not sure how to configure means_modelfit (note that it is installed and I can use eups setup with it just fine). For example, with meas_base I am used to doing something like:</div><div><br></div><div>import lsst.meas.base as measBase</div><div>import lsst.afw.table as afwTable</div><div>schema = afwTable.SourceTable.makeMinimalSchema()</div><div>measureConfig = measBase.SingleFrameMeasurementConfig()</div><div>measure = measBase.SingleFrameMeasurementTask(config=measureConfig, schema=schema)</div><div><br></div><div>Fishing somewhat in the dark I have tried things like subbing in: </div><div>import lsst.meas.modelfit as measModel</div><div>measureConfig = measModel.MeasureImageConfig()</div><div><br></div><div>But get errors like: </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(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)"><span>InvalidParameterError</span>: 
  File "src/table/<a href="http://Schema.cc" target="_blank">Schema.cc</a>", line 590, in Key<lsst::afw::table::Flag> lsst::afw::table::detail::SchemaImpl::addField(const Field<lsst::afw::table::Flag> &, bool)
    Field with name 'flags_negative' already present in schema. {0}
lsst::pex::exceptions::InvalidParameterError: 'Field with name 'flags_negative' already present in schema.'</span></span></span></span></span></span></span></pre><div><br></div></div><div>I am hoping that someone more familiar with the meas_modelfit package can help me out with its proper usage, or tell me if I should be using a different package to measure Sersic profiles of postage stamps.</div><div><br></div><div>Thank you,</div><div>Will</div><div><br></div><div><br></div><div><br></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>