36 namespace algorithms {
40 const std::vector<PixelList>& pix,
41 const std::vector<BVec>* psf,
42 int galOrder,
int galOrder2,
int maxm,
45 dbg<<
"Start DoMeasure: galOrder = "<<galOrder<<
", psf = "<<bool(psf)<<std::endl;
47 dbg<<
"Thresh = "<<thresh<<std::endl;
49 for(
size_t i=0;i<pix.size();++i) {
50 xdbg<<
"npix["<<i<<
"] = "<<pix[i].size()<<std::endl;
51 npix += pix[i].size();
54 int galSize = (galOrder+1)*(galOrder+2)/2;
55 if (npix <= galSize) {
56 dbg<<
"Too few pixels ("<<npix<<
") for given gal_order. \n";
60 BVec b(galOrder,sigma);
63 xdbg<<
"Could not measure a shapelet vector.\n";
67 xdbg<<
"Bad flux in measured shapelet\n";
70 xdbg<<
"b = "<<b<<std::endl;
76 const BVec&
b,
bool psf,
int galOrder2,
double thresh,
89 double ftol = thresh*thresh;
90 double gtol = thresh*ftol;
106 if (solver.
solve(x,f)) {
107 dbg<<
"Found good round frame:\n";
110 double f_normInf = f.TMV_normInf();
112 xdbg<<
"Oops, Local minimum, not real solution.\n";
113 xdbg<<
"f.norm = "<<f.norm()<<std::endl;
114 xdbg<<
"f.normInf = "<<f_normInf<<std::endl;
116 dbg<<
"FLAG SHEAR_LOCAL_MIN\n";
117 flag |= SHEAR_LOCAL_MIN;
121 dbg<<
"findRoundFrame solver failed:\n";
125 dbg<<
"FLAG SHEAR_DIDNT_CONVERGE\n";
126 flag |= SHEAR_DIDNT_CONVERGE;
132 std::complex<double>(
x(2),
x(3)),
135 dbg<<
"ell => "<<*
this<<std::endl;
140 xdbg<<
"cov = "<<*cov<<std::endl;
virtual void noUseCholesky()
bool doMeasure(const std::vector< PixelList > &pix, const std::vector< BVec > *psf, int order, int order2, int maxm, double sigma, long &flag, double thresh, DMatrix *cov=0)
void getCovariance(DMatrix &cov) const
bool findRoundFrame(const BVec &b, bool psf, int galOrder2, double thresh, long &flag, DMatrix *cov=0)
virtual void setOutput(std::ostream &os)
bool solve(DVector &x, DVector &f) const
afw::table::Key< double > sigma
void preShiftBy(const std::complex< double > &cen, const std::complex< double > &gamma, const std::complex< double > &mu)
bool doMeasureShapelet(const std::vector< PixelList > &pix, const std::vector< BVec > *psf, BVec &bret, int order, int order2, int maxm, DMatrix *bcov=0) const
virtual void setTol(double fTol, double gTol)
virtual void setDelta0(double delta0)
virtual void setMinStep(double minStep)
virtual void useVerboseOutput()
afw::table::Key< double > b
virtual void setMaxIter(int maxIter)
std::ostream *const dbgout
#define EIGEN_Transpose(m)