[1770] | 1 | #include <iostream.h>
|
---|
| 2 | #include "datacirclefits.h"
|
---|
| 3 |
|
---|
| 4 | /*
|
---|
| 5 | Class used to recover the circles and measures involved in a mission. The parameters needful to create a circle and the number of samples on this circle are read from a FITS data array. In addition, a function returns the measurement at a given angular position psi on the circle.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | DataCircleFits::DataCircleFits() :
|
---|
| 9 | _fptr(NULL)
|
---|
| 10 | , _NMeasurements(0)
|
---|
| 11 | , _ICircle(0)
|
---|
| 12 | , _mesures(NULL)
|
---|
| 13 | ,_stored_data(false)
|
---|
| 14 | {;}
|
---|
| 15 |
|
---|
| 16 | DataCircleFits::DataCircleFits(FitsInFile& is,int hdunum,bool sdata) :
|
---|
| 17 | _fptr(NULL)
|
---|
| 18 | , _NMeasurements(0)
|
---|
| 19 | , _ICircle(hdunum)
|
---|
| 20 | , _mesures(NULL)
|
---|
| 21 | ,_stored_data(sdata)
|
---|
| 22 | {
|
---|
| 23 |
|
---|
| 24 | // pointer to the FITS file
|
---|
| 25 | _fptr= &is;
|
---|
| 26 |
|
---|
| 27 | // move to the HDU containing a circle
|
---|
| 28 | _fptr->ReadHeader(hdunum);
|
---|
| 29 |
|
---|
| 30 | // reference on a DVList containing the keywords
|
---|
| 31 | DVList dvl= _fptr->DVListFromFits();
|
---|
| 32 |
|
---|
| 33 | // angles of the circle
|
---|
| 34 | double theta= dvl.GetD("CIRTHETA");
|
---|
| 35 | double phi = dvl.GetD("CIRPHI");
|
---|
| 36 | double aperture= dvl.GetD("CIRAPER");
|
---|
| 37 |
|
---|
| 38 | UnitVector temp(theta,phi);
|
---|
| 39 | SetCircle(temp,aperture);
|
---|
| 40 |
|
---|
| 41 | _NMeasurements= dvl.GetI("NSAMPLES");
|
---|
| 42 |
|
---|
| 43 | if(_stored_data) {
|
---|
| 44 | _mesures= new double[_NMeasurements];
|
---|
| 45 | int i;
|
---|
| 46 | for(i = 0; i < _NMeasurements; i++) {
|
---|
| 47 | _fptr->GetBinTabLine(i,&_mesures[i],NULL,NULL,NULL);
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | DataCircleFits::~DataCircleFits() {
|
---|
| 53 |
|
---|
| 54 | if(_mesures != NULL) delete [] _mesures;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | int DataCircleFits::NMeasurements() const {
|
---|
| 58 |
|
---|
| 59 | return _NMeasurements;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | double DataCircleFits::getData(double psi) const {
|
---|
| 63 |
|
---|
| 64 | double dtab;
|
---|
| 65 | int ibin= (int)floor(psi*_NMeasurements/2./M_PI);
|
---|
| 66 |
|
---|
| 67 | if(_stored_data) {
|
---|
| 68 | dtab= _mesures[ibin];
|
---|
| 69 | } else {
|
---|
| 70 | _fptr->ReadHeader(_ICircle);
|
---|
| 71 | _fptr->GetBinTabLine(ibin,&dtab,NULL,NULL,NULL);
|
---|
| 72 | }
|
---|
| 73 | //cout << "DataCircleFits:: bin= " << ibin << ", " << dtab << endl;
|
---|
| 74 | return dtab;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | void DataCircleFits::print(ostream& out) const {
|
---|
| 78 |
|
---|
| 79 | out << " Circle:: ApertureAngle= " << ApertureAngle() << ", Theta= "
|
---|
| 80 | << Theta() << ", Phi= " << Phi() << ", NSamples= "
|
---|
| 81 | << NMeasurements() << endl;
|
---|
| 82 | }
|
---|