16 #include "carma/pipeline/VisBrickReader.h"
22 #include <xercesc/sax2/Attributes.hpp>
23 #include <xercesc/sax2/DefaultHandler.hpp>
36 using namespace XERCES_CPP_NAMESPACE;
43 std::ostream& operator<< (std::ostream& target,
const XMLCh *s);
51 bool operator()(
const XMLCh *a,
const XMLCh *b)
const
52 {
int islower = XMLString::compareIString(a, b);
57 typedef std::map<const XMLCh *, int, XMLChComp> KeywordMap;
60 typedef void (*XMLhandlerFunc)(
XMLHandler *,
const XMLCh* name,
62 const XMLCh* type,
int length,
70 const char *description;
83 typedef struct SystemTempData{
89 int getNumberKeywords();
90 const Keyword *getKeywordEntry(
unsigned int index);
95 const std::string bfReasons[] = {
"A1_PHASELOCK",
133 const Keyword * getKeywordMapEntry(
const XMLCh *index)
const;
134 const Keyword * getItem(
const XMLCh *key)
const;
135 bool isDefined(
const XMLCh *key)
const;
136 void add(
const XMLCh *key,
unsigned int value);
139 static bool mapinitialized_;
140 static KeywordMap map_;
157 void setCurrentFile(std::string fileName);
164 void startElement(
const XMLCh*
const uri,
165 const XMLCh*
const localname,
166 const XMLCh*
const qname,
const Attributes& attrs);
170 void endElement(
const XMLCh *
const uri,
const XMLCh *
const localname,
171 const XMLCh *
const qname);
180 void resetDocument();
186 void writeKeyword(
const Attributes &a);
191 void warning(
const SAXParseException& exc);
192 void error(
const SAXParseException& exc);
193 void fatalError(
const SAXParseException& exc);
199 void openMiriad(
const std::string& inputAstroHdrFile,
200 const char *filename,
const std::string& mode,
201 const bool writeFloats,
const bool justGatherPdb);
209 void configure(
const std::string& visBrickDir,
210 const std::string& corrType);
219 static int frameOffset(
const double& frame);
227 void resetProjectData();
231 void updateProjectDatabase();
233 void addScript(std::string miriadFile);
236 static void printVisBrickWarnings(
bool isIncremental);
245 const XMLCh *,
int length,
const XMLCh *);
249 const XMLCh *,
int length,
const XMLCh *);
253 const XMLCh *,
int length,
const XMLCh *);
257 const XMLCh *,
int length,
const XMLCh *);
261 const XMLCh *,
int length,
const XMLCh *);
263 const XMLCh *,
int length,
const XMLCh *);
266 const XMLCh *,
int length,
const XMLCh *);
268 const XMLCh *,
int length,
const XMLCh *);
270 const XMLCh *,
int length,
const XMLCh *);
272 const XMLCh *,
int length,
const XMLCh *);
275 const XMLCh *,
int length,
const XMLCh *);
279 static void putBaseline(
XMLHandler *h,
const XMLCh *,
281 const XMLCh *,
int length,
const XMLCh *);
283 const XMLCh *,
int length,
const XMLCh *);
285 const XMLCh *,
int length,
const XMLCh *);
288 const XMLCh *,
int length,
const XMLCh *);
290 const XMLCh *,
int length,
const XMLCh *);
291 static void storeCorrelatorData(
XMLHandler *h,
const XMLCh *,
292 const Keyword *,
const XMLCh *,
293 int length,
const XMLCh *);
295 const XMLCh *,
int length,
const XMLCh *);
297 const XMLCh *,
int length,
const XMLCh *);
299 const XMLCh *,
int length,
const XMLCh *);
301 const XMLCh *,
int length,
const XMLCh *);
303 const XMLCh *,
int length,
const XMLCh *);
305 const XMLCh *,
int length,
const XMLCh *);
307 const XMLCh *,
int length,
const XMLCh *);
309 const XMLCh *,
int length,
const XMLCh *);
311 const XMLCh *,
int length,
const XMLCh *);
313 const XMLCh *,
int length,
const XMLCh *);
315 const XMLCh *,
int length,
const XMLCh *);
317 const XMLCh *,
int length,
const XMLCh *);
319 const XMLCh *,
int length,
const XMLCh *);
321 const XMLCh *,
int length,
const XMLCh *);
323 const XMLCh *,
int length,
const XMLCh *);
325 const XMLCh *,
int length,
const XMLCh *);
327 const XMLCh *,
int length,
const XMLCh *);
329 const XMLCh *,
int length,
const XMLCh *);
331 const XMLCh *,
int length,
const XMLCh *);
333 const XMLCh *,
int length,
const XMLCh *);
334 static void storeCorrtype(
XMLHandler *h,
const XMLCh *name,
335 const Keyword *kw,
const XMLCh *type,
336 int length,
const XMLCh *value);
338 const XMLCh *,
int length,
const XMLCh *);
340 const XMLCh *,
int length,
const XMLCh *);
341 enum PREAMBLE {COORD=0x1, TIME=0x2, BASELINE=0x4, DATA=0x8,
342 FLAGS=0x10, PREAMBLEBITS=0x1f, WBBITS=DATA|FLAGS};
343 enum {WCORRINDEX=0, CORRINDEX=1};
349 static int buildInt(
const XMLCh *value);
350 static float buildFloat(
const XMLCh *value);
351 static double buildDouble(
const XMLCh *value);
360 static int *buildIntv(
const XMLCh *value,
int &length,
int *list=0);
361 static float *buildFloatv(
const XMLCh *value,
int &length,
363 static double *buildDoublev(
const XMLCh *value,
int &length,
369 void unpackCorrelatorData
371 std::string& corrType,
const std::string& sortOrder,
372 std::map<int,int>& mapCorrInputToAntNumber,
373 int& nspect,
int& nchan, std::vector<int>& ischan,
374 std::vector<int>& nschan,
375 std::vector<double>& restfreq,
376 std::vector<double>& sfreq,
377 std::vector<double>& sdf,
double& freq,
379 std::vector<float>& wfreq,
380 std::vector<float>& wwidth,
382 std::map<
int, std::map<
int, std::vector<float> > >& corr,
383 std::map<
int, std::map<
int, std::vector<int> > >& flags,
384 std::map<
int, std::map<
int, std::vector<float> > >& wcorr,
385 std::map<
int, std::map<
int, std::vector<int> > >& wflags,
386 std::map<
int, std::map<
int, std::vector<float> > >& intTime,
387 std::map<
int, std::map<
int, std::vector<int> > >& flagReason);
390 int getPolCode(
int band,
int input1,
int input2);
392 int getPolCode(std::string polarization);
394 int getAntNumber(
int band,
int input);
404 bool selectedCorrType(
const std::string& corrType,
409 static void printIv(
const char *str,
const XMLCh *name,
410 const XMLCh *type,
int xmllength,
413 static void printRv(
const char *str,
const XMLCh *name,
414 const XMLCh *type,
int xmllength,
416 static void printDv(
const char *str,
const XMLCh *name,
417 const XMLCh *type,
int xmllength,
420 static std::map<int, std::map<int,SystemTempData> > reconfigureTsysMap(std::vector<float> &tempMap);
422 template<
class T>
static std::map<int, std::map<int,T> > reconfigureMap(std::vector<T> &tempMap);
424 template<
class T>
static void reconfigureMultiMap(std::map<
int, std::map<int,T> > inMap,
425 std::map<std::string, std::map<
int, std::map<int, T> > > &outMap);
427 static void reconfigureAntTsys(std::vector<float> &tempMap, std::map<std::string, std::map<
int, std::map<int, SystemTempData> > > &outMap);
429 static void reconfigureAntAmbPsys(std::vector<float> &tempMap, std::map<std::string, std::map<
int, std::map<int, float> > > &outMap);
431 void writeTsys(
int ant1, std::string pol1,
int ant2, std::string pol2,
int nspect);
435 template<
class T>
static T calculateMedian(std::vector<T> &data);
449 static XMLCh *NAME_, *TYPE_, *LENGTH_, *VALUE_;
450 static XMLCh *INTEGRATION_;
454 static double currentStartFrameMJD_;
458 static std::string currentVisBrickFile_;
461 currentVisBrickReader_;
465 static std::map<int, std::map<int,int> > currentNewCorrelatorInputMap_;
466 static std::map<int, int> currentCorrelatorInputMap_;
468 static std::vector<int> currentCorbit_;
470 static std::vector<float> currentCoreff_;
472 static std::vector<double> currentUVW_;
474 static std::vector<float> currentJyperka_;
476 static std::vector<double> currentBandFreq_;
478 static std::vector<double> currentRestFreq_;
479 static double maxRestfreq_;
481 static double currentIntTime_;
483 static std::vector<float> currentTsys_;
484 static std::map<std::string, std::map<int, std::map<int, SystemTempData> > >
486 static std::vector<float> currentPsys_;
487 static std::map<std::string, std::map<int, std::map<int, float> > >
489 static std::vector<float> currentPsysAttn_;
490 static std::map<std::string, std::map<int, std::map<int, float> > >
492 static std::vector<float> currentAmbPsys_;
493 static std::map<std::string, std::map<int, std::map<int, float> > >
496 static std::vector<int> currentAntennas_;
498 static std::vector<int> currentGoodBands_;
500 static int currentMaxBand_;
501 static std::map<int, std::map<int, std::string> > currentPolState_;
502 static std::vector<int> currentVersion_;
505 static std::string visBrickDir_;
509 static std::string corrType_;
511 static bool writeData_;
517 static std::string inputAstroHdrFile_;
519 static int dataNotPresentCount_;
520 static std::string dataNotPresentFile_;
521 static int maxSlCorrelatorInput_;
522 static int maxWbCorrelatorInput_;
523 static int maxSlBandIndex_;
524 static int maxWbBandIndex_;
525 static int maxABBandIndex_;
526 static int maxABCorrelatorInput_;
527 static int SlBandStart_;
528 static int WbBandStart_;
529 static bool havePolState_;
530 static int32_t visbrickVersionNumber_;
531 static int maxAntIndex_;
533 static double currentLatitude_;
534 static double currentLst_;
535 static double currentObsdec_;
536 static double currentObsra_;
537 static double evector_;
538 static std::map<std::string,int> lastNChan_;
539 static std::map<std::string, std::vector<int> > lastNsChan_;
540 static std::map<std::string, std::vector<int> > lastIsChan_;
541 static std::string currentFile_;
547 #endif //XMLHANDLER_H
This class provides the comparision function for use with maps dealing with XMLCh strings...
unsigned int frameType
Half second frames since Jan 1, 2000.
A class to accumulate project data for an obsblock trial.
A class to accumulate project data for an obsblock trial.
Abstract base class for access to MIRIAD uv-data.
Content and error handler for the astronomical hdr SAX XML parser.
Reads Correlator Data from a specifiec file.
SIDEBAND
Enumerated sideband types.
relationships between the monitor and dbms systems
Class used to represents bands of Correlator Data.
Mapping of correlator bands and sidebands to output spectral windows.
Defines the abstract class MiriadUV and the specialization MiriadUVBin which define the interface for...
Base class for Correlator Sideband data.