Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMath.cc
r2 r9 78 78 } 79 79 // averaging using mask 80 MaskedArray<Float> nma 80 MaskedArray<Float> nma(narr,(narr > Float(0))); 81 81 outarr /= nma; 82 82 Array<Bool> outflagsb = !(nma.getMask()); 83 Array<uChar> outflags(outflagsb.shape()); 84 convertArray(outflags,outflagsb); 83 85 SDContainer sc(ip(0),ip(1),ip(2),ip(3)); 84 86 … … 90 92 sc.sourcename = tstr; 91 93 sc.putSpectrum(outarr); 92 //sc.putFlags(outflags);94 sc.putFlags(outflags); 93 95 SDMemTable* sdmt = new SDMemTable(*in); 94 96 sdmt->putSDContainer(sc); 95 97 return CountedPtr<SDMemTable>(sdmt); 96 98 } 99 100 static CountedPtr<SDMemTable> 101 SDMath::quotient(const CountedPtr<SDMemTable>& on, 102 const CountedPtr<SDMemTable>& off) { 103 104 Table ton = on->table(); 105 Table toff = off->table(); 106 ROArrayColumn<Float> tsys(ton, "TSYS"); 107 108 ROScalarColumn<Double> mjd(ton, "TIME"); 109 ROScalarColumn<String> srcn(ton, "SRCNAME"); 110 MaskedArray<Float> mon(on->rowAsMaskedArray(0)); 111 MaskedArray<Float> moff(off->rowAsMaskedArray(0)); 112 IPosition ipon = mon.shape(); 113 IPosition ipoff = moff.shape(); 114 Array<Float> tsarr(tsys.shape(0)); 115 116 if (ipon != ipoff && ipon != tsarr.shape()) 117 cerr << "on/off not conformant" << endl; 118 119 //IPosition test = mon.shape()/2; 120 MaskedArray<Float> tmp = (mon-moff); 121 Array<Float> out(tmp.getArray()); 122 out /= moff; 123 out *= tsarr; 124 Array<Bool> outflagsb = !(mon.getMask() && moff.getMask()); 125 Array<uChar> outflags(outflagsb.shape()); 126 convertArray(outflags,outflagsb); 127 128 SDContainer sc(ipon(0),ipon(1),ipon(2),ipon(3)); 129 String tstr; srcn.getScalar(0,tstr);// get sourcename of "on" scan 130 sc.sourcename = tstr; 131 Double tme; mjd.getScalar(0,tme);// get time of "on" scan 132 sc.timestamp = tme; 133 sc.putSpectrum(out); 134 sc.putFlags(outflags); 135 SDMemTable* sdmt = new SDMemTable(*on); 136 sdmt->putSDContainer(sc); 137 return CountedPtr<SDMemTable>(sdmt); 138 139 } 140 141 -
trunk/src/SDMath.h
r2 r9 41 41 public: 42 42 static CountedPtr<SDMemTable> average(const CountedPtr<SDMemTable>& in); 43 //SDMemTable quotient(const SDMemTable& on, const SDMemTable& off); 44 //SDMemTable multiply(SDMemTable& in, Float factor); 43 static CountedPtr<SDMemTable> quotient(const CountedPtr<SDMemTable>& on, 44 const CountedPtr<SDMemTable>& off); 45 //CountedPtr<SDMemTable> multiply(CountedPtr<SDMemTable>& in, Float factor); 45 46 46 47 };
Note:
See TracChangeset
for help on using the changeset viewer.