casa
$Rev:20696$
|
00001 #if !defined(_SDMBINDATA_H) 00002 00003 #include <iostream> 00004 #include <sstream> 00005 #include <string> 00006 00007 #include <ASDMEntities.h> 00008 #include <Tag.h> 00009 #include <ArrayTime.h> 00010 #include <ArrayTimeInterval.h> 00011 00012 // Enumerations used to select data: 00013 #include <AtmPhaseCorrection.h> 00014 #include <CorrelationMode.h> 00015 #include <ProcessorType.h> 00016 #include <ScanIntent.h> 00017 #include <SpectralResolutionType.h> 00018 #include <TimeSampling.h> 00019 00020 #include <CorrelatorType.h> 00021 00022 // Views: 00023 #include "SDMDataViews.h" 00024 00025 #include "BaselinesSet.h" 00026 #include "Integration.h" 00027 00028 00029 #include "SDMDataObjectReader.h" 00030 #include "SDMDataObjectStreamReader.h" 00031 00032 using namespace asdmbinaries; 00033 00034 // #include "Singleton.hpp" 00035 // #include "ExecBlockDir.hpp" 00036 00037 00038 using namespace std; 00039 using namespace asdm; 00040 00041 namespace sdmbin{ 00042 00044 class SDMBinData{ 00045 public: 00046 /* SDMBinData(); */ 00062 SDMBinData( ASDM* const datasetPtr, string execBlockDir); 00063 00064 ~SDMBinData(); 00065 00073 void select( EnumSet<ScanIntent> es_si); 00074 00082 void select( EnumSet<ProcessorType> es_pt); 00083 00091 void select( EnumSet<CorrelationMode> es_cm); 00092 00100 void select( EnumSet<SpectralResolutionType> es_srt); 00101 00109 void select( EnumSet<TimeSampling> es_ts); 00110 00111 00121 void select( EnumSet<CorrelationMode> es_cm, 00122 EnumSet<SpectralResolutionType> es_srt, 00123 EnumSet<TimeSampling> es_ts); 00124 00125 00134 void selectDataSubset( Enum<CorrelationMode> e_qcm, 00135 EnumSet<AtmPhaseCorrection> es_qapc ); 00136 00141 void setPriorityDataDescription(); 00142 00149 vector<pair<unsigned int,double> > timeSequence()const; 00150 00154 bool dataDescriptionFirst()const; 00155 00161 void applySysCal(); 00162 00166 bool sysCalApplied() const; 00167 00175 bool acceptMainRow( MainRow* const mainRowPtr); 00176 00183 bool openMainRow(MainRow* const mainRowPtr); 00184 00190 string reasonToReject(MainRow* const mainRowPtr); 00191 00192 00208 bool isComplexData(); 00209 00210 vector<SDMData*> getData(); 00211 00217 vector<MSData*> getData( Enum<CorrelationMode> e_qcm, EnumSet<AtmPhaseCorrection> es_qapc); 00218 00219 MSData* getData( unsigned int na, unsigned int nfe, unsigned int ndd, unsigned int nbin) throw (Error); 00220 00221 MSData* getCalibratedData( unsigned int na, unsigned int nfe, unsigned int ndd, unsigned int nbin, 00222 pair<bool,vector<vector<float> > > p_tsys) throw (Error); 00223 00224 MSData* getData( unsigned int na1, unsigned int nfe1, unsigned int na2, unsigned int nfe2, 00225 unsigned int ndd, unsigned int nbin, vector<unsigned int> v_napc, 00226 float scleFactor); 00227 00228 MSData* getCalibratedData( unsigned int na1, unsigned int nfe1, unsigned int na2, unsigned int nfe2, 00229 unsigned int ndd, unsigned int nbin, vector<unsigned int> v_napc, 00230 float scleFactor, 00231 pair<bool,vector<vector<float> > > p_tsys); 00232 00233 MSData* getData( Tag antId, int feedId, 00234 Tag dataDescId, 00235 AtmPhaseCorrection apc, 00236 unsigned int binNum); 00237 00238 MSData* getData( Tag antId1, int feedId1, 00239 Tag antId2, int feedId2, 00240 Tag dataDescId, 00241 vector<AtmPhaseCorrection> v_apc, 00242 unsigned int binNum); 00243 00244 const VMSData* getDataCols(); 00245 00246 const VMSData* getDataCols( Enum<CorrelationMode> e_qcm, EnumSet<AtmPhaseCorrection> es_qapc ); 00247 00258 const VMSData* getNextMSMainCols(unsigned int n); 00259 00260 const VMSData* getNextMSMainCols(Enum<CorrelationMode> e_qcm, EnumSet<AtmPhaseCorrection> es_qapc, unsigned int n); 00261 00262 vector<MSData*> getMSDataFromBDFData(Enum<CorrelationMode> e_qcm, EnumSet<AtmPhaseCorrection> es_qapc, unsigned int n); 00263 00267 void getNextDataDumps(unsigned int n); 00268 00276 static bool baselineReverse(); 00277 00283 static bool autoTrailing(); 00284 00286 static pair<bool,bool> dataOrder(); 00287 00288 protected: 00289 00293 int attachDataObject(string dataOID); 00294 00299 int attachStreamDataObject(const string& dataOID); 00300 00311 int openStreamDataObject(const string& dataOID); 00312 00315 void detachDataObject(); 00316 00329 MSState getMSState( unsigned int subscanNum, 00330 vector<Tag> v_stateId, 00331 vector<Tag> v_antennaId, vector<int> v_feedId, vector<Tag> v_ddId, 00332 unsigned int na, unsigned int nfe, unsigned int nspw, ArrayTime timeOfDump); 00333 00334 private: 00335 static ASDM* datasetPtr_; 00336 static string execBlockDir_; 00337 static bool canSelect_; 00338 static bool forceComplex_; // true ==> autoData will be transformed into complex data 00339 EnumSet<ScanIntent> es_si_; // set of scan intents selected 00340 EnumSet<ProcessorType> es_pt_; // set of processor type selected 00341 EnumSet<CorrelationMode> es_cm_; // set of correlation mode selected 00342 EnumSet<SpectralResolutionType> es_srt_; // set of spectral resolution types selected 00343 EnumSet<TimeSampling> es_ts_; // set of time sampling selected 00344 00345 Enum<CorrelationMode> e_qcm_; // query to select a subset of data in a BLOB 00346 EnumSet<AtmPhaseCorrection> es_qapc_; // query to select a subset of data in a BLOB 00347 00348 bool ddfirst_; // true ==> output sequences of time for every dataDescription 00349 00350 MainRow* mainRowPtr_; 00351 string dataOID_; 00352 SDMDataObjectReader blob_r_; // current read-only BLOB 00353 SDMDataObjectStreamReader sdmdosr ; // current SDMDataObjectStreamReader 00354 bool bdfMemoryMapped; // will the BDF mapped in memory (true) or read sequentially (false) ? 00355 vector<DataDump*> v_dataDump_; 00356 00357 const float* floatDataPtr_; // mutable attribute; autocorrelation data of a single dump 00358 const short* shortDataPtr_; // mutable attribute; visiblity data of a single dump 00359 const int* longDataPtr_; // mutable attribute; visiblity data of a single dump 00360 const unsigned int* flagsPtr_; // mutable attribute; flags data in a single dump 00361 const int64_t* actualTimesPtr_; // mutable attribute; actualTimes in a single dump 00362 const int64_t* actualDurationsPtr_; // mutable attribute; actualDurations in a single dump 00363 const float* zeroLagsPtr_; // mutable attribute; zeroLags in a single dump 00364 static MSData* msDataPtr_; // mutable attribute; one MS-MAIN row given 00365 static SDMData* sdmDataPtr_; // mutable attribute; one SDM-Main (v2) row 00366 static BaselinesSet* baselinesSet_; // mutable attribute 00367 static vector<MSData*> v_msDataPtr_; // mutable attribute 00368 static VMSData* vmsDataPtr_; 00369 static vector<SDMData*> v_sdmDataPtr_; 00370 map<Tag,BaselinesSet*> m_cdId_baselinesSet_; 00371 set<Tag> s_cdId_; // the keys present in m_cdId_baselinesSet_ (used for optimization) 00372 bool complexData_; 00373 static bool coutDeleteInfo_; // utility for debugging 00374 static bool baselineReverse_; // order in which the data are in the returning VMSData structure. 00375 static bool autoTrailing_; // position of the auto data relative cross data in the returning VMSData structure. 00376 static bool syscal_; // true ==> apply system temperature calibration. 00377 00378 const float* floatDataDumpPtr_; 00379 00380 vector<pair<unsigned int,double> > v_tci_; // Indexed time centroid sequence 00381 00382 void deleteMsData(MSData* msDataPtr); 00383 00384 bool verbose_ ; // A variable to turn on/off the verbosity of the code, traditionnally based on the existence of env var "ASDM_DEBUG" 00385 }; 00386 00387 } 00388 00389 #define _SDMBINDATA_H 00390 #endif