Source
//# FluxCalcLogFreqPolynomial.cc: Implementation of FluxCalcLogFreqPolynomial.h
//# Copyright (C) 2010
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
// Handy for passing anonymous arrays to functions.
using namespace casacore;
namespace casa { //# NAMESPACE CASA - BEGIN
Bool FluxCalcLogFreqPolynomial::operator()(Flux<Double>& value,
Flux<Double>& error,
const MFrequency& mfreq,
const Bool updatecoeffs)
{
LogIO os(LogOrigin("FluxCalcLogFreqPolynomial", "()", WHERE));
Double dt = log10(mfreq.get(freqUnit_p).getValue());
if (updatecoeffs || coeffs_p(0).nelements()==0) {
coeffs_p(0).resize();
coeffs_p(1).resize();
coeffs_p=getCurrentCoeffs();
}
{
validfrange_p=getValidFreqRange();
Double ghzinfreq = mfreq.get("GHz").getValue();
Double minfreq = validfrange_p(0).get("GHz").getValue();
Double maxfreq = validfrange_p(1).get("GHz").getValue();
if (!(minfreq==0.0 && maxfreq ==0.0)) {
//cerr<<" range:"<<minfreq<<","<<maxfreq<<" infreq="<<ghzinfreq<<endl;
if (minfreq > ghzinfreq || maxfreq < ghzinfreq) {
//cerr<<"Input "<<String::toString(mfreq)<<" is out of the valid frequency range of the flux model: "<<String::toString(validfrange_p)<<endl;
os<<LogIO::WARN<<"Input "<<String::toString(mfreq)
<<" (Hz) is out of the valid frequency range of the flux model: "
<<String::toString(validfrange_p)<<" (Hz)"<<LogIO::POST;