casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FillMetadata.h
Go to the documentation of this file.
1 //# FillMetadata.h: this defines container classes used while actually filling data
2 //# Copyright (C) 2000,2001,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id: FillMetadata.h,v 1.3 2011/08/11 18:03:53 pteuben Exp $
28 
29 #ifndef BIMA_FILLMETADATA_H
30 #define BIMA_FILLMETADATA_H
31 
32 #include <map>
33 #include <list>
34 #include <casa/Arrays/Vector.h>
37 #include <miriad/Filling/IDIndex.h>
39 #include <measures/Measures.h>
40 
41 #include <casa/namespace.h>
42 //# Forward Declarations
43 namespace casacore{
44 
45  class MeasurementSet;
46  class MSColumns;
47 }
48 
49 namespace casa { //# NAMESPACE CASA - BEGIN
50 } //# NAMESPACE CASA - END
51 
52 
53 // <summary>
54 // an abstract base for classes that contain information about some
55 // part of a Miriad Dataset
56 // </summary>
57 //
58 // <use visibility=local>
59 //
60 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
61 // </reviewed>
62 //
63 // <etymology>
64 // subclasses contain information about a Miriad dataset
65 // </etymology>
66 //
67 // <synopsis>
68 // This class provides a common type and interface for classes that organize
69 // some collection of related information in a Miriad dataset.
70 // </synopsis>
71 //
72 // <motivation>
73 //
74 // </motivation>
75 //
77  public:
78  MirInfo();
79  virtual ~MirInfo();
80  protected:
81 };
82 
83 // <summary>
84 // a container for field information
85 // </summary>
86 //
87 // <use visibility=local>
88 //
89 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
90 // </reviewed>
91 //
92 // <etymology>
93 // a Miriad observing field is expressed as an offset from a reference position
94 // </etymology>
95 //
96 // <synopsis>
97 // MirField is a helper class used by MirFiller and FillMetadata to hold
98 // the data describing an observing field in a single container. Most of the
99 // interaction with this class is through public data members (for programming
100 // and runtime efficiency); thus, this class is not appropriate for use outside
101 // of this module. A few helper funtions are provided to aid in utilizing the
102 // information (mainly for comparison with other MirField objects).
103 // </synopsis>
104 //
105 // <motivation>
106 // A Miriad dataset can contain a number of observing fields, described as offsets
107 // from a reference position. When scanning a multi-field dataset, one usually
108 // will encounter data each field as the observations cycles through the set of
109 // pointings. Thus, the filler must keep a list of unique fields that can be
110 // matched against the current field.
111 // </motivation>
112 //
113 class MirField : public MirInfo
114 {
115  public:
116  // the position offsets
118 
119  // the ID assigned to this field within the casacore::MeasurementSet being filled.
120  // A value of -1 means that the ID has not yet been assigned.
122 
123  // create a new field description
124  MirField(casacore::Float delra, casacore::Float deldec, casacore::Int fid=-1);
125 
126  // delete this field
127  virtual ~MirField();
128 
129  // return true if this field's offsets match those of another
131  return (dra==that.dra && ddec==that.ddec);
132  }
133 
134  // return false if this field's offsets match those of another
136  return ! (*this == that);
137  }
138 
139  // return a pointer to a field in a given list of fields that is equal
140  // to this field.
142  casacore::ListIter<MirField*> li(fldlist);
143  while (! li.atEnd() && *(li.getRight()) != *this) li++;
144  return ((li.atEnd()) ? NULL : li.getRight());
145  }
146 
147  // clear the ID values for all the fields in a field list by setting them
148  // to -1.
149  static void clearIDs(casacore::List<MirField*> &fldlist) {
150  for(casacore::ListIter<MirField*> li(fldlist); ! li.atEnd(); ++li)
151  li.getRight()->id = -1;
152  }
153 
154 };
155 
156 // <summary>
157 // A description of a Miriad spectroscopy (correlator) setup
158 // </summary>
159 //
160 // <use visibility=local>
161 //
162 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
163 // </reviewed>
164 //
165 // <etymology>
166 // a description of the frequency setup used by a Miriad dataset
167 // </etymology>
168 //
169 // <synopsis>
170 // This class contains the data describing the frequency domain of a
171 // portion of the dataset. <p>
172 //
173 // Most of the interaction with this class is through public data members (for
174 // programming and runtime efficiency); thus, this class is not appropriate for
175 // use outside of this module. A few helper funtions are provided to aid in
176 // utilizing the information (mainly for comparison with other MirFreqSetup objects).
177 // </synopsis>
178 //
179 // <motivation>
180 // a Miriad dataset may switch back and forth between different correlator
181 // configurations. The filler must keep track of them, and recognize them
182 // when the are reused.
183 // </motivation>
184 //
185 class MirFreqSetup : public MirInfo {
186  public:
187 
188  // the correlator mode
190 
191  // the correlator filter bandwidths
193 
194  // the correlator LO frequencies
196 
197  // the number of spectral windows
199 
200  // the number of wideband channels
202 
203  // the total number of spectral line channels
205 
206  // the number of channels in each window
208 
209  // the number of the first channel in each window
211 
212  // the frequency of the first channel in each window
214 
215  // the frequency separation between channels in each window
217 
218  // the rest frequency for each window
220 
221  // the center frequency of each wideband channel
223 
224  // the bandwidth of each wideband channel
226 
227  // the reference frequency for this setup. Usually the rest frequency
228  // of the primary line of the observations.
230 
231  // the ID assigned to this setup within the casacore::MeasurementSet being filled.
232  // A value of -1 means that the ID has not yet been assigned.
234 
235  // the narrow window mapping index. This maps
236  // Miriad window numbers to casacore::MS spectral window IDs.
238 
239  // the wideband mapping index. This maps
240  // Miriad wideband channel numbers to casacore::MS spectral window IDs.
242 
243  // create a new setup by reading the relevent variable data from
244  // the given miriad dataset handle
245  MirFreqSetup(casacore::Int mir_handle);
246 
247  virtual ~MirFreqSetup();
248 
249  // return true if this setup is the same as another.
250  // Two setups will be considered equal if the mode, nwide, nspect,
251  // corfs and corbws are identical. (The window starting frequencies can
252  // change as they are topocentric; this may cause problems for miriad
253  // data that did not originate from BIMA.)
255 
256  // return false if this setup is the same as another.
258  return ! (*this == that);
259  }
260 
261  // clear the id and index maps
262  void clear() {
263  id = -1;
264  nfidx.clear();
265  wfidx.clear();
266  }
267 
268  // return a pointer to a setup in a given list of setups that is equal
269  // to this setup.
271  casacore::ListIter<MirFreqSetup*> li(setuplist);
272  while (! li.atEnd() && *(li.getRight()) != *this) li++;
273  return ((li.atEnd()) ? NULL : li.getRight());
274  }
275 
276  // clear the ID values for all the setups in a setup list by setting them
277  // to -1.
278  static void clearIDs(casacore::List<MirFreqSetup*> &setuplist) {
279  for(casacore::ListIter<MirFreqSetup*> li(setuplist); ! li.atEnd(); ++li)
280  li.getRight()->clear();
281  }
282 };
283 
284 // <summary>
285 // a container for a single Miriad polarization correlation
286 // </summary>
287 //
288 // <use visibility=local>
289 //
290 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
291 // </reviewed>
292 //
293 // <etymology>
294 // the name is short for Miriad Polarization Correlation. A polarization
295 // correlation type refers to the combination (via cross-correlation) of two
296 // polarizations.
297 // </etymology>
298 //
299 // <synopsis>
300 // This class contains a polarization cross-correlation combination. It
301 // provides methods for determining the constituent polarization types. An
302 // integer Id can be associated with it as well; this is used by the MirFiller
303 // class to remember what table entry it is associated with.
304 // </synopsis>
305 //
306 // <motivation>
307 // Miriad datasets record different polarization measurements in seperate
308 // records; thus, there is a notion of a current polarization among several
309 // being read. Furthermore, you usually don't know which polarizations
310 // are in the dataset until you've read at least one record with each kind
311 // of polarization. You do usually know the total number of different
312 // polarizations after reading the first record.
313 // </motivation>
314 //
315 //
316 class MirPolCorr : public MirInfo {
317  private:
319  mutable casacore::Int id;
320 
323 
324  public:
325  // create a container. Poltype is the polarization type in the Miriad
326  // convention (i.e. as read from the "pol" variable in a Miriad dataset).
327  MirPolCorr(casacore::Int poltype);
328 
329  // create a copy of a container.
330  MirPolCorr(const MirPolCorr& that) : id(-1) { corr = that.corr; }
331 
332  // delete the container
333  virtual ~MirPolCorr();
334 
335  casacore::Bool operator==(const MirPolCorr& that) const { return corr == that.corr; }
336  casacore::Bool operator==(casacore::Int poltype) const { return corr == poltype; }
337 
338  // set the independent ID. A value less than zero should be interpreted
339  // as meaning unset.
340  void setID(casacore::Int val) const { id = val; }
341 
342  // return the independent ID. A value less than zero should be interpreted
343  // as meaning unset.
344  casacore::Int getID() const { return id; }
345 
346  // clear the independent ID value
347  void clearID() const { id = -1; }
348 
349  // return the polarization correlation type in the Miriad
350  // convention (i.e. as read from the "pol" variable in a Miriad dataset).
351  casacore::Int getType() const { return corr; }
352 
353  // return the polarization type associated with the first
354  // receptor for this correlation type. The returned StokesType for
355  // non-true casacore::Stokes types will be that for a single type cross-correlated
356  // with itself.
358  return corratopol[corr+8];
359  }
360 
361  // return the polarization type associated with the second
362  // receptor for the given correlation type. The returned StokesType for
363  // non-true casacore::Stokes types will be that for a single type cross-correlated
364  // with itself.
366  return corrbtopol[corr+8];
367  }
368 
369  // return true if the given single polarization type is one of the
370  // components of this correlation type
372  return (getFirstPolType() == pol || getSecondPolType() == pol);
373  }
374 
375  // convert the Miriad polarization code to the AIPS
377 
378  // convert the Aips casacore::Stokes polarization code to the Miriad convention
380 
381  // return the AIPS++ casacore::Stokes type for the current polarization
383 
384  // return a string representation of this polarization
386 };
387 
388 // <summary>
389 // a static container for a set of Miriad polarization correlation types
390 // </summary>
391 //
392 // <use visibility=local>
393 //
394 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
395 // </reviewed>
396 //
397 // <etymology>
398 // the name is short for Constant Miriad Polarization Setup.
399 // </etymology>
400 //
401 // <synopsis>
402 // This class contains a list of polarization cross-correlation combinations.
403 // New correlations cannot be added to this list.
404 // </synopsis>
405 //
406 // <motivation>
407 // Miriad datasets record different polarization measurements in seperate
408 // records; thus, there is a notion of a current polarization among several
409 // being read. Furthermore, you usually don't know which polarizations
410 // are in the dataset until you've read at least one record with each kind
411 // of polarization. You do usually know the total number of different
412 // polarizations after reading the first record.
413 // </motivation>
414 //
415 //
416 class ConstMirPolSetup : public MirInfo {
417  public:
418  virtual ~ConstMirPolSetup();
419 
420  protected:
423 
427 
428  public:
429 
430  // return the number of polarization correlation types in this setup
432 
433  // set the current polarization correlation to the given type. true
434  // is returned if the type is found; if it is not, the current
435  // polarization is unchanged.
437  // Note: this has been made non-virtual on purpose
438  return find(poltype, iter);
439  }
440 
441  // return true if the given polarization correlation type is a member
442  // of this set
445  return find(poltype, li);
446  }
447 
448  // clear all the IDs associated with the polarization correlation types
449  // in this list
450  void clearIDs() {
452  for(li.toStart(); ! li.atEnd(); ++li) {
453  li.getRight().clearID();
454  }
455  }
456 
457  // return the list of polarization correlation types stored in this set
459 
460  // return the currently selected polarization
462 
463  // return the AIPS type for the current polarization. If no
464  // current polarization correlation type is set, YY is returned
467  }
468 };
469 
470 // <summary>
471 // an editable container for a set of Miriad polarization correlation types
472 // </summary>
473 //
474 // <use visibility=local>
475 //
476 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
477 // </reviewed>
478 //
479 // <etymology>
480 // the name is short for Miriad Polarization Setup.
481 // </etymology>
482 //
483 // <synopsis>
484 // This class contains a list of polarization cross-correlation combinations.
485 // This version allows new values to be added to the list.
486 // </synopsis>
487 //
488 // <motivation>
489 // Miriad datasets record different polarization measurements in seperate
490 // records; thus, there is a notion of a current polarization among several
491 // being read. Furthermore, you usually don't know which polarizations
492 // are in the dataset until you've read at least one record with each kind
493 // of polarization. You do usually know the total number of different
494 // polarizations after reading the first record.
495 // </motivation>
496 //
497 //
499  private:
500  // add a new correlation type to this list. This function assumes that
501  // the type does not already exist in the list.
502  void addCorr(casacore::Int poltype);
503 
504  public:
505  MirPolSetup();
507  virtual ~MirPolSetup();
508 
509  // set the current polarization correlation to the given type. If
510  // the type is not already part of this set, it will be added. true
511  // is returned if the type is found without having to add it.
513  if (! find(poltype, iter)) {
514  addCorr(poltype);
515  return false;
516  }
517  return true;
518  }
519 
520 };
521 
522 // <summary>
523 // a container for a set of Miriad (single-) polarization receptor types
524 // </summary>
525 //
526 // <use visibility=local>
527 //
528 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
529 // </reviewed>
530 //
531 // <etymology>
532 // the name is short for Miriad Polarization Receptors
533 // </etymology>
534 //
535 // <synopsis>
536 // This class contains a list of single-polarization types that correspond
537 // the types of polarizations a group of receptors are sensitive to.
538 //
539 // Single Polarization types are identified using the AIPS' StokesTypes
540 // enumeration. For non-true casacore::Stokes types, the value for the polarization
541 // cross-correlated with itself is used.
542 // </synopsis>
543 //
544 // <motivation>
545 // Miriad datasets record different polarization measurements in seperate
546 // records; thus, there is a notion of a current polarization among several
547 // being read. Furthermore, you usually don't know which polarizations
548 // are in the dataset until you've read at least one record with each kind
549 // of polarization. You do usually know the total number of different
550 // polarizations after reading the first record.
551 // </motivation>
552 //
553 //
554 class MirPolRecps : public MirInfo {
555  private:
558 
559  public:
560  MirPolRecps() : pols(), iter(pols) { }
561  virtual ~MirPolRecps();
562 
563  // return the number of distinct single polarization that make up
564  // this setup
565  casacore::uInt getPolCount() const { return pols.len(); }
566 
567  // add a polarization type if it isn't already added.
569  if (! hasPol(pol)) {
570  iter.toEnd();
571  iter.addRight(pol);
572  }
573  }
574 
575  // add the polarization types involved in the cross-correlation represented
576  // by the given correlation type
577  void addPolsFor(const MirPolCorr &pol) {
578  addPol(pol.getFirstPolType());
579  addPol(pol.getSecondPolType());
580  }
581 
582  // add the polarization types involved in the cross-correlations
583  // represented by the correlation types in the given list
586  for(li.toStart(); ! li.atEnd(); ++li)
587  addPolsFor(li.getRight());
588  }
589 
590  // return the i-th polarization
592  iter.pos(i);
593  return iter.getRight();
594  }
595 
596  // find the position of the given polarization type. -1 is returned
597  // if the polarization is not found
599  for(iter.toStart(); ! iter.atEnd(); ++iter) {
600  if (iter.getRight() == pol) return iter.pos();
601  }
602  return -1;
603  }
604 
605  // return true if the given polarization is present in this list
607 
608  // return the unique list of single polarization types that comprise
609  // the correlation types.
611 
612  // return a string representing the i-th polarization
614 
615  // return a string representing the given polarization
617  return casacore::String( (casacore::Stokes::name(pol)).at(0,1) );
618  }
619 };
620 
621 
622 // <summary>
623 // a container for source information
624 // </summary>
625 //
626 // <use visibility=local>
627 //
628 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
629 // </reviewed>
630 //
631 // <etymology>
632 // a description of a source and its position as stored in a Miriad dataset
633 // </etymology>
634 //
635 // <synopsis>
636 // This class contains the data describing a source from a Miriad dataset. <p>
637 //
638 // Most of the interaction with this class is through public data members (for
639 // programming and runtime efficiency); thus, this class is not appropriate for
640 // use outside of this module. A few helper funtions are provided to aid in
641 // utilizing the information (mainly for comparison with other MirSource objects).
642 // </synopsis>
643 //
644 // <motivation>
645 // a Miriad dataset may switch back and forth between different sources.
646 // The filler must keep track of them, and recognize them when the are reused.
647 // </motivation>
648 //
649 class MirSource : public MirInfo {
650  public:
651  enum SolSysObject {
663  };
664 
665  // the source name
667 
668  // the initial source position
670 
671  // the position epoch
673 
674  // the time of first observation
676 
677  // the source id
679 
680  // the first row of this source record appears in the SOURCE table.
682 
683  // a planet identifier
685 
686  // Planet names
688 
689  // a list of fields
691 
693  casacore::Double stime=0, casacore::Int sid=-1);
694  MirSource(int mirh, casacore::Double stime=0);
695  virtual ~MirSource();
696 
697  // return true if this source is the same as another.
698  // Two sources are considered the same if they have the same name and
699  // position epoch.
701  return (name==that.name && epoch==that.epoch);
702  }
703 
704  // return false if this source is the same as another.
706  return ! (*this == that);
707  }
708 
709  // return a pointer to a source in a given list of source that is equal
710  // to this source.
712  casacore::ListIter<MirSource*> li(srclist);
713  while (! li.atEnd() && *(li.getRight()) != *this) li++;
714  return ((li.atEnd()) ? NULL : li.getRight());
715  }
716 
717  // return a pointer to a source in a given list of source that has the same
718  // name as this source.
720  casacore::ListIter<MirSource*> li(srclist);
721  while (! li.atEnd() && li.getRight()->name != this->name) li++;
722  return ((li.atEnd()) ? NULL : li.getRight());
723  }
724 
725  // clear the ID values for all the source in a source list by setting them
726  // to -1.
727  static void clearIDs(casacore::List<MirSource*> &srclist) {
728  for(casacore::ListIter<MirSource*> li(srclist); ! li.atEnd(); ++li) {
729  li.getRight()->id = -1;
730  if (li.getRight()->flds.len() > 0) {
731  MirField::clearIDs(li.getRight()->flds);
732  }
733  }
734  }
735 
736  // return true if this source is a moving object (by virtue of having
737  // multiple positions added to this container).
738  casacore::Bool isMoving() { return (motion_p != 0); }
739 
740  // return true if this source is identified as a major solar system object
742 
743  // return true if this source is identified as a planet
744  casacore::Bool isPlanet() { return (solsys < SUN); }
745 
746  // return true if any of the fields is pointed off the main source
747  // position (as given by ra and dec)
749  if (flds.len() > 1) return true;
751  return (f.getRight()->dra != 0 || f.getRight()->ddec != 0);
752  }
753 
754  // add a new position for this source
756  if (! motion_p) {
757  motion_p = new std::map<casacore::Double, casacore::OrderedPair<casacore::Double, casacore::Double> >(
760  }
761  if (! motion_p->isDefined(mtime))
763  }
764 
765  // load the motion data into the given arrays
768  {
769  if (! motion_p) return;
770  casacore::uInt n = motion_p->ndefined();
771  time.resize(n);
772  ra.resize(n);
773  dec.resize(n);
774 
775  std::map<casacore::Double, casacore::OrderedPair<casacore::Double, casacore::Double> >::iterator iter motion_p->begin( );
776  for(casacore::uInt i=0; iter != motion_p->end( ); ++iter, ++i) {
777  time(i) = iter.getKey();
778  ra(i) = iter.getVal().x();
779  dec(i) = iter.getVal().y();
780  }
781  }
782 
784 
785  static casacore::Int nextID() {
786  casacore::Int out = nxtid_p;
787  nxtid_p++;
788  return out;
789  }
790 
791 private:
792  std::map<casacore::Double, casacore::OrderedPair<casacore::Double, casacore::Double> > *motion_p;
794 };
795 
796 // <summary>
797 // a pair of indicies identifying the spectral window and polarization ids
798 // that make up a data description ID
799 // </summary>
800 //
801 // <use visibility=local>
802 //
803 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
804 // </reviewed>
805 //
806 // <etymology>
807 // The casacore::Data Description subtable record has two main components: a spectral
808 // window ID and a polarization ID.
809 // </etymology>
810 //
811 // <synopsis>
812 // This class holds two IDs that make up the "data description" of a record
813 // in an casacore::MS MAIN table: the spectral window ID and the polarization ID.
814 // </synopsis>
815 //
816 // <motivation>
817 // Records in the MAIN casacore::MS table are linked to rows in the SPECTRAL_WINDOW and
818 // POLARIZATION subtables via a single DATA_DESC_ID; this class collects the
819 // indicies into those two subtables into a single class that can be linked to
820 // an ID in the DATA_DESCRIPTION subtable (via a casacore::Map).
821 // </motivation>
822 //
824  private:
827  public:
828  DataDescComponents(casacore::Int spwid=-1, casacore::Int polid=-1) : spw(spwid), pol(polid) { }
830 
831  // return the spectral window ID component
833 
834  // return the polarization ID component
835  casacore::Int getPolarizationID() const { return pol; }
836 
838  return (spw == other.spw && pol == other.pol);
839  }
840 
841  casacore::Bool exists() const { return (spw >= 0 && pol >= 0); }
842 };
843 
844 extern casacore::uInt hashFunc(const DataDescComponents& key);
845 
846 // <summary>
847 // a container for storing the Miriad metadata that must be tracked while
848 // filling
849 // </summary>
850 
851 // <use visibility=local>
852 
853 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
854 // </reviewed>
855 
856 // <prerequisite>
857 // <li> <linkto class="MirFiller">MirFiller</linkto>
858 // </prerequisite>
859 //
860 // <etymology>
861 // This stores the metadata from an input Miriad dataset (e.g. Miriad variable
862 // values) that are important for orchestrating its filling into a measurement
863 // set.
864 // </etymology>
865 //
866 // <synopsis>
867 // This class is a container for various information gleaned from the Miriad
868 // dataset that is important for organizing the data into a Measurement Set.
869 // It essentially holds all state information needed by MirFiller's functions
870 // during filling. <p>
871 //
872 // Most of the interaction with this class is through public data members (for
873 // programming and runtime efficiency); thus, this class is not appropriate for
874 // use outside of this module. A few helper funtions are provided to aid in
875 // utilizing the information.
876 // </synopsis>
877 //
878 // <motivation>
879 // This allows MirFiller to pass the state of the filling process to its internal
880 // functions rather than storing it as a member object. Thus, if one attempt
881 // to fill fails half way, MirFiller does not have to worry about cleaning up
882 // its internal state.
883 // </motivation>
884 //
885 //
887  public:
888 
889  // info that doesn't change during filling
890  casacore::MeasurementSet *ms; // the output ms
891  casacore::MSColumns *msc; // a pointer to its columns
893 
894  // output casacore::MS info that can vary during filling process
895  casacore::Int obsid; // ids & offsets
896  casacore::Float inttime; // the current integration time
898  casacore::Float plangle, plmaj, plmin, pltb; // miriad planet variables
899  casacore::Double freq; // rest frequency of the primary line -- used to convert
900  // pltb to flux using Raleigh-Jeans appx to BB.
909 
911 // casacore::ListIter<MirFreqSetup *> fsiter;
912 // IDIndex wfidx; // moved to MirFreqSetup
913 // IDIndex nfidx;
914 
917 // const casacore::List<MirSource*> *srclist;
918 
919 // casacore::ListIter<MirField *> flditer;
921 
924  casacore::Bool polotf; // set to true if loading polarizations on the fly
925  // PJT
926  //casacore::HashMap<DataDescComponents, casacore::Int> ddids;
927 
931 
932  // data-loading buffers
934 
935  static const casacore::String HATCREEK; // "HATCREEK"
936  static const casacore::String BIMA; // "BIMA"
937  static const casacore::String CARMA; // "CARMA"
938  static const casacore::String ATCA; // "ATCA"
939  static const casacore::String VLA; // "VLA"
940 
941  FillMetadata(const casacore::String &msfile="");
942  ~FillMetadata();
943 
944  // return the antenna id for a given miriad antenna number.
945  casacore::Int getAntennaID(casacore::Int antnum) { return arrayAnt+antnum-1; }
946 
947  // return the data description id for a given spectral window id.
949 #if 0
950  DataDescComponents ddid(sid, pid);
951  return (ddids.isDefined(ddid) ? ddids(ddid) : -1);
952 #else
953  return -1;
954 #endif
955  }
956 
957  // set all fiducial times to the given time
960  modeltime = time - updmodelint;
961  }
962 
963  // set the telescope. This will also set the telescope location if
964  // it is known.
965  void setTelescope(casacore::String tel);
966 
968  casacore::Int i;
969  for(i=nants-1; i >= 0; i--) {
970  if (antpos(i) != 999 ||
971  antpos(i+nants) != 999 ||
972  antpos(i+2*nants) != 999 ) break;
973  }
974  return ((i >= 0) ? i+1 : nants);
975  }
976 };
977 
978 #endif
979 
980 
a container for a single Miriad polarization correlation
Definition: FillMetadata.h:316
casacore::Int * mount
Definition: FillMetadata.h:906
IDIndex nfidx
the narrow window mapping index.
Definition: FillMetadata.h:237
MirFreqSetup(casacore::Int mir_handle)
create a new setup by reading the relevent variable data from the given miriad dataset handle ...
std::map< casacore::Double, casacore::OrderedPair< casacore::Double, casacore::Double > > * motion_p
Definition: FillMetadata.h:792
static const casacore::String BIMA
Definition: FillMetadata.h:936
t & getRight()
Returns the element to the right of the cursor.
Definition: List.h:679
casacore::Int find(casacore::Stokes::StokesTypes pol)
find the position of the given polarization type.
Definition: FillMetadata.h:598
int Int
Definition: aipstype.h:50
DataLoadingBuf buf
data-loading buffers
Definition: FillMetadata.h:933
casacore::ListIter< casacore::Stokes::StokesTypes > iter
Definition: FillMetadata.h:557
casacore::Double * rfreq
the rest frequency for each window
Definition: FillMetadata.h:219
casacore::Float ddec
Definition: FillMetadata.h:117
casacore::String toString(casacore::Int i) const
return a string representing the i-th polarization
Definition: FillMetadata.h:613
virtual ~MirFreqSetup()
casacore::Float * corbw
the correlator filter bandwidths
Definition: FillMetadata.h:192
casacore::Int narrays
Definition: FillMetadata.h:903
casacore::Bool exists() const
Definition: FillMetadata.h:841
static void clearIDs(casacore::List< MirField * > &fldlist)
clear the ID values for all the fields in a field list by setting them to -1.
Definition: FillMetadata.h:149
Ordered pair class.
Definition: OrderedPair.h:60
MirPolCorr(casacore::Int poltype)
create a container.
casacore::Float plmaj
Definition: FillMetadata.h:898
MirPolRecps * polrecp
Definition: FillMetadata.h:923
casacore::Int id
the ID assigned to this setup within the casacore::MeasurementSet being filled.
Definition: FillMetadata.h:233
a container for storing the Miriad metadata that must be tracked while filling
Definition: FillMetadata.h:886
casacore::Int tsyscorrect
Definition: FillMetadata.h:930
casacore::Int * nschan
the number of channels in each window
Definition: FillMetadata.h:207
casacore::Stokes::StokesTypes getFirstPolType() const
return the polarization type associated with the first receptor for this correlation type...
Definition: FillMetadata.h:357
casacore::Float inttime
Definition: FillMetadata.h:896
void getMotion(casacore::Vector< casacore::Double > &time, casacore::Vector< casacore::Double > &ra, casacore::Vector< casacore::Double > &dec)
load the motion data into the given arrays
Definition: FillMetadata.h:766
SolSysObject solsys
a planet identifier
Definition: FillMetadata.h:684
Bool atEnd() const
Definition: List.h:373
void clearIDs()
clear all the IDs associated with the polarization correlation types in this list ...
Definition: FillMetadata.h:450
casacore::String name
the source name
Definition: FillMetadata.h:666
casacore::Bool setCorr(casacore::Int poltype)
set the current polarization correlation to the given type.
Definition: FillMetadata.h:436
a container for a set of Miriad (single-) polarization receptor types
Definition: FillMetadata.h:554
an editable container for a set of Miriad polarization correlation types
Definition: FillMetadata.h:498
casacore::Int id
the ID assigned to this field within the casacore::MeasurementSet being filled.
Definition: FillMetadata.h:121
casacore::Float dra
the position offsets
Definition: FillMetadata.h:117
MirFreqSetup * fsetup
Definition: FillMetadata.h:910
virtual ~MirSource()
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
casacore::Int getType() const
return the polarization correlation type in the Miriad convention (i.e.
Definition: FillMetadata.h:351
casacore::Bool operator==(MirFreqSetup &that)
return true if this setup is the same as another.
casacore::Double time
the time of first observation
Definition: FillMetadata.h:675
static const casacore::String ATCA
Definition: FillMetadata.h:938
casacore::Float epoch
the position epoch
Definition: FillMetadata.h:672
casacore::Float plmin
Definition: FillMetadata.h:898
casacore::Matrix< casacore::Float > wsystemp
Definition: FillMetadata.h:929
static const casacore::String HATCREEK
Definition: FillMetadata.h:935
FillMetadata(const casacore::String &msfile="")
casacore::Int spw
Definition: FillMetadata.h:825
virtual ~MirInfo()
casacore::Double freq
the reference frequency for this setup.
Definition: FillMetadata.h:229
void clearID() const
clear the independent ID value
Definition: FillMetadata.h:347
casacore::Bool isMoving()
return true if this source is a moving object (by virtue of having multiple positions added to this c...
Definition: FillMetadata.h:738
casacore::Int getAntennaID(casacore::Int antnum)
return the antenna id for a given miriad antenna number.
Definition: FillMetadata.h:945
static SolSysObject matchSolSysObj(const casacore::String &name)
void addPolsFor(ConstMirPolSetup &pol)
add the polarization types involved in the cross-correlations represented by the correlation types in...
Definition: FillMetadata.h:584
casacore::Int nants
Definition: FillMetadata.h:903
static const casacore::String VLA
Definition: FillMetadata.h:939
MirSource * findNameIn(casacore::List< MirSource * > &srclist)
return a pointer to a source in a given list of source that has the same name as this source...
Definition: FillMetadata.h:719
casacore::Float * corf
the correlator LO frequencies
Definition: FillMetadata.h:195
MirField * findIn(casacore::List< MirField * > &fldlist)
return a pointer to a field in a given list of fields that is equal to this field.
Definition: FillMetadata.h:141
StokesTypes
The Stokes types are defined by this enum.
Definition: Stokes.h:66
a base for classes that rely on assumptions regarding privitive type sizes.
void clear()
clear the id and index maps
Definition: FillMetadata.h:262
MirSource * findIn(casacore::List< MirSource * > &srclist)
return a pointer to a source in a given list of source that is equal to this source.
Definition: FillMetadata.h:711
casacore::Int getSpectralWindowID() const
return the spectral window ID component
Definition: FillMetadata.h:832
static casacore::Int nextID()
Definition: FillMetadata.h:785
static casacore::Stokes::StokesTypes toAips(casacore::Int pol)
convert the Miriad polarization code to the AIPS
void setID(casacore::Int val) const
set the independent ID.
Definition: FillMetadata.h:340
uInt len() const
Returns the length of the list.
Definition: List.h:213
casacore::Float * wfreq
the center frequency of each wideband channel
Definition: FillMetadata.h:222
static void clearIDs(casacore::List< MirFreqSetup * > &setuplist)
clear the ID values for all the setups in a setup list by setting them to -1.
Definition: FillMetadata.h:278
casacore::String toString() const
return a string representation of this polarization
Definition: FillMetadata.h:385
casacore::Double * sdf
the frequency separation between channels in each window
Definition: FillMetadata.h:216
casacore::MeasurementSet * ms
info that doesn&#39;t change during filling
Definition: FillMetadata.h:890
casacore::Int row
the first row of this source record appears in the SOURCE table.
Definition: FillMetadata.h:681
casacore::Float plangle
Definition: FillMetadata.h:898
virtual ~ConstMirPolSetup()
casacore::String project
Definition: FillMetadata.h:901
casacore::Stokes::StokesTypes getSecondPolType() const
return the polarization type associated with the second receptor for the given correlation type...
Definition: FillMetadata.h:365
static String name(StokesTypes stokesType)
convert StokesTypes to String, Stokes::Undefined returns &quot;??&quot;.
casacore::Double lasttime
Definition: FillMetadata.h:908
void toEnd()
This function moves the cursor to the end of the list.
Definition: List.h:499
casacore::Int obsid
output casacore::MS info that can vary during filling process
Definition: FillMetadata.h:895
MirFreqSetup * findIn(casacore::List< MirFreqSetup * > &setuplist)
return a pointer to a setup in a given list of setups that is equal to this setup.
Definition: FillMetadata.h:270
casacore::Bool operator==(const DataDescComponents &other) const
Definition: FillMetadata.h:837
virtual uInt pos(uInt)
&quot;pos()&quot; without arguments returns the current postion of the cursor.
linear correlation products
Definition: Stokes.h:85
const casacore::List< MirPolCorr > & getCorrs()
return the list of polarization correlation types stored in this set
Definition: FillMetadata.h:458
void addPol(casacore::Stokes::StokesTypes pol)
add a polarization type if it isn&#39;t already added.
Definition: FillMetadata.h:568
casacore::Vector< casacore::Double > antpos
Definition: FillMetadata.h:904
casacore::Bool operator==(const MirField &that)
return true if this field&#39;s offsets match those of another
Definition: FillMetadata.h:130
casacore::Int corr
Definition: FillMetadata.h:318
casacore::Matrix< casacore::Float > nsystemp
PJT casacore::HashMap&lt;DataDescComponents, casacore::Int&gt; ddids;
Definition: FillMetadata.h:928
casacore::Double starttime
Definition: FillMetadata.h:908
casacore::Int nspect
the number of spectral windows
Definition: FillMetadata.h:198
void addPosition(casacore::Double mtime, casacore::Double mra, casacore::Double mdec)
add a new position for this source
Definition: FillMetadata.h:755
static const casacore::String solSysNames[]
Planet names.
Definition: FillMetadata.h:687
double Double
Definition: aipstype.h:55
void setTelescope(casacore::String tel)
set the telescope.
casacore::List< casacore::Stokes::StokesTypes > pols
Definition: FillMetadata.h:556
casacore::List< MirField * > flds
a list of fields
Definition: FillMetadata.h:690
MirPolCorr & getCurrent()
return the currently selected polarization
Definition: FillMetadata.h:461
casacore::uInt getPolCount() const
return the number of distinct single polarization that make up this setup
Definition: FillMetadata.h:565
casacore::String telescope
pltb to flux using Raleigh-Jeans appx to BB.
Definition: FillMetadata.h:901
void inittime(casacore::Double time, casacore::Double updmodelint=0)
set all fiducial times to the given time
Definition: FillMetadata.h:958
casacore::Bool operator==(casacore::Int poltype) const
Definition: FillMetadata.h:336
a container for data buffers used to fill a measurement set
MirSource(casacore::String source, casacore::Double sra, casacore::Double sdec, casacore::Float sepoch, casacore::Double stime=0, casacore::Int sid=-1)
casacore::ListIter< MirPolCorr > iter
Definition: FillMetadata.h:422
casacore::Int getPolarizationID() const
return the polarization ID component
Definition: FillMetadata.h:835
static casacore::Int toMiriad(casacore::Stokes::StokesTypes pol)
convert the Aips casacore::Stokes polarization code to the Miriad convention
casacore::Double obstime
Definition: FillMetadata.h:908
casacore::Bool obsupd
Definition: FillMetadata.h:902
MirField(casacore::Float delra, casacore::Float deldec, casacore::Int fid=-1)
create a new field description
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
IDIndex wfidx
the wideband mapping index.
Definition: FillMetadata.h:241
casacore::Double * sfreq
the frequency of the first channel in each window
Definition: FillMetadata.h:213
float Float
Definition: aipstype.h:54
casacore::Bool movingsrc
Definition: FillMetadata.h:916
casacore::Double freq
Definition: FillMetadata.h:899
casacore::Double feedtime
Definition: FillMetadata.h:908
casacore::Float jyperk
Definition: FillMetadata.h:897
casacore::Double modeltime
Definition: FillMetadata.h:908
casacore::Double dec
Definition: FillMetadata.h:669
casacore::Bool hasPol(casacore::Stokes::StokesTypes pol)
return true if the given polarization is present in this list
Definition: FillMetadata.h:606
static casacore::Int nxtid_p
Definition: FillMetadata.h:793
casacore::Double * diam
Definition: FillMetadata.h:907
casacore::String outname
Definition: FillMetadata.h:892
a container for source information
Definition: FillMetadata.h:649
const casacore::List< casacore::Stokes::StokesTypes > & getPols() const
return the unique list of single polarization types that comprise the correlation types...
Definition: FillMetadata.h:610
virtual ~MirPolSetup()
casacore::Bool offSource()
return true if any of the fields is pointed off the main source position (as given by ra and dec) ...
Definition: FillMetadata.h:748
casacore::Int getID() const
return the independent ID.
Definition: FillMetadata.h:344
casacore::Bool isSolSysObj()
return true if this source is identified as a major solar system object
Definition: FillMetadata.h:741
casacore::Int * ischan
the number of the first channel in each window
Definition: FillMetadata.h:210
casacore::Int pol
Definition: FillMetadata.h:826
virtual ~MirField()
delete this field
casacore::Int bimaAntCount()
Definition: FillMetadata.h:967
a pair of indicies identifying the spectral window and polarization ids that make up a data descripti...
Definition: FillMetadata.h:823
casacore::List< MirPolCorr > corrs
Definition: FillMetadata.h:421
void addRight(t e)
This function adds the element to the right of the current cursor position.
Definition: List.h:647
A Table intended to hold astronomical data (a set of Measurements).
ConstMirPolSetup * pol
Definition: FillMetadata.h:922
casacore::Int nwide
the number of wideband channels
Definition: FillMetadata.h:201
casacore::Int getDataDescID(casacore::Int=0, casacore::Int=0)
return the data description id for a given spectral window id.
Definition: FillMetadata.h:948
casacore::Bool operator==(const MirPolCorr &that) const
Definition: FillMetadata.h:335
virtual ~MirPolRecps()
MirField * field
const casacore::List&lt;MirSource*&gt; *srclist;
Definition: FillMetadata.h:920
casacore::Int arrayAnt
Definition: FillMetadata.h:903
casacore::Bool hasPol(casacore::Stokes::StokesTypes pol) const
return true if the given single polarization type is one of the components of this correlation type ...
Definition: FillMetadata.h:371
DataDescComponents(casacore::Int spwid=-1, casacore::Int polid=-1)
Definition: FillMetadata.h:828
casacore::Int nchan
the total number of spectral line channels
Definition: FillMetadata.h:204
casacore::Int id
the source id
Definition: FillMetadata.h:678
virtual ~MirPolCorr()
delete the container
casacore::Vector< casacore::Double > arrayXYZ
Definition: FillMetadata.h:905
Doubly linked non-constant list iterator The List class above only provides for the list framework...
Definition: List.h:53
casacore::Bool operator!=(MirFreqSetup &that)
return false if this setup is the same as another.
Definition: FillMetadata.h:257
casacore::Stokes::StokesTypes getCurrentAipsType()
return the AIPS type for the current polarization.
Definition: FillMetadata.h:465
a container for field information
Definition: FillMetadata.h:113
void clear()
remove all ID mappings.
Definition: IDIndex.h:122
casacore::Bool find(casacore::Int poltype, casacore::ConstListIter< MirPolCorr > &li)
A class to provide easy read-write access to MeasurementSet columns.
Definition: MSColumns.h:221
casacore::Float pltb
Definition: FillMetadata.h:898
casacore::Double ra
the initial source position
Definition: FillMetadata.h:669
a static container for a set of Miriad polarization correlation types
Definition: FillMetadata.h:416
casacore::uInt hashFunc(const DataDescComponents &key)
MirSource * source
casacore::ListIter&lt;MirFreqSetup *&gt; fsiter; IDIndex wfidx; // moved to MirFreqSetup IDIndex nfidx; ...
Definition: FillMetadata.h:915
void addCorr(casacore::Int poltype)
add a new correlation type to this list.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Float * wwidth
the bandwidth of each wideband channel
Definition: FillMetadata.h:225
static const casacore::Stokes::StokesTypes corratopol[]
Definition: FillMetadata.h:321
static casacore::String polToString(casacore::Stokes::StokesTypes pol)
return a string representing the given polarization
Definition: FillMetadata.h:616
casacore::Stokes::StokesTypes getAipsType() const
return the AIPS++ casacore::Stokes type for the current polarization
Definition: FillMetadata.h:382
const t & getRight() const
Returns the element to the right of the cursor.
Definition: List.h:465
void resize(size_t len, Bool copyValues=False)
Definition: Vector.h:167
casacore::Bool operator!=(const MirField &that)
return false if this field&#39;s offsets match those of another
Definition: FillMetadata.h:135
static const casacore::String CARMA
Definition: FillMetadata.h:937
casacore::Bool hasCorr(casacore::Int poltype)
return true if the given polarization correlation type is a member of this set
Definition: FillMetadata.h:443
casacore::Bool operator==(const MirSource &that)
return true if this source is the same as another.
Definition: FillMetadata.h:700
MirPolCorr(const MirPolCorr &that)
create a copy of a container.
Definition: FillMetadata.h:330
casacore::Bool isPlanet()
return true if this source is identified as a planet
Definition: FillMetadata.h:744
casacore::Bool polotf
Definition: FillMetadata.h:924
casacore::Int id
Definition: FillMetadata.h:319
an abstract base for classes that contain information about some part of a Miriad Dataset ...
Definition: FillMetadata.h:76
void toStart()
This function moves the cursor to the beginning of the list.
Definition: List.h:492
casacore::MSColumns * msc
Definition: FillMetadata.h:891
casacore::Bool operator!=(const MirSource &that)
return false if this source is the same as another.
Definition: FillMetadata.h:705
casacore::uInt getCorrCount()
return the number of polarization correlation types in this setup
Definition: FillMetadata.h:431
a simple mapping from one indexing system to another
Definition: IDIndex.h:87
casacore::Bool setCorr(casacore::Int poltype)
set the current polarization correlation to the given type.
Definition: FillMetadata.h:512
unsigned int uInt
Definition: aipstype.h:51
casacore::Int mode
the correlator mode
Definition: FillMetadata.h:189
static void clearIDs(casacore::List< MirSource * > &srclist)
clear the ID values for all the source in a source list by setting them to -1.
Definition: FillMetadata.h:727
static const casacore::Stokes::StokesTypes corrbtopol[]
Definition: FillMetadata.h:322
void addPolsFor(const MirPolCorr &pol)
add the polarization types involved in the cross-correlation represented by the given correlation typ...
Definition: FillMetadata.h:577
A description of a Miriad spectroscopy (correlator) setup.
Definition: FillMetadata.h:185
casacore::Stokes::StokesTypes getPol(casacore::Int i) const
return the i-th polarization
Definition: FillMetadata.h:591
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42