Changeset 3106 for trunk/external-alma/components/SpectralComponents
- Timestamp:
- 10/04/16 18:20:50 (8 years ago)
- Location:
- trunk/external-alma/components/SpectralComponents
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/components/SpectralComponents/CompiledSpectralElement.h
r2980 r3106 69 69 // Construct a compiled string 70 70 explicit CompiledSpectralElement( 71 const String& function, const Vector<Double>& param71 const casacore::String& function, const casacore::Vector<casacore::Double>& param 72 72 ); 73 73 … … 97 97 98 98 // Save to a record. 99 virtual Bool toRecord(RecordInterface& out) const;99 virtual casacore::Bool toRecord(RecordInterface& out) const; 100 100 101 101 protected: … … 105 105 // For subclasses. Parameters and function must be set after construction. 106 106 explicit CompiledSpectralElement( 107 SpectralElement::Types type, const Vector<Double>& param=Vector<Double>(0)107 SpectralElement::Types type, const casacore::Vector<casacore::Double>& param=casacore::Vector<casacore::Double>(0) 108 108 ); 109 109 110 110 CompiledSpectralElement( 111 SpectralElement::Types type, uInt nParam111 SpectralElement::Types type, casacore::uInt nParam 112 112 ); 113 113 114 virtual void _setFunction(const String& function);114 virtual void _setFunction(const casacore::String& function); 115 115 116 116 /* -
trunk/external-alma/components/SpectralComponents/GaussianSpectralElement.h
r2980 r3106 76 76 //# Constants 77 77 // Sigma to FWHM conversion factor 78 static const Double SigmaToFWHM;78 static const casacore::Double SigmaToFWHM; 79 79 80 80 //# Constructors … … 86 86 // </thrown> 87 87 GaussianSpectralElement( 88 const Double ampl, constDouble center,89 const Double sigma88 const casacore::Double ampl, const casacore::Double center, 89 const casacore::Double sigma 90 90 ); 91 91 … … 95 95 // <li> AipsError if sigma == 0.0 96 96 // </thrown> 97 GaussianSpectralElement(const Vector<Double> ¶m);97 GaussianSpectralElement(const casacore::Vector<casacore::Double> ¶m); 98 98 // Copy constructor (deep copy) 99 99 // <thrown> … … 114 114 // GaussianSpectralElement& operator=(const GaussianSpectralElement &other); 115 115 // Evaluate the value of the element at x 116 // Double operator()(constDouble x) const;116 //casacore::Double operator()(const casacore::Double x) const; 117 117 118 Double getSigma() const;119 Double getFWHM() const;118 casacore::Double getSigma() const; 119 casacore::Double getFWHM() const; 120 120 121 Double getSigmaErr() const;122 Double getFWHMErr() const;121 casacore::Double getSigmaErr() const; 122 casacore::Double getFWHMErr() const; 123 123 124 124 125 void setSigma( Double sigma);126 void setFWHM( Double fwhm);125 void setSigma(casacore::Double sigma); 126 void setFWHM(casacore::Double fwhm); 127 127 128 void fixSigma(const Bool fix=True);128 void fixSigma(const casacore::Bool fix=True); 129 129 130 Bool fixedSigma() const;130 casacore::Bool fixedSigma() const; 131 131 132 Double getIntegral() const;132 casacore::Double getIntegral() const; 133 133 134 134 // Save to a record. For Gaussian elements, 135 135 // the width is defined as a FWHM in the record interface. 136 Bool toRecord(RecordInterface &out) const;136 casacore::Bool toRecord(RecordInterface &out) const; 137 137 138 138 // Sigma to FWHM 139 139 // Convert from sigma to FWHM and vice versa 140 140 // <group> 141 static Double sigmaFromFWHM (constDouble fwhm);141 static casacore::Double sigmaFromFWHM (const casacore::Double fwhm); 142 142 143 static Double sigmaToFWHM (constDouble sigma);143 static casacore::Double sigmaToFWHM (const casacore::Double sigma); 144 144 // </group> 145 145 146 void set(const Vector<Double>& v);146 void set(const casacore::Vector<casacore::Double>& v); 147 147 148 148 private: … … 150 150 // but the second param of the corresponding Gaussian1D function is the 151 151 // FWHM :( 152 void _set(const Vector<Double>& v);152 void _set(const casacore::Vector<casacore::Double>& v); 153 153 154 154 }; -
trunk/external-alma/components/SpectralComponents/Spectral2Estimate.tcc
r2980 r3106 18 18 //# 19 19 //# Correspondence concerning AIPS++ should be addressed as follows: 20 //# Internet email: aips2-request@nrao.edu.20 //# casacore::Internet email: aips2-request@nrao.edu. 21 21 //# Postal address: AIPS++ Project Office 22 22 //# National Radio Astronomy Observatory … … 40 40 //# Member templates 41 41 template <class MT> 42 const SpectralList &SpectralEstimate::estimate(const Vector<MT> &prof,43 Vector<MT> *der) {42 const SpectralList &SpectralEstimate::estimate(const casacore::Vector<MT> &prof, 43 casacore::Vector<MT> *der) { 44 44 if (prof.nelements() != lprof_p) { 45 45 delete [] deriv_p; deriv_p = 0; lprof_p = 0; 46 46 lprof_p = prof.nelements(); 47 deriv_p = new Double[lprof_p];47 deriv_p = new casacore::Double[lprof_p]; 48 48 }; 49 49 // Check if signal in window 50 50 if (!window(prof)) return slist_p; 51 51 // Limit window 52 windowEnd_p = min(windowEnd_p+q_p , Int(lprof_p));52 windowEnd_p = min(windowEnd_p+q_p , casacore::Int(lprof_p)); 53 53 windowLow_p = max(windowLow_p-q_p , 0 ); 54 54 // Get the second derivatives … … 56 56 // Next for debugging 57 57 if (der) { 58 for ( uInt i=0; i<lprof_p; i++) (*der)[i] = deriv_p[i];58 for (casacore::uInt i=0; i<lprof_p; i++) (*der)[i] = deriv_p[i]; 59 59 }; 60 60 // Find the estimates (sorted) … … 65 65 66 66 template <class MT> 67 const SpectralList& SpectralEstimate::estimate(const Vector<MT>& x,68 const Vector<MT>& y)67 const SpectralList& SpectralEstimate::estimate(const casacore::Vector<MT>& x, 68 const casacore::Vector<MT>& y) 69 69 { 70 70 if (x.nelements() != y.nelements()) { … … 77 77 estimate(y); 78 78 // Convert 79 for ( uInt i=0; i<slist_p.nelements(); i++) {79 for (casacore::uInt i=0; i<slist_p.nelements(); i++) { 80 80 if (slist_p[i]->getType() != SpectralElement::GAUSSIAN) { 81 81 throw AipsError("Non-gaussian spectral types cannot be estimated"); … … 90 90 91 91 template <class MT> 92 uInt SpectralEstimate::window(constVector<MT> &prof) {92 casacore::uInt SpectralEstimate::window(const casacore::Vector<MT> &prof) { 93 93 windowLow_p =0; 94 94 windowEnd_p = 0; 95 95 if (!useWindow_p || rms_p <= 0.0 || lprof_p == 0) { 96 96 if (regionEnd_p) { 97 windowLow_p = min(max(0,regionLow_p), Int(lprof_p));98 windowEnd_p = min(regionEnd_p, Int(lprof_p));97 windowLow_p = min(max(0,regionLow_p),casacore::Int(lprof_p)); 98 windowEnd_p = min(regionEnd_p, casacore::Int(lprof_p)); 99 99 } else windowEnd_p = lprof_p; 100 100 return windowEnd_p-windowLow_p; 101 101 }; 102 102 // Total flux in profile and max position 103 Double flux(0.0);104 Double pmax(prof(0));105 uInt imax(0);106 for ( Int i=windowLow_p; i<windowEnd_p; i++) {103 casacore::Double flux(0.0); 104 casacore::Double pmax(prof(0)); 105 casacore::uInt imax(0); 106 for (casacore::Int i=windowLow_p; i<windowEnd_p; i++) { 107 107 if (prof(i)>pmax) { 108 108 pmax = prof(i); … … 114 114 if (pmax < cutoff_p) return 0; 115 115 // Window boundaries; new/old base and centre; width 116 Int width(-1);117 Int nw(0);118 Double bnew(flux), bold;119 Double cnew(imax), cold;116 casacore::Int width(-1); 117 casacore::Int nw(0); 118 casacore::Double bnew(flux), bold; 119 casacore::Double cnew(imax), cold; 120 120 do { 121 121 width++; 122 122 cold = cnew; 123 123 bold = bnew; 124 windowLow_p = max(0, Int(cold-width+0.5));125 windowEnd_p = min( Int(lprof_p),Int(cold+width+1.5));124 windowLow_p = max(0, casacore::Int(cold-width+0.5)); 125 windowEnd_p = min(casacore::Int(lprof_p), casacore::Int(cold+width+1.5)); 126 126 // flux and first moment in window 127 Double s(0);128 Double c(0);129 for ( Int i=windowLow_p; i<windowEnd_p; i++) {127 casacore::Double s(0); 128 casacore::Double c(0); 129 for (casacore::Int i=windowLow_p; i<windowEnd_p; i++) { 130 130 s += prof(i); 131 131 c += i*prof(i); … … 142 142 143 143 template <class MT> 144 void SpectralEstimate::findc2(const Vector<MT> &prof) {145 for ( Int i=windowLow_p; i<windowEnd_p; i++) {144 void SpectralEstimate::findc2(const casacore::Vector<MT> &prof) { 145 for (casacore::Int i=windowLow_p; i<windowEnd_p; i++) { 146 146 // Moments 147 Double m0(0.0);148 Double m2(0.0);149 for ( Int j = -q_p; j <= q_p; j++) {150 Int k = i+j;151 if (k >= 0 && k< Int(lprof_p)) {147 casacore::Double m0(0.0); 148 casacore::Double m2(0.0); 149 for (casacore::Int j = -q_p; j <= q_p; j++) { 150 casacore::Int k = i+j; 151 if (k >= 0 && k<casacore::Int(lprof_p)) { 152 152 // add to moments 153 153 m0 += prof(k); … … 161 161 162 162 template <class MT> 163 void SpectralEstimate::findga(const Vector<MT> &prof) {164 Int i(windowLow_p-1);163 void SpectralEstimate::findga(const casacore::Vector<MT> &prof) { 164 casacore::Int i(windowLow_p-1); 165 165 // Window on Gaussian 166 Int iclo(windowLow_p);167 Int ichi(windowLow_p);166 casacore::Int iclo(windowLow_p); 167 casacore::Int ichi(windowLow_p); 168 168 // Peak counter 169 Int nmax = 0;169 casacore::Int nmax = 0; 170 170 GaussianSpectralElement tspel; 171 171 while (++i < windowEnd_p) { … … 187 187 case 2: { 188 188 // Some moments 189 Double m0m(0);190 Double m0(0);191 Double m1(0);192 Double m2(0);189 casacore::Double m0m(0); 190 casacore::Double m0(0); 191 casacore::Double m1(0); 192 casacore::Double m2(0); 193 193 ichi = i; 194 194 // Do Schwarz' calculation 195 Double b = deriv_p[iclo];196 Double a = (deriv_p[ichi] - b) / (ichi-iclo);197 for ( Int ic=iclo; ic<=ichi; ic++) {195 casacore::Double b = deriv_p[iclo]; 196 casacore::Double a = (deriv_p[ichi] - b) / (ichi-iclo); 197 for (casacore::Int ic=iclo; ic<=ichi; ic++) { 198 198 m0m += min(deriv_p[ic], 0.0); 199 Double wi = deriv_p[ic] - a*(ic-iclo) - b;199 casacore::Double wi = deriv_p[ic] - a*(ic-iclo) - b; 200 200 m0 += wi; 201 201 m1 += wi*ic; … … 203 203 }; 204 204 // determinant 205 Double det = m2*m0 - m1*m1;205 casacore::Double det = m2*m0 - m1*m1; 206 206 if (det > 0.0 && fabs(m0m) > FLT_EPSILON) { 207 Double xm = m1/m0;208 Double sg = 1.69*sqrt(det) / fabs(m0);207 casacore::Double xm = m1/m0; 208 casacore::Double sg = 1.69*sqrt(det) / fabs(m0); 209 209 // Width above critical? 210 210 if (sg > sigmin_p) { 211 Int is =Int(1.73*sg+0.5);212 Int im =Int(xm+0.5);213 Double yl(0);211 casacore::Int is = casacore::Int(1.73*sg+0.5); 212 casacore::Int im = casacore::Int(xm+0.5); 213 casacore::Double yl(0); 214 214 if ((im-is) >= 0) yl = prof(im-is); 215 Double yh(0);216 if ((im + is) <= Int(lprof_p-1)) yh = prof(im+is);217 Double ym = prof(im);215 casacore::Double yh(0); 216 if ((im + is) <= casacore::Int(lprof_p-1)) yh = prof(im+is); 217 casacore::Double ym = prof(im); 218 218 // modified by dmehringer 2012apr03 to deal with 0 denominator 219 219 // 0.0/0.0 produces NaN on Linux but 0 on OSX 220 Double pg = (ym-0.5*(yh+yl));220 casacore::Double pg = (ym-0.5*(yh+yl)); 221 221 if (pg != 0) { 222 Double denom = (1.0-exp(-0.5*(is*is)/sg/sg));222 casacore::Double denom = (1.0-exp(-0.5*(is*is)/sg/sg)); 223 223 if (denom == 0) { 224 224 throw AipsError("Bailing because division by zero is undefined"); … … 252 252 253 253 template <class MT> 254 GaussianSpectralElement SpectralEstimate::convertElement (const Vector<MT>& x,254 GaussianSpectralElement SpectralEstimate::convertElement (const casacore::Vector<MT>& x, 255 255 const GaussianSpectralElement& el) const 256 256 { 257 257 GaussianSpectralElement elOut = el; 258 const Int& idxMax = x.nelements()-1;258 const casacore::Int& idxMax = x.nelements()-1; 259 259 260 260 // Get current (pars are amp, center, width as the SpectralElement 261 261 // will always be a Gaussian) 262 262 263 Vector<Double> par, err;263 casacore::Vector<casacore::Double> par, err; 264 264 el.get(par); 265 265 el.getError(err); … … 267 267 // Center 268 268 269 Int cenIdx =Int(par[1]);269 casacore::Int cenIdx = casacore::Int(par[1]); 270 270 271 271 // Get the x-increment, local to the center, as best we can from … … 273 273 // vector is monotonic 274 274 275 Double incX;275 casacore::Double incX; 276 276 if (cenIdx-1<0) { 277 277 incX = x[1] - x[0]; … … 287 287 par[1] = incX*(par[1]-idxMax) + x[idxMax]; // Extrapolate from x[idxMax] 288 288 } else { 289 Double dIdx = par[1] - cenIdx;290 par[1] = x[cenIdx] + dIdx*incX; // Interpolate289 casacore::Double dIdx = par[1] - cenIdx; 290 par[1] = x[cenIdx] + dIdx*incX; // casacore::Interpolate 291 291 } 292 292 err[1] = abs(err[1] * incX); -
trunk/external-alma/components/SpectralComponents/SpectralElement.cc
r3029 r3106 42 42 #include <casa/iostream.h> 43 43 44 using namespace casacore; 44 45 namespace casa { //# NAMESPACE CASA - BEGIN 45 46 -
trunk/external-alma/components/SpectralComponents/SpectralElement.h
r3029 r3106 34 34 #include <casa/Arrays/Vector.h> 35 35 #include <casa/Containers/RecordInterface.h> 36 37 using namespace casacore; 36 38 37 39 namespace casa { //# NAMESPACE CASA - BEGIN … … 105 107 106 108 // Evaluate the value of the element at x 107 virtual Double operator()(constDouble x) const;108 109 Bool operator==(const SpectralElement& other) const;109 virtual casacore::Double operator()(const casacore::Double x) const; 110 111 casacore::Bool operator==(const SpectralElement& other) const; 110 112 111 113 // Get parameter n … … 113 115 // <li> AipsError if illegal n 114 116 // </thrown> 115 virtual Double operator[](const uInt n) const;116 117 // Get all the types available as String and codes, and number available118 static const String* allTypes(Int &nall,117 virtual casacore::Double operator[](const uInt n) const; 118 119 // Get all the types available as casacore::String and codes, and number available 120 static const casacore::String* allTypes(Int &nall, 119 121 const SpectralElement::Types *&typ); 120 122 // Get a string from the type 121 static const String &fromType(SpectralElement::Types tp);122 // Get a type from a (non-case sensitive; minimum match) String123 static Bool toType(SpectralElement::Types &tp,124 const String &typName);123 static const casacore::String &fromType(SpectralElement::Types tp); 124 // Get a type from a (non-case sensitive; minimum match) casacore::String 125 static casacore::Bool toType(SpectralElement::Types &tp, 126 const casacore::String &typName); 125 127 126 128 // Get type of this element … … 128 130 129 131 // Get all parameters 130 void get( Vector<Double>& params) const;131 132 Vector<Double> get() const;132 void get(casacore::Vector<casacore::Double>& params) const; 133 134 casacore::Vector<casacore::Double> get() const; 133 135 134 136 // Get error estimates of parameters 135 void getError( Vector<Double> &err) const;136 Vector<Double> getError() const;137 void getError(casacore::Vector<casacore::Double> &err) const; 138 casacore::Vector<casacore::Double> getError() const; 137 139 138 140 // Get the order (i.e. the number of parameters) … … 140 142 141 143 // Set the error fields 142 virtual void setError(const Vector<Double> &err);144 virtual void setError(const casacore::Vector<casacore::Double> &err); 143 145 144 146 // Set fixed parameters (True) or unset them (False) … … 148 150 149 151 // Fix/unfix all in one go 150 virtual void fix(const Vector<Bool>& fix);152 virtual void fix(const casacore::Vector<casacore::Bool>& fix); 151 153 152 154 // Get the fix state[s] 153 const Vector<Bool> &fixed() const;155 const casacore::Vector<casacore::Bool> &fixed() const; 154 156 155 157 // Save to a record. 156 virtual Bool toRecord(RecordInterface& out) const;158 virtual casacore::Bool toRecord(RecordInterface& out) const; 157 159 158 160 // set parameters 159 virtual void set(const Vector<Double>& params);161 virtual void set(const casacore::Vector<casacore::Double>& params); 160 162 161 163 protected: … … 163 165 SpectralElement() {} 164 166 165 SpectralElement(Types type, const Vector<Double>& parms=Vector<Double>(0));167 SpectralElement(Types type, const casacore::Vector<casacore::Double>& parms=casacore::Vector<casacore::Double>(0)); 166 168 167 169 SpectralElement(const SpectralElement& other); … … 169 171 SpectralElement &operator=(const SpectralElement& other); 170 172 171 void _set(const Vector<Double>& params);173 void _set(const casacore::Vector<casacore::Double>& params); 172 174 173 175 void _setType(const Types type); 174 176 175 void _setFunction(const SHARED_PTR<Function< Double,Double> >& f);176 177 virtual SHARED_PTR<Function< Double,Double> > _getFunction() const {177 void _setFunction(const SHARED_PTR<Function<casacore::Double, casacore::Double> >& f); 178 179 virtual SHARED_PTR<Function<casacore::Double, casacore::Double> > _getFunction() const { 178 180 return _function; 179 181 } … … 186 188 // The parameters of the function. I.e. the polynomial coefficients; 187 189 // amplitude, center and sigma of a Gaussian. 188 Vector<Double> _params;190 casacore::Vector<casacore::Double> _params; 189 191 // The errors of the parameters 190 Vector<Double> _errors;192 casacore::Vector<casacore::Double> _errors; 191 193 // The indication if the parameter has to be fixed (True) or solved (False). 192 194 // Solved is the default. 193 Vector<Bool> _fixed;194 195 SHARED_PTR<Function< Double,Double> > _function;195 casacore::Vector<casacore::Bool> _fixed; 196 197 SHARED_PTR<Function<casacore::Double, casacore::Double> > _function; 196 198 197 199 }; … … 199 201 ostream &operator<<(ostream& os, const SpectralElement& elem); 200 202 201 Bool near(const SpectralElement& s1, const SpectralElement& s2, constDouble tol);202 203 Bool nearAbs(const SpectralElement& s1, const SpectralElement& s2, constDouble tol);203 casacore::Bool near(const SpectralElement& s1, const SpectralElement& s2, const casacore::Double tol); 204 205 casacore::Bool nearAbs(const SpectralElement& s1, const SpectralElement& s2, const casacore::Double tol); 204 206 205 207 -
trunk/external-alma/components/SpectralComponents/SpectralEstimate.h
r2980 r3106 18 18 //# 19 19 //# Correspondence concerning AIPS++ should be addressed as follows: 20 //# Internet email: aips2-request@nrao.edu.20 //# casacore::Internet email: aips2-request@nrao.edu. 21 21 //# Postal address: AIPS++ Project Office 22 22 //# National Radio Astronomy Observatory … … 34 34 #include <components/SpectralComponents/SpectralList.h> 35 35 36 namespace casacore { 37 template <class T> class Vector; 38 } 39 36 40 namespace casa { //# NAMESPACE CASA - BEGIN 37 41 38 42 //# Forward Declarations 39 43 class GaussianSpectralElement; 40 template <class T> class Vector;41 44 42 45 // <summary> … … 97 100 //# Constants 98 101 // Default maximum number of components to be found 99 static const uInt MAXPAR = 200;102 static const casacore::uInt MAXPAR = 200; 100 103 //# Enumerations 101 104 //# Friends … … 106 109 // of components that will be found. A value of zero will indicate 107 110 // an unlimited number. 108 explicit SpectralEstimate(const uInt maxpar=MAXPAR);111 explicit SpectralEstimate(const casacore::uInt maxpar=MAXPAR); 109 112 // Create an estimator with the given maximum number of possible 110 113 // elements. A value of zero will indicate an unlimited number. … … 112 115 // found, and a minimum width. Cutoff and minsigma default to 0.0, maximum 113 116 // size of list produced to 200. 114 explicit SpectralEstimate(const Double rms,115 const Double cutoff=0.0, constDouble minsigma=0.0,116 const uInt maxpar=MAXPAR);117 explicit SpectralEstimate(const casacore::Double rms, 118 const casacore::Double cutoff=0.0, const casacore::Double minsigma=0.0, 119 const casacore::uInt maxpar=MAXPAR); 117 120 // Copy constructor (deep copy) 118 121 SpectralEstimate(const SpectralEstimate &other); … … 138 141 // <group> 139 142 template <class MT> 140 const SpectralList& estimate(const Vector<MT>& ordinate,141 Vector<MT> *der = 0);142 template <class MT> 143 const SpectralList& estimate(const Vector<MT>& abcissa,144 const Vector<MT>& ordinate);143 const SpectralList& estimate(const casacore::Vector<MT>& ordinate, 144 casacore::Vector<MT> *der = 0); 145 template <class MT> 146 const SpectralList& estimate(const casacore::Vector<MT>& abcissa, 147 const casacore::Vector<MT>& ordinate); 145 148 // </group> 146 149 … … 151 154 // <group> 152 155 // Set the profile's estimated rms (forced to abs(rms)) 153 void setRMS(const Double rms=0.0);156 void setRMS(const casacore::Double rms=0.0); 154 157 // Set the amplitude cutoff for valid estimate (forced to max(0,cutoff)) 155 void setCutoff(const Double cutoff=0.0);158 void setCutoff(const casacore::Double cutoff=0.0); 156 159 // Set the minimum width allowed (forced to max(0,minsigma)) 157 void setMinSigma(const Double minsigma=0.0);160 void setMinSigma(const casacore::Double minsigma=0.0); 158 161 // Set the number of points consider at each side of test point (i.e. a 159 162 // width of 2q+1 is taken). Default internally is 2; max(1,q) taken. 160 void setQ(const uInt q=2);163 void setQ(const casacore::uInt q=2); 161 164 // Set a region [lo,hi] over which to estimate. Lo and hi are given as 162 165 // zero-based vector indices. 163 void setRegion(const Int lo, constInt hi);166 void setRegion(const casacore::Int lo, const casacore::Int hi); 164 167 // Do you want to look in an automatically determined window with signal? 165 168 // Default is False, meaning the full (possibly regioned) profile. 166 169 void setWindowing(const Bool win=False); 167 170 // Set the maximum number of estimates to find (forced to >=1; 200 default) 168 void setMaxN(const uInt maxpar=MAXPAR);171 void setMaxN(const casacore::uInt maxpar=MAXPAR); 169 172 // </group> 170 173 … … 174 177 Bool useWindow_p; 175 178 // rms estimate in profile 176 Double rms_p;179 casacore::Double rms_p; 177 180 // Source cutoff amplitude 178 Double cutoff_p;181 casacore::Double cutoff_p; 179 182 // Window low and end value 180 183 // <group> 181 Int windowLow_p;182 Int windowEnd_p;184 casacore::Int windowLow_p; 185 casacore::Int windowEnd_p; 183 186 // </group> 184 187 // Region low and high value 185 188 // <group> 186 Int regionLow_p;187 Int regionEnd_p;189 casacore::Int regionLow_p; 190 casacore::Int regionEnd_p; 188 191 // </group> 189 192 // Smoothing parameter. I.e. 2q+1 points are taken 190 Int q_p;191 // Internal cashing of calculated values based on q192 // <group> 193 Double a_p;194 Double b_p;193 casacore::Int q_p; 194 // casacore::Internal cashing of calculated values based on q 195 // <group> 196 casacore::Double a_p; 197 casacore::Double b_p; 195 198 // </group> 196 199 // The minimum Gaussian width 197 Double sigmin_p;200 casacore::Double sigmin_p; 198 201 // The second derivatives 199 Double *deriv_p;202 casacore::Double *deriv_p; 200 203 // The list of components 201 204 SpectralList slist_p; 202 205 // The length of the current profile being estimated 203 uInt lprof_p;206 casacore::uInt lprof_p; 204 207 205 208 //# Member functions 206 209 // Get the window or the total spectrum 207 210 template <class MT> 208 uInt window(constVector<MT> &prof);211 casacore::uInt window(const casacore::Vector<MT> &prof); 209 212 // Get the second derivatives 210 213 template <class MT> 211 void findc2(const Vector<MT> &prof);214 void findc2(const casacore::Vector<MT> &prof); 212 215 // Find the Gaussians 213 216 template <class MT> 214 void findga(const Vector<MT> &prof);217 void findga(const casacore::Vector<MT> &prof); 215 218 // Convert the parameters of the components in the list from 216 219 // pixel-based indices to the given abcissa-vector space. 217 template <class MT> GaussianSpectralElement convertElement (const Vector<MT>& abcissa,220 template <class MT> GaussianSpectralElement convertElement (const casacore::Vector<MT>& abcissa, 218 221 const GaussianSpectralElement& el) const; 219 222 }; -
trunk/external-alma/components/SpectralComponents/SpectralList.h
r2980 r3106 18 18 //# 19 19 //# Correspondence concerning AIPS++ should be addressed as follows: 20 //# Internet email: aips2-request@nrao.edu.20 //# casacore::Internet email: aips2-request@nrao.edu. 21 21 //# Postal address: AIPS++ Project Office 22 22 //# National Radio Astronomy Observatory … … 34 34 #include <casa/Containers/Block.h> 35 35 36 namespace casacore { 37 38 class RecordInterface; 39 class String; 40 template <class T> class Vector; 41 } 42 36 43 namespace casa { //# NAMESPACE CASA - BEGIN 37 44 38 45 //# Forward Declarations 39 46 class SpectralElement; 40 class RecordInterface;41 class String;42 template <class T> class Vector;43 47 44 48 // <summary> … … 86 90 SpectralList(); 87 91 // Construct a list with a maximum length of n (0: unlimited length) 88 explicit SpectralList( uInt nmax);92 explicit SpectralList(casacore::uInt nmax); 89 93 // Construct with an initial element 90 94 explicit SpectralList(const SpectralElement &in); … … 100 104 SpectralList &operator=(const SpectralList &other); 101 105 // Evaluate the value of the sum of the elements at x 102 Double operator()(constDouble x) const;106 casacore::Double operator()(const casacore::Double x) const; 103 107 // Get element n 104 108 // <thrown> … … 106 110 // </thrown> 107 111 // <group> 108 const SpectralElement* operator[](const uInt n) const;109 SpectralElement* operator[](const uInt n);112 const SpectralElement* operator[](const casacore::uInt n) const; 113 SpectralElement* operator[](const casacore::uInt n); 110 114 // </group> 111 115 112 116 //# Member functions 113 117 // Get the number of elements in list 114 uInt nelements() const { return list_p.nelements(); };118 casacore::uInt nelements() const { return list_p.nelements(); }; 115 119 116 120 // Get the profile values for all elements in list. The evaluation … … 138 142 // Add elements to list (False if list has max length and full) 139 143 // <group> 140 Bool add(const SpectralElement &in);141 Bool add(const SpectralList &in);144 casacore::Bool add(const SpectralElement &in); 145 casacore::Bool add(const SpectralList &in); 142 146 // </group> 143 147 // Insert in sort order in the list … … 148 152 // Set an element in the list. Return False if more than one place beyond 149 153 // end of list; or if beyond max size. 150 Bool set(const SpectralElement &in, constuInt which);154 casacore::Bool set(const SpectralElement &in, const casacore::uInt which); 151 155 152 156 // Clear the list … … 154 158 155 159 // Set a maximum size of the list 156 void set(const uInt nmax);160 void set(const casacore::uInt nmax); 157 161 158 162 // Sort the list on the first parameter (i.e. peak value for Gaussian) … … 161 165 // Convert to and from a Record (see details in SpectralElement) 162 166 // <group> 163 Bool fromRecord (String& errMsg, constRecordInterface& container);164 Bool toRecord(RecordInterface& container) const;167 casacore::Bool fromRecord (casacore::String& errMsg, const casacore::RecordInterface& container); 168 casacore::Bool toRecord(casacore::RecordInterface& container) const; 165 169 //</group> 166 170 … … 168 172 //#Data 169 173 // Max length allowed of list 170 uInt nmax_p;174 casacore::uInt nmax_p; 171 175 // List of elements 172 PtrBlock<SpectralElement *> list_p;176 casacore::PtrBlock<SpectralElement *> list_p; 173 177 174 178 //# Member functions 175 179 // Compare two elements 176 Int compar(const SpectralElement &p1, const SpectralElement &p2) const;180 casacore::Int compar(const SpectralElement &p1, const SpectralElement &p2) const; 177 181 178 182 };
Note:
See TracChangeset
for help on using the changeset viewer.