LCOV - code coverage report
Current view: top level - components/ComponentModels - FluxStdsQS2.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 217 0.0 %
Date: 2024-10-04 18:58:15 Functions: 0 9 0.0 %

          Line data    Source code
       1             : //# FluxStdsQS2.cc: Definition of the flux standards some of which may varies in time
       2             : //# depend on time.
       3             : //# Copyright (C) 2013
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU Library General Public License as published by
       8             : //# the Free Software Foundation; either version 2 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      14             : //# License for more details.
      15             : //#
      16             : //# You should have received a copy of the GNU Library General Public License
      17             : //# along with this library; if not, write to the Free Software Foundation,
      18             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      19             : //#
      20             : //# Correspondence concerning AIPS++ should be addressed as follows:
      21             : //#        Internet email: casa-feedback@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#                        Charlottesville, VA 22903-2475 USA
      26             : //#
      27             : 
      28             : #include <components/ComponentModels/FluxStdsQS2.h>
      29             : #include <components/ComponentModels/FluxStdSrcs.h>
      30             : #include <casacore/casa/OS/Path.h>
      31             : #include <casacore/casa/System/Aipsrc.h>
      32             : #include <casatools/Config/State.h>
      33             : 
      34             : //#include <casa/Logging/LogIO.h>
      35             : 
      36             : using namespace casacore;
      37             : namespace casa { //# NAMESPACE CASA - BEGIN
      38             : namespace NSTDS { //# NAMESPACE NSTDS - BEGIN
      39             : // Each of these c'tors defines the polynomial coefficients for the
      40             : // log10(fluxDensity) = polynomial(log10(frequency)) calculations
      41             : // and optionally additional coefficients for estimating the flux density
      42             : // uncertainties. 
      43             : //
      44             : // fill_coeffs() with two RigidVectors uses the first one for the flux density
      45             : // coefficients and second one for the uncertainty coefficients, starting at
      46             : // order 0.  If the second RigidVector is omitted no uncertainty will be
      47             : // estimated.
      48             : 
      49             : 
      50           0 : Bool FluxStdBaars::setSourceCoeffs()
      51             : {
      52           0 :   Bool found = true;
      53             :   
      54           0 :   setFreqUnit("MHz");
      55           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
      56             :   
      57           0 :   if(srcEnum == FSS::THREEC286)
      58           0 :     fill_coeffs(RVF3(1.480, 0.292, -0.124), RVF3(0.018, 0.006, 0.001));
      59           0 :   else if(srcEnum == FSS::THREEC48)
      60           0 :     fill_coeffs(RVF3(2.345, 0.071, -0.138), RVF3(0.03, 0.001, 0.001));
      61           0 :   else if(srcEnum == FSS::THREEC147)
      62           0 :     fill_coeffs(RVF3(1.766, 0.447, -0.184), RVF3(0.017, 0.006, 0.001));
      63           0 :   else if(srcEnum == FSS::THREEC138)
      64           0 :     fill_coeffs(RVF3(2.009, -0.07176, -0.0862)); // No error specified
      65           0 :   else if(srcEnum == FSS::NINETEEN34M638)
      66           0 :     fill_coeffs(RVF4(-23.839, 19.569, -4.8168, 0.35836)); // No error specified
      67           0 :   else if(srcEnum == FSS::THREEC295)
      68           0 :     fill_coeffs(RVF3(1.485, 0.759, -0.255), RVF3(0.013, 0.009, 0.001));
      69             :   else
      70           0 :     found = false;
      71           0 :   return found;
      72             : }
      73             : 
      74           0 : Bool FluxStdPerley90::setSourceCoeffs()
      75             : {
      76           0 :   Bool found = true;
      77             :   
      78           0 :   setFreqUnit("MHz");
      79           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
      80             : 
      81           0 :   if(srcEnum == FSS::THREEC286)
      82           0 :     fill_coeffs(RVF3(1.35899, 0.3599, -0.13338));
      83           0 :   else if(srcEnum == FSS::THREEC48)
      84           0 :     fill_coeffs(RVF3(2.0868, 0.20889, -0.15498));
      85           0 :   else if(srcEnum == FSS::THREEC147)
      86           0 :     fill_coeffs(RVF3(1.92641, 0.36072, -0.17389));
      87           0 :   else if(srcEnum == FSS::THREEC138)
      88           0 :     fill_coeffs(RVF3(2.009, -0.07176, -0.0862));
      89           0 :   else if(srcEnum == FSS::NINETEEN34M638)
      90           0 :     fill_coeffs(RVF4(-30.7667, 26.4908, -7.0977, 0.605334));
      91           0 :   else if(srcEnum == FSS::THREEC295)
      92           0 :     fill_coeffs(RVF3(1.485, 0.759, -0.255));
      93             :   else
      94           0 :     found = false;
      95           0 :   return found;
      96             : }
      97             : 
      98           0 : Bool FluxStdPerleyTaylor95::setSourceCoeffs()
      99             : {
     100           0 :   Bool found = true;
     101             :   
     102           0 :   setFreqUnit("MHz");
     103           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     104             : 
     105           0 :   if(srcEnum == FSS::THREEC286)
     106           0 :     fill_coeffs(RVF4(0.50344, 1.05026, -0.31666, 0.01602));
     107           0 :   else if(srcEnum == FSS::THREEC48)
     108           0 :     fill_coeffs(RVF4(1.16801, 1.07526, -0.42254, 0.02699));
     109           0 :   else if(srcEnum == FSS::THREEC147)
     110           0 :     fill_coeffs(RVF4(0.05702, 2.09340, -0.7076, 0.05477));
     111           0 :   else if(srcEnum == FSS::THREEC138)
     112           0 :     fill_coeffs(RVF4(1.97498, -0.23918, 0.01333, -0.01389));
     113           0 :   else if(srcEnum == FSS::NINETEEN34M638)
     114           0 :     fill_coeffs(RVF4(-30.7667, 26.4908, -7.0977, 0.605334));
     115           0 :   else if(srcEnum == FSS::THREEC295)
     116           0 :     fill_coeffs(RVF4(1.28872, 0.94172, -0.31113, 0.00569));
     117             :   else
     118           0 :     found = false;
     119           0 :   return found;
     120             : }
     121             : 
     122           0 : Bool FluxStdPerleyTaylor99::setSourceCoeffs()
     123             : {
     124           0 :   Bool found = true;
     125             :   
     126           0 :   setFreqUnit("GHz");
     127           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     128             : 
     129             :   //LogIO os(LogOrigin("FluxStdPerleyTaylor99", "setSourceCoeffs", WHERE));
     130             :   // os << LogIO::NORMAL
     131             :   //    << "srcEnum before fill_coeffs() = " << srcEnum
     132             :   //    << LogIO::POST;
     133             : 
     134           0 :   if(srcEnum == FSS::THREEC286)
     135           0 :     fill_coeffs(RVF4(1.23734, -0.43276, -0.14223, 0.00345));
     136           0 :   else if(srcEnum == FSS::THREEC48)
     137           0 :     fill_coeffs(RVF4(1.31752, -0.74090, -0.16708, 0.01525));
     138           0 :   else if(srcEnum == FSS::THREEC147)
     139           0 :     fill_coeffs(RVF4(1.44856, -0.67252, -0.21124, 0.04077));
     140           0 :   else if(srcEnum == FSS::THREEC138)
     141           0 :     fill_coeffs(RVF4(1.00761, -0.55629, -0.11134, -0.0146));
     142           0 :   else if(srcEnum == FSS::NINETEEN34M638){
     143             :     // The broken polynomial is smooth enough to be 1st-order differentiable.
     144             :     //
     145             :     // The coefficients have been shifted to use GHz instead of MHz.
     146           0 :     fill_lohi_coeffs(RVF4(1.170418, 0.248618, -1.649694, 0.605334),  // Low
     147           0 :                      MFrequency(Quantity(10.0, "GHz")),              // break
     148           0 :                      RVF4(-2.5739, 10.0707, -10.0595, 2.9372));      // High
     149             :   }
     150           0 :   else if(srcEnum == FSS::THREEC295)
     151           0 :     fill_coeffs(RVF4(1.46744, -0.7735, -0.25912, 0.00752));
     152             :   else
     153           0 :     found = false;
     154           0 :   return found;
     155             : }
     156             : 
     157           0 : Bool FluxStdPerleyButler2010::setSourceCoeffs()
     158             : {
     159           0 :   Bool found = true;
     160             :   
     161           0 :   setFreqUnit("GHz");
     162           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     163             : 
     164           0 :   if(srcEnum == FSS::THREEC286)
     165           0 :     fill_coeffs(RVF4(1.2361, -0.4127, -0.1864, 0.0294));
     166           0 :   else if(srcEnum == FSS::THREEC48)
     167           0 :     fill_coeffs(RVF4(1.3197, -0.7253, -0.2023, 0.0540));
     168           0 :   else if(srcEnum == FSS::THREEC147)
     169           0 :     fill_coeffs(RVF4(1.4428, -0.6300, -0.3142, 0.1032));
     170           0 :   else if(srcEnum == FSS::THREEC138)
     171           0 :     fill_coeffs(RVF4(1.0053, -0.4384, -0.1855, 0.0511));
     172           0 :   else if(srcEnum == FSS::NINETEEN34M638){
     173             :     // The broken polynomial is smooth enough to be 1st-order differentiable.
     174             :     //
     175             :     // The coefficients have been shifted to use GHz instead of MHz.
     176           0 :     fill_lohi_coeffs(RVF4(1.170418, 0.248618, -1.649694, 0.605334),  // Low
     177           0 :                      MFrequency(Quantity(10.0, "GHz")),              // break
     178           0 :                      RVF4(-2.5739, 10.0707, -10.0595, 2.9372));      // High
     179             :   }
     180           0 :   else if(srcEnum == FSS::THREEC295)
     181           0 :     fill_coeffs(RVF4(1.4605, -0.7043, -0.3951, 0.0815));
     182           0 :   else if(srcEnum == FSS::THREEC196)
     183           0 :     fill_coeffs(RVF4(1.2753, -0.7971, -0.2255, 0.0380));
     184             :   else
     185           0 :     found = false;
     186           0 :   return found;
     187             : }
     188             : 
     189             : // If more sources are added in future, turn this into table based one
     190           0 : Bool FluxStdStevensReynolds2016::setSourceCoeffs()
     191             : {
     192           0 :   Bool found = true;
     193             : 
     194           0 :   setFreqUnit("GHz");
     195           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     196             : 
     197           0 :   if(srcEnum == FSS::NINETEEN34M638){
     198             :     // New high frequency parameters as of May 1, 2016,
     199             :     //  from Partridge et al (2016), ApJ 821,1
     200             :     //
     201             :     // The coefficients have been shifted to use GHz instead of MHz.
     202           0 :     fill_lohi_coeffs(RVF4(1.170418, 0.248618, -1.649694, 0.605334),  // Low
     203           0 :                      MFrequency(Quantity(11.1496, "GHz")),           // break
     204           0 :                      RVF2(1.7581, -1.3763));      // High
     205             :   }
     206             :   else
     207           0 :     found = false;
     208           0 :   return found;
     209             : }
     210             : 
     211           0 : Bool FluxStdPerleyButler2013::setSourceCoeffs()
     212             : {
     213           0 :   Bool found = true;
     214           0 :   Bool timevar = true;
     215           0 :   setFreqUnit("GHz");
     216           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     217           0 :   String stddatapath;
     218           0 :   String stdTabName("PerleyButler2013Coeffs");
     219             :   
     220           0 :   String resolvepath = casatools::get_state( ).resolve("nrao/VLA/standards/"+stdTabName);
     221           0 :   if (resolvepath != "nrao/VLA/standards/"+stdTabName) {
     222           0 :       stddatapath = resolvepath;
     223           0 :   } else if(!Aipsrc::findDir(stddatapath,"./"+stdTabName)) {
     224           0 :     if(!Aipsrc::findDir(stddatapath, Aipsrc::aipsRoot()+"/data/nrao/VLA/standards/"+stdTabName)) {
     225           0 :       ostringstream oss;
     226           0 :       oss << "The coefficient data for Perley-Butler 2013, " <<  stdTabName
     227           0 :           << " is not found in ./ or in ~/data/nrao/VLA/standards/";
     228           0 :       throw(AipsError(String(oss)));
     229           0 :     }
     230             :   }
     231             :   //cerr<<"use stddatapath="<<stddatapath<<endl;
     232           0 :   LogIO os(LogOrigin("FluxStdPerleyButler2013", "setSourceCoeffs", WHERE));
     233             :    os << LogIO::NORMAL2
     234             :       << "Use the coefficent data table: " << stddatapath
     235           0 :       << LogIO::POST;
     236             : 
     237             :  
     238           0 :   Path stdTablePath(stddatapath);
     239             :   //cerr<<"stddatapath="<<stddatapath<<endl;
     240           0 :   FCVQS::readQSCoeffsTable(stdTablePath);
     241           0 :   if (srcEnum != FSS::THREEC286 && 
     242           0 :       srcEnum != FSS::THREEC123 &&
     243           0 :       srcEnum != FSS::THREEC295 &&
     244           0 :       srcEnum != FSS::THREEC196 &&
     245           0 :       srcEnum != FSS::THREEC48 &&
     246           0 :       srcEnum != FSS::THREEC138 &&
     247             :       srcEnum != FSS::THREEC147) 
     248           0 :     found=false;
     249             : 
     250             :   // check if considered as non-variable
     251           0 :   if (srcEnum == FSS::THREEC286 ||
     252           0 :       srcEnum == FSS::THREEC123 ||
     253           0 :       srcEnum == FSS::THREEC295 ||
     254             :       srcEnum == FSS::THREEC196) {
     255             :     // no need to do this now, will be filled with nepoch=1 in FluxCalcVQS::()
     256             :     //uInt row=0;
     257             :     //FluxCalcVQS::setSourceCoeffsfromVec(row);     
     258             :     //RigidVector<Vector<Float>, 2> coeffs=FluxCalcVQS::getCurrentCoeffs(); 
     259             :     //fill_coeffs(RVF4(coeffs(0)), RVF4(coeffs(1)) );
     260           0 :     timevar=false;
     261             :   }
     262           0 :   FCVQS::isTimeVar(timevar);
     263             : 
     264           0 :   return found;
     265           0 : }
     266             : 
     267           0 : Bool FluxStdScaifeHeald2012::setSourceCoeffs()
     268             : {
     269           0 :   Bool found = true;
     270             : 
     271           0 :   setFreqUnit( "GHz" );
     272           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     273             :   //FCQS::Source srcEnum = getSrcEnum();
     274             : 
     275           0 :   String stddatapath;
     276           0 :   String stdTabName("ScaifeHeald2012Coeffs");
     277             : 
     278           0 :   String resolvepath = casatools::get_state( ).resolve("nrao/VLA/standards/"+stdTabName);
     279           0 :   if (resolvepath != "nrao/VLA/standards/"+stdTabName) {
     280           0 :       stddatapath = resolvepath;
     281           0 :   } else if(!Aipsrc::findDir(stddatapath,"./"+stdTabName)) {
     282           0 :     if(!Aipsrc::findDir(stddatapath, Aipsrc::aipsRoot()+"/data/nrao/VLA/standards/"+stdTabName)) {
     283           0 :       ostringstream oss;
     284           0 :       oss << "The coefficient data for Scaife-Healr 2012, " <<  stdTabName
     285           0 :           << " is not found in ./ or in ~/data/nrao/VLA/standards/";
     286           0 :       throw(AipsError(String(oss)));
     287           0 :     }
     288             :   }
     289             :   //cerr<<"use stddatapath="<<stddatapath<<endl;
     290           0 :   LogIO os(LogOrigin("FluxStdScaifeHeald2012", "setSourceCoeffs", WHERE));
     291             :    os << LogIO::NORMAL2
     292             :       << "Use the coefficent data table: " << stddatapath
     293           0 :       << LogIO::POST;
     294             : 
     295             : 
     296           0 :   Path stdTablePath(stddatapath);
     297             :   //cerr<<"stddatapath="<<stddatapath<<endl;
     298           0 :   FCVQS::readQSCoeffsTable(stdTablePath);
     299           0 :   if (srcEnum != FSS::THREEC48 && 
     300           0 :       srcEnum != FSS::THREEC147 &&
     301           0 :       srcEnum != FSS::THREEC196 &&
     302           0 :       srcEnum != FSS::THREEC286 &&
     303           0 :       srcEnum != FSS::THREEC295 &&
     304             :       srcEnum != FSS::THREEC380) 
     305           0 :     found=false;
     306             : /****
     307             :   // Needed before the coeffs. are stored in an external table
     308             :   //if ( srcEnum == FCQS::THREEC48 )
     309             :   if ( srcEnum == FSS::THREEC48 )
     310             :     fill_coeffs( RVF4( 64.768, -0.387, -0.420,  0.181 ),
     311             :                  RVF4(  1.761,  0.039,  0.031,  0.060 ) );
     312             :   //else if ( srcEnum == FCQS::THREEC147 )
     313             :   else if ( srcEnum == FSS::THREEC147 )
     314             :     fill_coeffs( RVF4( 66.738, -0.022, -1.012,  0.549 ),
     315             :                  RVF4(  2.490,  0.030,  0.167,  0.170 ) );
     316             :   //else if ( srcEnum == FCQS::THREEC196 )
     317             :   else if ( srcEnum == FSS::THREEC196 )
     318             :     fill_coeffs( RVF3( 83.084, -0.699, -0.110 ),
     319             :                  RVF3(  1.862,  0.014,  0.024 ) );
     320             :   //else if ( srcEnum == FCQS::THREEC286 )
     321             :   else if ( srcEnum == FSS::THREEC286 )
     322             :     fill_coeffs( RVF4( 27.477, -0.158,  0.032, -0.180 ),
     323             :                  RVF4(  0.746,  0.033,  0.043,  0.052 ) );
     324             :   //else if ( srcEnum == FCQS::THREEC295 )
     325             :   else if ( srcEnum == FSS::THREEC295 )
     326             :     fill_coeffs( RVF5( 97.763, -0.582, -0.298,  0.583, -0.363 ),
     327             :                  RVF5(  2.787,  0.045,  0.085,  0.116,  0.137 ) );
     328             :   //else if ( srcEnum == FCQS::THREEC380 )
     329             :   else if ( srcEnum == FSS::THREEC380 )
     330             :     fill_coeffs( RVF2( 77.352, -0.767 ),
     331             :                  RVF2(  1.164,  0.013 ) );
     332             :   else
     333             :     found = false;
     334             :   cerr<<"FluxStdSaifeHeald2012::setSourceCoeffs() ok?"<<found<<endl;
     335             : ****/
     336           0 :   FCVQS::isTimeVar(false);
     337             : 
     338           0 :   return found;
     339           0 : }
     340             : 
     341           0 : Bool FluxStdPerleyButler2017::setSourceCoeffs()
     342             : {
     343           0 :   Bool found = true;
     344           0 :   Bool timevar = false;
     345           0 :   setFreqUnit("GHz");
     346           0 :   FSS::Source srcEnum = FCVQS::getSrcEnum();
     347           0 :   String stddatapath;
     348           0 :   String stdTabName("PerleyButler2017Coeffs");
     349             : 
     350           0 :   String resolvepath = casatools::get_state( ).resolve("nrao/VLA/standards/"+stdTabName);
     351           0 :   if (resolvepath != "nrao/VLA/standards/"+stdTabName) {
     352           0 :       stddatapath = resolvepath;
     353           0 :   } else if(!Aipsrc::findDir(stddatapath,"./"+stdTabName)) {
     354           0 :     if(!Aipsrc::findDir(stddatapath, Aipsrc::aipsRoot()+"/data/nrao/VLA/standards/"+stdTabName)) {
     355           0 :       ostringstream oss;
     356           0 :       oss << "The coefficient data for Perley-Butler 2017, " <<  stdTabName
     357           0 :           << " is not found in ./ or in ~/data/nrao/VLA/standards/";
     358           0 :       throw(AipsError(String(oss)));
     359           0 :     }
     360             :   }
     361             :   //cerr<<"use stddatapath="<<stddatapath<<endl;
     362           0 :   LogIO os(LogOrigin("FluxStdPerleyButler2017", "setSourceCoeffs", WHERE));
     363             :    os << LogIO::NORMAL2
     364             :       << "Use the coefficent data table: " << stddatapath
     365           0 :       << LogIO::POST;
     366             : 
     367             : 
     368           0 :   Path stdTablePath(stddatapath);
     369             :   //cerr<<"stddatapath="<<stddatapath<<endl;
     370           0 :   FCVQS::readQSCoeffsTable(stdTablePath);
     371           0 :   if (srcEnum != FSS::THREEC286 &&
     372           0 :       srcEnum != FSS::THREEC123 &&
     373           0 :       srcEnum != FSS::THREEC295 &&
     374           0 :       srcEnum != FSS::THREEC196 &&
     375           0 :       srcEnum != FSS::THREEC48 &&
     376           0 :       srcEnum != FSS::THREEC138 &&
     377           0 :       srcEnum != FSS::THREEC147 &&
     378           0 :       srcEnum != FSS::J0133 &&
     379           0 :       srcEnum != FSS::FORNAXA &&
     380           0 :       srcEnum != FSS::J0444 &&
     381           0 :       srcEnum != FSS::PICTORA &&
     382           0 :       srcEnum != FSS::TAURUSA &&
     383           0 :       srcEnum != FSS::HYDRAA &&
     384           0 :       srcEnum != FSS::VIRGOA &&
     385           0 :       srcEnum != FSS::HERCULESA &&
     386           0 :       srcEnum != FSS::THREEC353 &&
     387           0 :       srcEnum != FSS::THREEC380 &&
     388           0 :       srcEnum != FSS::CYGNUSA &&
     389           0 :       srcEnum != FSS::THREEC444 &&
     390             :       srcEnum != FSS::CASSIOPEIAA)
     391           0 :     found=false;
     392             :   // all PB2017 source models are treated as non-variable
     393             :   // check if considered as variable
     394           0 :   if (srcEnum == FSS::THREEC48 || 
     395           0 :       srcEnum == FSS::THREEC138 ||
     396             :       srcEnum == FSS::THREEC147) { 
     397           0 :     timevar=true;
     398             :   }
     399           0 :   FCVQS::isTimeVar(timevar);
     400           0 :   return found;
     401           0 : }
     402             : 
     403             : } //# NAMESPACE NSTD - END 
     404             : } //# NAMESPACE CASA - END

Generated by: LCOV version 1.16