[LSST|dm-users 677] Re: How to Use meas_modelfit to Measure Sersic Properties

Jim Bosch jbosch at astro.princeton.edu
Tue May 26 08:32:13 PDT 2015


meas_modelfit contains three different components you might be interested
in:

 - A collection of low-level model-fitting utility classes (optimizers,
model evaluation classes, Bayesian priors).

 - 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).

 - 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.

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.

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:

import lsst.meas.modelfit  # import registers the CModel algorithm with
meas_base
import lsst.meas.base
measureConfig = lsst.meas.base.SingleFrameMeasurementConfig()
measureConfig.plugins.names += ["modelfit_ShapeletPsfApprox",
"modelfit_CModel"]

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

measureConfig.plugins["modelfit_CModel"].*

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.

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:

http://classic.sdss.org/dr7/algorithms/photometry.html#mag_model

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.

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.


Jim




On Mon, May 25, 2015 at 1:45 PM, Will Dawson <will at dawsonresearch.com>
wrote:

> 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:
>
> @registerModel("fixed-sersic")class FixedSersicModelConfig(
> FixedSersicConfig):
> and
> @registerModel("bulge+disk")class BulgeDiskModelConfig(
> lsst.pex.config.Config):
>
> 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:
>
> import lsst.meas.base as measBase
> import lsst.afw.table as afwTable
> schema = afwTable.SourceTable.makeMinimalSchema()
> measureConfig = measBase.SingleFrameMeasurementConfig()
> measure = measBase.SingleFrameMeasurementTask(config=measureConfig,
> schema=schema)
>
> Fishing somewhat in the dark I have tried things like subbing in:
> import lsst.meas.modelfit as measModel
> measureConfig = measModel.MeasureImageConfig()
>
> But get errors like:
>
> InvalidParameterError:
>   File "src/table/Schema.cc", 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.'
>
>
> 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.
>
> Thank you,
> Will
>
>
>
>
> _______________________________________________
> dm-users mailing list
> dm-users at lists.lsst.org
> https://lists.lsst.org/mailman/listinfo/dm-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lsst.org/pipermail/dm-users/attachments/20150526/bd053a4d/attachment.html>


More information about the dm-users mailing list