Changeset 15
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r13 r15 55 55 ROScalarColumn<Double> mjd(t, "TIME"); 56 56 ROScalarColumn<String> srcn(t, "SRCNAME"); 57 ROScalarColumn<Double> integr(t, "INTERVAL"); 57 58 IPosition ip = in->rowAsMaskedArray(0).shape(); 58 59 Array<Float> outarr(ip); outarr =0.0; … … 63 64 Array<Float> outtsarr(tsys.shape(0)); 64 65 Double tme = 0.0; 66 Double inttime = 0.0; 65 67 66 68 for (uInt i=0; i < t.nrow(); i++) { … … 76 78 mjd.get(i,tmp); 77 79 tme += tmp;// average time 80 integr.get(i,tmp); 81 inttime += tmp; 78 82 } 79 83 // averaging using mask … … 88 92 outtsarr /= Float(n/2); 89 93 sc.timestamp = tme/Double(n/2); 90 91 String tstr; srcn.getScalar( n,tstr);// get sourcename of "mid" point94 sc.interval =inttime; 95 String tstr; srcn.getScalar(0,tstr);// get sourcename of "mid" point 92 96 sc.sourcename = tstr; 93 97 sc.putSpectrum(outarr); 94 98 sc.putFlags(outflags); 95 SDMemTable* sdmt = new SDMemTable(*in );99 SDMemTable* sdmt = new SDMemTable(*in,True); 96 100 sdmt->putSDContainer(sc); 97 101 return CountedPtr<SDMemTable>(sdmt); … … 104 108 Table ton = on->table(); 105 109 Table toff = off->table(); 106 ROArrayColumn<Float> tsys(toff, "TSYS"); 107 110 ROArrayColumn<Float> tsys(toff, "TSYS"); 108 111 ROScalarColumn<Double> mjd(ton, "TIME"); 112 ROScalarColumn<Double> integr(ton, "INTERVAL"); 109 113 ROScalarColumn<String> srcn(ton, "SRCNAME"); 110 114 MaskedArray<Float> mon(on->rowAsMaskedArray(0)); … … 131 135 Double tme; mjd.getScalar(0,tme);// get time of "on" scan 132 136 sc.timestamp = tme; 137 integr.getScalar(0,tme); 138 sc.interval = tme; 133 139 sc.putSpectrum(out); 134 140 sc.putFlags(outflags); 135 SDMemTable* sdmt = new SDMemTable(*on );141 SDMemTable* sdmt = new SDMemTable(*on, True); 136 142 sdmt->putSDContainer(sc); 137 143 return CountedPtr<SDMemTable>(sdmt); 138 144 139 145 } 146 static CountedPtr<SDMemTable> 147 SDMath::multiply(const CountedPtr<SDMemTable>& in, Float factor) { 148 SDMemTable* sdmt = new SDMemTable(*in); 149 Table t = sdmt->table(); 150 ArrayColumn<Float> spec(t,"SPECTRA"); 140 151 141 152 for (uInt i=0; i < t.nrow(); i++) { 153 // data stuff 154 MaskedArray<Float> marr(sdmt->rowAsMaskedArray(i)); 155 marr *= factor; 156 spec.put(i, marr.getArray()); 157 } 158 return CountedPtr<SDMemTable>(sdmt); 159 } 160 /* 161 static Float SDMath::rms(const SDMemTable& in, uInt whichRow) { 162 Table t = in.table(); 163 MaskedArray<Float> marr(in.rowAsMaskedArray(whichRow,True)); 164 165 } 166 */ -
trunk/src/SDMath.h
r9 r15 43 43 static CountedPtr<SDMemTable> quotient(const CountedPtr<SDMemTable>& on, 44 44 const CountedPtr<SDMemTable>& off); 45 //CountedPtr<SDMemTable> multiply(CountedPtr<SDMemTable>& in, Float factor); 45 static CountedPtr<SDMemTable> multiply(const CountedPtr<SDMemTable>& in, 46 Float factor); 47 46 48 47 49 }; -
trunk/src/python_SDMath.cc
r12 r15 42 42 .def("average", &SDMathWrapper::average) 43 43 .def("quotient", &SDMathWrapper::quotient) 44 .def("multiply", &SDMathWrapper::multiply) 44 45 ; 45 46 };
Note:
See TracChangeset
for help on using the changeset viewer.