31 namespace pexLogging = lsst::pex::logging;
33 namespace lsst {
namespace meas {
namespace algorithms {
64 params[
"minsize"] = policy.
getDouble(
"minsize");
65 params[
"maxsize"] = policy.
getDouble(
"maxsize");
66 params[
"logsize"] = policy.
getBool(
"logsize");
67 params[
"minmag"] = policy.
getDouble(
"minmag");
68 params[
"maxmag"] = policy.
getDouble(
"maxmag");
69 params[
"starfrac"] = policy.
getDouble(
"starfrac");
70 params[
"startn1"] = policy.
getDouble(
"startn1");
71 params[
"fitorder"] = policy.
getInt(
"fitorder");
72 params[
"fitsigclip"] = policy.
getDouble(
"fitsigclip");
73 params[
"starsperbin"] = policy.
getInt(
"starsperbin");
74 params[
"purityratio"] = policy.
getDouble(
"purityratio");
79 params[
"maxoutmag"] = params[
"maxmag"];
82 params[
"magstep1"] = 0.25;
83 params[
"magstep2"] = 0.1;
84 params[
"reject1"] = params[
"fitsigclip"];
85 params[
"reject2"] = params[
"fitsigclip"];
86 params[
"maxratio1"] = 3.0 * double(params[
"purityratio"]);
87 params[
"binsize1"] = 0.1;
88 params[
"minbinsize"] = 0.01;
89 params[
"miniter1"] = 3;
90 params[
"miniter2"] = 2;
91 params[
"startn2"] = 3 * int(params[
"startn1"]);
92 params[
"okvalcount"] = 2;
93 params[
"maxrms"] = 0.05;
94 params[
"maxrefititer"] = 5;
104 if (!(sigma > 0.))
return -1.;
106 double x = source.
getX();
107 double y = source.
getY();
110 source, pos,
false,
false,
pImpl->getAperture(), exposure)) {
139 const unsigned int MIN_OBJ_TO_TRY = 30;
142 std::vector<shapelet::PotentialStar*> maybeStars;
145 const int nSources = sourceList.
size();
146 traceLog.
debug<4>(
"%d candidate stars", nSources);
147 for (
int i=0; i<nSources; ++i) {
148 double const x = sourceList[i].getX();
149 double const y = sourceList[i].getY();
151 double const mag = calculateSourceMagnitude(sourceList[i], exposure);
157 if (!
pImpl->isOkSize(size)) {
160 if (ok && !
pImpl->isOkMag(mag)) {
163 traceLog.
debug<5>(
"i, x, y, size, mag = %d %.1f, %.1f %g %g: %d", i,
x,
y, size, mag, ok);
166 double logSize =
pImpl->convertToLogSize(size);
170 traceLog.
debug<4>(
"Total potential stars = %d", maybeStars.size());
171 if (maybeStars.size() < MIN_OBJ_TO_TRY) {
174 str(
boost::format(
"Only %d viable objects for star selection. "
175 "This algorithm needs at least %d objects to try to find stars")
176 % maybeStars.size() % MIN_OBJ_TO_TRY));
182 std::vector<shapelet::PotentialStar*> stars =
pImpl->findStars(maybeStars);
183 traceLog.
debug<4>(
"Identified %d stars", stars.size());
189 const int nStars = stars.size();
190 for (
int k=0; k<nStars; ++k) {
191 if (
pImpl->isOkOutputMag(stars[k]->getMag())) {
192 int i=stars[k]->getIndex();
196 stars[k]->getPos().getX(),
197 stars[k]->getPos().getY()));
198 psfCandidateList.push_back(psfCandidate);
202 return psfCandidateList;
~SizeMagnitudeStarSelectorImpl()
int getInt(const std::string &name) const
boost::shared_ptr< SizeMagnitudeStarSelectorImpl > pImpl
bool getBool(const std::string &name) const
A class to contain the data, WCS, and other information needed to describe an image of the sky...
a container for holding hierarchical configuration data in memory.
boost::shared_ptr< Calib > getCalib()
Return the Exposure's Calib object.
double getY() const
Return the centroid slot y coordinate.
Defines the Shapelet class.
bool measureFromImage(const Source &source, const PointD &pos, bool isCentroidFixed, bool isSigmaFixed, double aperture, const Exposure &exposure, const MaskPixel okmask=0)
measure shapelet decomposition of an image
void log(int importance, const std::string &message, const lsst::daf::base::PropertySet &properties)
std::vector< ReferenceMatch > ReferenceMatchVector
double getSigma() const
get the scale size of the shapelet
PsfCandidateList selectStars(const Exposure &exposure, const SourceCatalog &sourceList, boost::shared_ptr< afw::table::ReferenceMatchVector const > matches=boost::shared_ptr< afw::table::ReferenceMatchVector const >()) const
Find a set of stars from an input list of Sources.
double getX() const
Return the centroid slot x coordinate.
size_type size() const
Return the number of elements in the catalog.
static Log & getDefaultLog()
afw::table::Key< double > sigma
lsst::afw::image::Exposure< PixelT > Exposure
lsst::pex::policy::Policy Policy
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
PsfCandidateT::PtrList PsfCandidateList
SizeMagnitudeStarSelector(const Policy &policy)
Create a size-magnitude star selector from a policy.
A module for determining which objects are good PSF stars.
double getAperture() const
lsst::meas::algorithms::PsfCandidate< PixelT > PsfCandidateT
boost::shared_ptr< RecordT > const get(size_type i) const
Return a pointer to the record at index i.
double getDouble(const std::string &name) const
void debug(int verbosity, const std::string &message)
double calculateSourceSize(const SourceRecord &source, const Exposure &exposure) const
Calculates a robust size measurement for a source.
shapelet::SizeMagnitudeStarSelectorAlgo base
SizeMagnitudeStarSelectorImpl(ConfigFile ¶ms, const Policy &policy)
Class to ensure constraints for spatial modeling.
Record class that contains measurements made on a single exposure.
double getIyy() const
Return the shape slot Iyy value.
shapelet::ConfigFile ConfigFile
Class stored in SpatialCells for spatial Psf fitting.
FluxSlotDefinition::MeasValue getApFlux() const
Get the value of the ApFlux slot measurement.
double getIxx() const
Return the shape slot Ixx value.