casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpectralWindowRecord.h
Go to the documentation of this file.
1 /*
2  * SpectralWindowRecord.h
3  *
4  * Created on: Jan 27, 2016
5  * Author: nakazato
6  */
7 
8 #ifndef SINGLEDISH_FILLER_SPECTRALWINDOWRECORD_H_
9 #define SINGLEDISH_FILLER_SPECTRALWINDOWRECORD_H_
10 
16 
17 namespace casa { //# NAMESPACE CASA - BEGIN
18 namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
19 
23 
24  // meta
26 
27  // mandatory
33 
34  // optional
36 
37  // for dummy entry
40  casacore::Int const d_freq = 0.0;
41 
42  // method
43  void clear() {
44  spw_id = -1;
45  name = "";
46  meas_freq_ref = -1;
47  num_chan = 0;
48  refpix = 0.0;
49  refval = 0.0;
50  increment = 0.0;
51  }
52 
54  spw_id = other.spw_id;
55  name = other.name;
57  num_chan = other.num_chan;
58  refpix = other.refpix;
59  refval = other.refval;
60  increment = other.increment;
61  return *this;
62  }
63 
64  void add(AssociatingTable &table, AssociatingColumns &columns) {
66  casacore::uInt nrow = table.nrow();
67  if (nrow <= uspw_id) {
68  table.addRow(uspw_id - nrow + 1);
69  casacore::uInt new_nrow = table.nrow();
70  for (casacore::uInt i = nrow; i < new_nrow - 1; ++i) {
71  columns.numChan().put(i, d_num_chan);
72  columns.refFrequency().put(i, d_freq);
73  columns.totalBandwidth().put(i, d_freq);
74  columns.chanFreq().put(i, d_array);
75  columns.chanWidth().put(i, d_array);
76  columns.effectiveBW().put(i, d_array);
77  columns.resolution().put(i, d_array);
78  }
79  }
80  }
81 
83  if (spw_id < 0) {
84  return false;
85  }
86 
87  casacore::uInt nrow = columns.nrow();
88 
89  if (nrow <= (casacore::uInt) spw_id) {
90  return false;
91  }
92 
93  columns.numChan().put(spw_id, num_chan);
94  columns.measFreqRef().put(spw_id, meas_freq_ref);
95  casacore::Double tot_bw = num_chan * fabs(increment);
96  columns.totalBandwidth().put(spw_id, tot_bw);
97  casacore::Double ref_frequency = refval - refpix * increment;
98  columns.refFrequency().put(spw_id, ref_frequency);
100  indgen(freq, ref_frequency, increment);
101  columns.chanFreq().put(spw_id, freq);
102  freq = increment;
103  columns.chanWidth().put(spw_id, freq);
104  freq = abs(freq);
105  columns.effectiveBW().put(spw_id, freq);
106  columns.resolution().put(spw_id, freq);
107  casacore::Int net_sideband = 0; // USB
108  if (increment < 0.0) {
109  net_sideband = 1; // LSB
110  }
111  columns.netSideband().put(spw_id, net_sideband);
112  if (name.size() > 0) {
113  columns.name().put(spw_id, name);
114  }
115 
116  return true;
117  }
118 };
119 
120 } //# NAMESPACE SDFILLER - END
121 } //# NAMESPACE CASA - END
122 
123 #endif /* SINGLEDISH_FILLER_SPECTRALWINDOWRECORD_H_ */
void addRow(uInt nrrow=1, Bool initialize=False)
Add one or more rows at the end of the table.
Definition: Table.h:1235
ScalarColumn< Int > & numChan()
int Int
Definition: aipstype.h:50
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
casacore::Vector< casacore::Double > const d_array
ScalarColumn< String > & name()
ArrayColumn< Double > & resolution()
casacore::MSSpWindowColumns AssociatingColumns
SpectralWindowRecord & operator=(SpectralWindowRecord const &other)
void put(uInt rownr, const Array< T > &array)
Put the array in a particular cell (i.e.
size_type size() const
Capacity, size.
Definition: String.h:342
ArrayColumn< Double > & chanFreq()
Read-write access to required columns.
casacore::MSSpectralWindow AssociatingTable
ArrayColumn< Double > & chanWidth()
ScalarColumn< Int > & netSideband()
ScalarColumn< Double > & refFrequency()
double Double
Definition: aipstype.h:55
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
void add(AssociatingTable &table, AssociatingColumns &columns)
A class to provide easy read-write access to MSSpectralWindow columns.
ScalarColumn< Double > & totalBandwidth()
casacore::Int const d_num_chan
for dummy entry
ScalarColumn< Int > & measFreqRef()
void indgen(TableVector< T > &tv, Int start, Int inc)
Definition: TabVecMath.h:400
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
uInt nrow() const
Get the number of rows.
Definition: Table.h:1201
void put(uInt rownr, const T &value)
Put the value in a particular cell (i.e.
Definition: ScalarColumn.h:198
casacore::Bool fill(casacore::uInt, AssociatingColumns &columns)
ArrayColumn< Double > & effectiveBW()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
unsigned int uInt
Definition: aipstype.h:51
A Table intended to hold a MeasurementSet SPECTRAL_WINDOW table.