Skip to content

Commit

Permalink
Merge pull request #12 from lsst/tickets/DM-5297
Browse files Browse the repository at this point in the history
jointcal running on test data (DM-5297)

Review complete, code builds, tests run.
  • Loading branch information
parejkoj committed Jun 22, 2016
2 parents cdb69c5 + 86f7b08 commit d4edc33
Show file tree
Hide file tree
Showing 54 changed files with 876 additions and 438 deletions.
25 changes: 18 additions & 7 deletions include/lsst/jointcal/Associations.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ class Associations {
RefStarList photRefStarList; // the (e.g) Landolt stars
FittedStarList fittedStarList; // the std::list of stars that are going to be fitted


// TODO: NOTE: these only exist because those lists can't be swig'd because
// swig doesn't like boost::intrusive_ptr (which the lists contain).
// Once DM-4043 is solved, delete these.
size_t refStarListSize()
{ return refStarList.size(); }
size_t photRefStarListSize()
{ return photRefStarList.size(); }
size_t fittedStarListSize()
{ return fittedStarList.size(); }

// fit cuts and stuff:
Point commonTangentPoint;

Expand Down Expand Up @@ -76,13 +87,13 @@ class Associations {

//! Collect stars form an external reference catalog (USNO-A by default) that match the FittedStarList. Optionally project these RefStar s on the tangent plane defined by the CommonTangentPoint().
void CollectRefStars(const bool ProjectOnTP=true);

//! Collect stars from an external reference catalog using the LSST stack mechanism
void CollectLSSTRefStars(lsst::afw::table::SortedCatalogT< lsst::afw::table::SimpleRecord > &Ref, std::string filter);




#ifdef STORAGE
//! This is Monte-Carlo stuff -- to remove this from associations
//! the Association class should provide us w/ iterators and acceptors
Expand Down Expand Up @@ -111,21 +122,21 @@ class Associations {
const double &MatchCutArcSec);
#endif
// void SetRefPhotFactor(int chip, double photfact);

//! apply cuts (mainly number of measurements) on potential FittedStars
void SelectFittedStars();

const CcdImageList& TheCcdImageList() const {return ccdImageList;}

unsigned int NShoots() const { return nshoots_; }

//! Number of different bands in the input image list. Not implemented so far
unsigned NBands() const {return 1;}

// Return the bounding box in (ra, dec) coordinates containing the whole catalog
const lsst::afw::geom::Box2D GetRaDecBBox();


private:
void AssociateRefStars(const double &MatchCutInArcSec, const Gtransfo *T);
unsigned int nshoots_;
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/jointcal/AstromFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ class AstromFit {
unsigned int _nParTot;
unsigned _nMeasuredStars;
double _posError; // constant term on error on position (in pixel unit)

public :

//! this is the only constructor
AstromFit (Associations &A, DistortionModel *D, double PosError);

//! Does a 1 step minimization, assuming a linear model.
/*! It calls AssignIndices, LSDerivatives, solves the linear system
and calls OffsetParams. No line search. Relies on sparse linear
Expand Down Expand Up @@ -176,7 +176,7 @@ class AstromFit {
template <class Accum>
void AccumulateStatRefStars(Accum &Accu) const;


//! only for outlier removal
void GetMeasuredStarIndices(const MeasuredStar &Ms,
std::vector<unsigned> &Indices) const;
Expand Down
84 changes: 42 additions & 42 deletions include/lsst/jointcal/CcdImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CcdImage : public RefCount
Frame imageFrame; // in pixels
// wholeCatalog is just store the catalog of selected sources
// lsst::afw::table::SortedCatalogT<lsst::afw::table::SourceRecord> wholeCatalog;

MeasuredStarList wholeCatalog; // the catalog of measured objets
MeasuredStarList catalogForFit;

Expand All @@ -48,16 +48,16 @@ class CcdImage : public RefCount
CountedRef<Gtransfo> TP2CTP; // reverse one
CountedRef<Gtransfo> pix2CommonTangentPlane;// pixels -> CTP
CountedRef<Gtransfo> pix2TP;

CountedRef<Gtransfo> sky2TP;

std::string riName;
std::string riDir;
std::string instrument;
int chip; // CCD number
ShootIdType shoot; // Same value for all CcdImages from the same exposure
unsigned bandRank; // some incremental band indicator.


double expTime; // seconds
double airMass; // airmass value.
Expand All @@ -75,7 +75,7 @@ class CcdImage : public RefCount
std::string dateObs;
// refraction
double sineta,coseta,tgz,hourAngle; // eta : parallactic angle, z: zenithal angle (X = 1/cos(z))

std::string band;
std::string flatName;
// std::string flat; // full flat name
Expand All @@ -86,7 +86,7 @@ class CcdImage : public RefCount
int bandIndex;
int index;
int expindex;

Point commonTangentPoint;

void LoadCatalog(const lsst::afw::table::SortedCatalogT<lsst::afw::table::SourceRecord> &Cat, const std::string &fluxField);
Expand All @@ -99,15 +99,15 @@ class CcdImage : public RefCount
const int &visit, const int &ccd, const std::string &ccdImage, const std::string &fluxField );



#ifdef TO_BE_FIXED
//!
CcdImage(const ReducedImage &Ri, const Point &CommonTangentPoint, const CatalogLoader * LoadIt);
#endif

//!
std::string Name() const { return riName;}

//!
std::string Dir() const { return riDir; }

Expand All @@ -127,19 +127,19 @@ class CcdImage : public RefCount
//!
const Gtransfo* CommonTangentPlane2TP() const
{ return CTP2TP.get();}

//!
const Gtransfo* TP2CommonTangentPlane() const
{ return TP2CTP.get();}

//!
const Gtransfo* Pix2TangentPlane() const
{ return pix2TP.get();}

//!
const Gtransfo* Sky2TP() const
{ return sky2TP.get();}

//! returns chip ID
int Chip() const { return chip;}

Expand All @@ -151,29 +151,29 @@ class CcdImage : public RefCount

//! returns seeing
// double Seeing() const { return seeing;}

//! returns gfseeing
// double GFSeeing() const { return gfseeing;}

//! returns sigma back
// double SigmaBack() const { return sigmaback;}

//! returns shoot ID
ShootIdType Shoot() const { return shoot;}

//! Exposure time (s)
double ExpTime() const { return expTime;}

//! Airmass
double AirMass() const {return airMass;}

//! Date Obs
std::string DateObs() const { return dateObs; }

//! Julian Date
double JD() const { return jd; }


//!Elixir ZP (applies to fluxes in ADU/sec at airmass 1).
double ElixirZP() const { return elixirZP;}

Expand All @@ -182,10 +182,10 @@ class CcdImage : public RefCount

//!zp from the psf zp file, returns 0 if not present
double PSFZP() const { return psfzp;}

//! absorption term
double PhotK() const { return photk; }

//! original ZP
double PhotC() const { return photc; }

Expand All @@ -206,58 +206,58 @@ class CcdImage : public RefCount

//!conversion from ADU to ADU/sec at airmass=1
double FluxCoeff() const { return fluxCoeff;}

//! return the CcdImage band name
std::string Band() const { return band;}

//! return the CcdImage band index. This is a static index that mostly turns a letter (e.g. 'g') into a number (e.g. 2). Different from BandRank()
int BandIndex() const { return bandIndex; }

//! Flat used to flatfield
std::string FlatName() const { return flatName;}

//! Full path of the scatter corrections
std::string CFHTScatter() const { return cfhtscatter; }

//! SNLS grid
std::string SNLSGrid() const { return snlsgrid; }

//! correction map to convert from one set of fluxes to another
std::string FlatCVMap() const { return flatcvmap; }

//void SetPix2TangentPlane(const Gtransfo *);

//! the wcs read in the header. NOT updated when fitting.
const Gtransfo *ReadWCS() const {return readWcs.get();}

//! the inverse of the one above.
const Gtransfo *InverseReadWCS() const {return inverseReadWcs.get();}

//! Frame in pixels
const Frame& ImageFrame() const { return imageFrame;}

//! Frame on sky
//Frame RaDecFrame() const;

//! Fitted Ccd object (contain the refscale parameters)
// void SetFittedCcd(FittedCcd* ccd) { if(ccd) fittedccd=ccd; }
// FittedCcd* GetFittedCcd() { return fittedccd; }
// FittedCcd const* GetFittedCcd() const { return fittedccd; }

//! returns wether "this" overlaps with Other.
// bool Overlaps(const CcdImage &Other) const;

//! CcdImage index
int Index() const { return index; }
void SetIndex(int idx) { index = idx; }

//! Exposure Index
int ExpIndex() const { return expindex; }
void SetExpIndex(int idx) { expindex = idx; }

//! Common Tangent Point
Point const& CommonTangentPoint() const { return commonTangentPoint; }

private:
CcdImage(const CcdImage &); // forbid copies

Expand All @@ -270,19 +270,19 @@ class CcdImage : public RefCount

//! a list of CcdImage. Usually produced by Associations
//class CcdImageList : public std::list<CountedRef<CcdImage> >
class CcdImageList : public std::list<boost::shared_ptr<CcdImage> >
class CcdImageList : public std::list<std::shared_ptr<CcdImage> >
{
public:

//!
//std::list<std::string> DateObs() const;

//!
//std::list<std::string> Bands() const;

//!
//double MeanAirmass() const;

//!
template<class Accept> CcdImageList SubList(const Accept &OP) const
{
Expand All @@ -291,7 +291,7 @@ class CcdImageList : public std::list<boost::shared_ptr<CcdImage> >
if (OP(**i)) out.push_back(*i);
return out;
}

// find the matching image. Chip==-1 means any chip
// double AirMass(const int Shoot, const int Chip = -1) const;
};
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/jointcal/ConstrainedPolyModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public :

//! Access to array of shoots involved in the solution.
std::vector<ShootIdType> GetShoots() const;

/*! the mapping of sky coordinates (i.e. the coordinate system
in which fitted stars are reported) onto the Tangent plane
(into which the pixel coordinates are transformed) */
Expand All @@ -86,7 +86,7 @@ public :
poloka-core */
// bool WriteChipArrangement(const std::string &FileName) const;


};

}} // end of namespaces
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/jointcal/FastFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace jointcal {
/*! \file
\brief Fast locator in starlists.
*/

/*! This is an auxillary class for matching objects from
starlists. It allows to locate rapidly the closest objects from a
given position. The very simple strategy is to sort objects
Expand Down

0 comments on commit d4edc33

Please sign in to comment.