예제 #1
0
vector<Float_t> ZgSelectData::newPhoEn(){
	vector<Float_t> _phoEn ;
	float corrEn(0.);
	for (int i = 0; i < nPho; i++){
		corrEn = getCorrection(phoE[i],phoSCEta[i],phoR9[i],run);
		_phoEn.push_back(corrEn);
	}
	return _phoEn ;
}
예제 #2
0
vector<Float_t> ZgSelectData::newEleEn(){
	vector<Float_t> _eleEn ;
	float corrEn(0.);
	for (int i = 0; i < nEle; i++){
		Float_t r9 = eleE3x3[i] / eleSCRawEn[i] ;
		corrEn = getCorrection(eleEn[i],eleSCEta[i],r9,run);
		_eleEn.push_back(corrEn);
	}
	return _eleEn ;
}
예제 #3
0
void MultiColorCorrection::setCorrectionForLed(const std::string& id, const unsigned startLed, const unsigned endLed)
{
	assert(startLed <= endLed);
	assert(endLed < _ledCorrections.size());

	// Get the identified correction (don't care if is nullptr)
	ColorCorrection * correction = getCorrection(id);
	for (unsigned iLed=startLed; iLed<=endLed; ++iLed)
	{
		_ledCorrections[iLed] = correction;
	}
}
예제 #4
0
파일: tai2ut1.C 프로젝트: zhuww/tempo2
/* ******************************************** */
void tai2ut1(pulsar *psr,int npsr)
{
    int p,i;
    const char *CVS_verNum = "$Revision: 1.6 $";

    if (displayCVSversion == 1) CVSdisplayVersion("tai2ut1.C","tai2ut1()",CVS_verNum);

    for (p=0; p<npsr; p++)
    {
        if (psr[p].t2cMethod==T2C_TEMPO)
            for (i=0; i<psr[p].nobs; i++)
            {
                if (psr[p].obsn[i].clockCorr!=0)
                {
                    /* Original TEMPO calculation */
                    /*	      psr[p].obsn[i].correctionUT1 = ut1red((double)(psr[p].obsn[i].sat+
                    				   psr[p].obsn[i].correctionUTC/SECDAY+
                    				   psr[p].obsn[i].correctionUTC_TAI/SECDAY),
                    				   psr[p].obsn[i].a1utcf);*/

                    /* redwards note, the frame of the argument to the IERS does
                    not seem to be specified. We will simply use the whatever
                     version of TT was specified, which could be out from UTC by up
                     to a couple of minutes within our lifetimes. TAI lays between
                     the two.
                     The maximum rate of change of the EOP are as follows:
                                       x, y   : 5 mas/day
                                       UT1-UTC:  4 ms/day  (excluding leap seconds!!)
                               For x & y, 1 ns is 9 mas, so no problem.
                     For UT1-UTC, 1 ns is 330 microsec, so we must have the
                     argument right to within 7000 seconds ... no problem! */

                    /* Where does the 0.0343817 come from?? See end of ut1red ... */
                    /* redwards -- it is due to tempo's internal use of A.1,
                    which differs from TAI by this many seconds */

                    /* redwards, changed ut1red to return UT1-TAI. So now we have
                    UT1-TOA = UT1-TAI + (TAI-TOA) */


                    psr[p].obsn[i].correctionUT1 =
                        ut1red((double)(psr[p].obsn[i].sat),
                               psr[p].noWarnings)
                        + getCorrection(psr[p].obsn+i,
                                        psr[p].clockFromOverride,
                                        "TAI", psr[p].noWarnings);

                }
                else
                    psr[p].obsn[i].correctionUT1 = 0.0;
            }
    }
}
예제 #5
0
파일: Timer.cpp 프로젝트: m-angelov/ugene
namespace U2 {


QDateTime GTimer::createDateTime(qint64 micros, Qt::TimeSpec spec) {
    QDateTime res(QDate(1970, 1, 1), QTime(0, 0), Qt::UTC);
    res = res.addMSecs(micros/1000);
    assert(res.isValid());
    return res.toTimeSpec(spec);
}

static double getFrequency() {
    double frequency = 0;
#if defined(Q_OS_WIN) && defined(WIN_USE_PERF_COUNTER)
    LARGE_INTEGER freq;
    QueryPerformanceFrequency(&freq);
    frequency = (double)freq.QuadPart;
#else
    frequency = 1000*1000; //microseconds
#endif
    return frequency;

}

static qint64 getCorrection() {
    GCounter totalCounter("timer correction", "ticks", 1);

    TimeCounter tc(&totalCounter, false);
    tc.start(); tc.stop();
    tc.start(); tc.stop();
    tc.start(); tc.stop();
    tc.start(); tc.stop();

    qint64 correction = totalCounter.totalCount / 4;
    return correction;
}

qint64 TimeCounter::correction = getCorrection();
double TimeCounter::frequency = getFrequency();

bool TimeCounter::enabled = true;
QString  TimeCounter::timeSuffix("seconds");
} //namespace
예제 #6
0
파일: tropo.C 프로젝트: ARO-user/work-share
void
compute_tropospheric_delays(pulsar *psr,int npsr)
{
  double zenith_delay_hydrostatic, zenith_delay_wet;
  double mapping_hydrostatic, mapping_wet;
  int i, p;
  observatory *obs;
  double source_elevation;
  double pressure;
  const char *CVS_verNum = "$Revision: 1.9 $";

  if (displayCVSversion == 1) CVSdisplayVersion("tropo.C","computer_tropospheric_delays()",CVS_verNum);

  // test code
#if 0
  {
    int ilat, iel;
    double lat, el, h, w;
    for (ilat=0;ilat<=11;ilat++)
    {
      lat = (ilat * 8.0)* 3.14159265358979/180.0;
      for (iel=0; iel<=100; iel++)
      {
	el = (5.0+iel*0.84) * 3.14159265358979/180.0;
	h = NMF_hydrostatic(50000.0, lat, 10000.0, el);
	w = NMF_wet(lat, el);
	printf("%.15lg %.15lg %.15lg %.15lg NMF\n",
	       el, h, w, lat);
      }
    }
    exit(1);
  }
#endif

  for (p=0;p<npsr;p++)
  {
    bool warned = false;
    for (i=0;i<psr[p].nobs;i++)
    { 
      psr[p].obsn[i].troposphericDelay = 0.0;
      if (psr[p].obsn[i].delayCorr!=0 && psr[p].correctTroposphere!=0 && psr[p].obsn[i].zenith[2]==0.0 && !warned)
      {
	logdbg( "WARNING: Tropospheric delay correction not possible with T2CMETHOD TEMPO %d %lf", i, psr[p].obsn[i].zenith[2]);
	warned = true;
      }
      else if (strcmp(psr[p].obsn[i].telID,"STL_FBAT")==0)
	{
	  logdbg("Not correcting for tropospheric delay");
	  warned=true;
	}
      else if (psr[p].obsn[i].delayCorr!=0 && psr[p].correctTroposphere!=0)
      {
	obs = getObservatory(psr[p].obsn[i].telID);
	/* Check whether the observation represents the COE */
	if (strcasecmp(obs->name,"COE")!=0)
	  {
	    // get source elevation neglecting proper motion
	    source_elevation = asin(dotproduct(psr[p].obsn[i].zenith,
					       psr[p].posPulsar)
				    / obs->height_grs80);
	    // get surface atmospheric pressure
	    pressure = 
	      getSurfaceAtmosphericPressure(obs->code, psr[p].obsn[i].sat, 
					    psr[p].noWarnings);
	    
	    // ------------------- Hydrostatic delay
	    // Zenith delay from Davies et al (Radio Sci 20 1593)
	    zenith_delay_hydrostatic = 0.02268 * pressure 
	      / (SPEED_LIGHT * (1.0-0.00266*cos(obs->latitude_grs80)
				-2.8e-7*obs->height_grs80));
	    // mapping function
	    mapping_hydrostatic = 
	      NMF_hydrostatic(psr[p].obsn[i].sat
			      + getCorrection(psr[p].obsn+i, 
					      psr[p].clockFromOverride,
					      "UTC", psr[p].noWarnings)/SECDAY,
			      obs->latitude_grs80, obs->height_grs80,
			      source_elevation);
	    // ------------------ Wet delay
	    zenith_delay_wet = 
	      getZenithWetDelay(obs->code, psr[p].obsn[i].sat, 
				psr[p].noWarnings);
	    mapping_wet = NMF_wet(obs->latitude_grs80, source_elevation);
	    
	    psr[p].obsn[i].troposphericDelay = 
	      zenith_delay_hydrostatic * mapping_hydrostatic
	      + zenith_delay_wet * mapping_wet;
	  }
	else
	  psr[p].obsn[i].troposphericDelay = 0.0;
      }
    }
  }
}
예제 #7
0
void get_obsCoord(pulsar *psr,int npsr)
{
  double ph,eeq[3];
  int i,j,k; 
  double prn[3][3];
  double pc,oblq,toblq;
  double siteCoord[3];
  double erad,hlt,alng,hrd,tsid,sdd,speed,sitera;
  int p;
  observatory *obs;
  const char *CVS_verNum = "$Revision: 1.8 $";

  if (displayCVSversion == 1) CVSdisplayVersion("get_obsCoord.C","get_obsCoord()",CVS_verNum);

  for (p=0;p<npsr;p++)
    {
       for (i=0;i<psr[p].nobs;i++)
	{ 
	  if (psr[p].obsn[i].delayCorr!=0)
	    {	     
	      if (strcmp(psr[p].obsn[i].telID,"STL")==0 ||
		  strcmp(psr[p].obsn[i].telID,"STL_FBAT")==0) // Satellite
		{
		  psr[p].obsn[i].siteVel[0] = 0.0;
		  psr[p].obsn[i].siteVel[1] = 0.0;
		  psr[p].obsn[i].siteVel[2] = 0.0;		  

		  // Set from the TELX, TELY, TELZ parameters
		  if (psr[p].param[param_telx].paramSet[0] == 1)
		    {
		      longdouble arg,deltaT,t0,pos;

		      if (psr[p].param[param_telEpoch].paramSet[0]==1)
			t0 = psr[p].param[param_telEpoch].val[0];
		      else
			t0 = 0.0L;

		      deltaT = (psr[p].obsn[i].sat - t0)*SECDAY;		
		      arg = deltaT;
		      pos = psr[p].param[param_telx].val[0];
		      if (psr[p].param[param_telx].paramSet[1] == 1) {
			pos += psr[p].param[param_telx].val[1]*arg;
			if (psr[p].param[param_telEpoch].paramSet[0]==0)
			  {
			    printf("ERROR: Using telescope velocity without setting telEpoch\n");
			    exit(1);
			  }
		      }
		      arg *= deltaT; if (psr[p].param[param_telx].paramSet[2] == 1) pos += (0.5*psr[p].param[param_telx].val[2]*arg);
		      arg *= deltaT; if (psr[p].param[param_telx].paramSet[3] == 1) pos += (1.0L/6.0L*psr[p].param[param_telx].val[3]*arg);
		      psr[p].obsn[i].observatory_earth[0] = (double)pos;
		      printf("Setting x to %g\n",(double)psr[p].obsn[i].observatory_earth[0]);
		    }
		  if (psr[p].param[param_tely].paramSet[0] == 1)
		    {
		      longdouble arg,deltaT,t0,pos;

		      if (psr[p].param[param_telEpoch].paramSet[0]==1)
			t0 = psr[p].param[param_telEpoch].val[0];
		      else
			t0 = 0.0L;

		      deltaT = (psr[p].obsn[i].sat - t0)*SECDAY;		
		      arg = deltaT;
		      pos = psr[p].param[param_tely].val[0];
		      if (psr[p].param[param_tely].paramSet[1] == 1) pos += psr[p].param[param_tely].val[1]*arg;
		      arg *= deltaT; if (psr[p].param[param_tely].paramSet[2] == 1) pos += (0.5*psr[p].param[param_tely].val[2]*arg);
		      arg *= deltaT; if (psr[p].param[param_tely].paramSet[3] == 1) pos += (1.0L/6.0L*psr[p].param[param_tely].val[3]*arg);
		      psr[p].obsn[i].observatory_earth[1] = (double)pos;
		      printf("Setting y to %g\n",(double)psr[p].obsn[i].observatory_earth[1]);
		    }
		  if (psr[p].param[param_telz].paramSet[0] == 1)
		    {
		      longdouble arg,deltaT,t0,pos;

		      if (psr[p].param[param_telEpoch].paramSet[0]==1)
			t0 = psr[p].param[param_telEpoch].val[0];
		      else
			t0 = 0.0L;

		      deltaT = (psr[p].obsn[i].sat - t0)*SECDAY;		
		      arg = deltaT;
		      pos = psr[p].param[param_telz].val[0];
		      if (psr[p].param[param_telz].paramSet[1] == 1) pos += psr[p].param[param_telz].val[1]*arg;
		      arg *= deltaT; if (psr[p].param[param_telz].paramSet[2] == 1) pos += (0.5*psr[p].param[param_telz].val[2]*arg);
		      arg *= deltaT; if (psr[p].param[param_telz].paramSet[3] == 1) pos += (1.0L/6.0L*psr[p].param[param_telz].val[3]*arg);
		      psr[p].obsn[i].observatory_earth[2] = (double)pos;
		      printf("Setting z to %g\n",(double)psr[p].obsn[i].observatory_earth[2]);
		    }



		  //		  printf("Setting observatory coordinates for TOA %d\n",i);
		  // Now check flags to obtain the telescope coordinates for this time
		  for (k=0;k<psr[p].obsn[i].nFlags;k++)
		    {
		      //
		      // NOTE: For a STL_FBAT setting OBSERVATORY->BAT not OBSERVATORY->EARTH
		      // The terminology is misleading
		      //
		      if (strcmp(psr[p].obsn[i].flagID[k],"-telx")==0){
			sscanf(psr[p].obsn[i].flagVal[k],"%lf",&psr[p].obsn[i].observatory_earth[0]);
			if (strcmp(psr[p].obsn[i].telID,"STL")==0) psr[p].obsn[i].observatory_earth[0]/=SPEED_LIGHT;
		      }
		      if (strcmp(psr[p].obsn[i].flagID[k],"-tely")==0){
			sscanf(psr[p].obsn[i].flagVal[k],"%lf",&psr[p].obsn[i].observatory_earth[1]);
			if (strcmp(psr[p].obsn[i].telID,"STL")==0) psr[p].obsn[i].observatory_earth[1]/=SPEED_LIGHT;
		      }
		      if (strcmp(psr[p].obsn[i].flagID[k],"-telz")==0){
			sscanf(psr[p].obsn[i].flagVal[k],"%lf",&psr[p].obsn[i].observatory_earth[2]);		      
			if (strcmp(psr[p].obsn[i].telID,"STL")==0) psr[p].obsn[i].observatory_earth[2]/=SPEED_LIGHT;
		      }
			
		    }
		}
	      else if (strcmp(psr[p].obsn[i].telID,"STL_BAT")==0) // Satellite in barycentric coordinates
		{
		  psr[p].obsn[i].siteVel[0] = 0.0;
		  psr[p].obsn[i].siteVel[1] = 0.0;
		  psr[p].obsn[i].siteVel[2] = 0.0;
		  psr[p].obsn[i].observatory_earth[0] = 0.0;
		  psr[p].obsn[i].observatory_earth[1] = 0.0;
		  psr[p].obsn[i].observatory_earth[2] = 0.0;
		  psr[p].correctTroposphere = 0;
		}
	      else
		{
		  obs = getObservatory(psr[p].obsn[i].telID);
		  // Check for override:
		  if (strcmp(psr[p].obsn[i].telID,"IMAG")==0)
		    {
		      //
		      // Must check what is happening to other parameters - such as velocities
		      //
		      for (k=0;k<psr[p].obsn[i].nFlags;k++)
			{
			  if (strcmp(psr[p].obsn[i].flagID[k],"-telx")==0){
			    sscanf(psr[p].obsn[i].flagVal[k],"%lf",&obs->x);
			  }
			  if (strcmp(psr[p].obsn[i].flagID[k],"-tely")==0){
			    sscanf(psr[p].obsn[i].flagVal[k],"%lf",&obs->y);
			  }
			  if (strcmp(psr[p].obsn[i].flagID[k],"-telz")==0){
			    sscanf(psr[p].obsn[i].flagVal[k],"%lf",&obs->z);		      
			  }
			}		
		    }
		  // New way
		  if (psr[p].t2cMethod == T2C_IAU2000B)
		    {
		      double trs[3], zenith_trs[3];
		      trs[0]=obs->x;
		      trs[1]=obs->y;
		      trs[2]=obs->z;
		      zenith_trs[0]= obs->height_grs80 
			* cos(obs->longitude_grs80) * cos(obs->latitude_grs80);
		      zenith_trs[1]= obs->height_grs80 
			* sin(obs->longitude_grs80) * cos(obs->latitude_grs80);
		      zenith_trs[2] = obs->height_grs80*sin(obs->latitude_grs80);
		      long double utc = psr[p].obsn[i].sat;
		      if (psr[p].obsn[i].clockCorr!=0 && psr[p].obsn[i].clockCorr!=2)
			utc += getCorrection(psr[p].obsn+i, 
					     psr[p].clockFromOverride,
					     "UTC", psr[p].noWarnings)/SECDAY;
		      get_obsCoord_IAU2000B(trs, zenith_trs,
					    psr[p].obsn[i].sat
					    +getCorrectionTT(psr[p].obsn+i)/SECDAY,
					    utc,
					    psr[p].obsn[i].observatory_earth,
					    psr[p].obsn[i].zenith,
					    psr[p].obsn[i].siteVel);
		    }
		  else {
		    psr[p].obsn[i].zenith[0]=psr[p].obsn[i].zenith[1]=psr[p].obsn[i].zenith[2]=0.0; // Only calc'd by IAU code
		    //	      if (	psr[p].obsn[i].zenith[2]==0.0)
		    erad = sqrt(obs->x*obs->x+obs->y*obs->y+obs->z*obs->z);//height(m)
		    hlt  = asin(obs->z/erad); // latitude
		    alng = atan2(-obs->y,obs->x); // longitude
		    hrd  = erad/(2.99792458e8*499.004786); // height (AU)
		    siteCoord[0] = hrd * cos(hlt) * 499.004786; // dist from axis (lt-sec)
		    siteCoord[1] = siteCoord[0]*tan(hlt); // z (lt-sec)
		    siteCoord[2] = alng; // longitude
		    
		    /* PC,PS equatorial and meridional components of nutations of longitude */      
		    toblq = (psr[p].obsn[i].sat+2400000.5-2451545.0)/36525.0;
		    oblq = (((1.813e-3*toblq-5.9e-4)*toblq-4.6815e1)*toblq +84381.448)/3600.0;
		    
		    pc = cos(oblq*M_PI/180.0+psr[p].obsn[i].nutations[1])*psr[p].obsn[i].nutations[0];
		    
		    /* TSID = sidereal time (lmst, timcalc -> obsite) */
		    
		    lmst(psr[p].obsn[i].sat+psr[p].obsn[i].correctionUT1/SECDAY
			 ,0.0,&tsid,&sdd);
		    tsid*=2.0*M_PI;
		    
		    /* Compute the local, true sidereal time */
		    ph = tsid+pc-siteCoord[2];  
		    /* Get X-Y-Z coordinates taking out earth rotation */
		    eeq[0] = siteCoord[0]*cos(ph); 
		    eeq[1] = siteCoord[0]*sin(ph);
		    eeq[2] = siteCoord[1];
		    
		    /* Now obtain PRN -- the precession matrix */
		    get_precessionMatrix(prn,(double)psr[p].obsn[i].sat
					 +psr[p].obsn[i].correctionUT1/SECDAY
					 ,psr[p].obsn[i].nutations[0],
					 psr[p].obsn[i].nutations[1]);
		    /* Calculate the position after precession/nutation*/
		    for (j=0;j<3;j++)
		      psr[p].obsn[i].observatory_earth[j]=prn[j][0]*eeq[0]+prn[j][1]*eeq[1]+prn[j][2]*eeq[2]; 
		    /* Rotate vector if we are working in ecliptic coordinates */
		    if (psr[p].eclCoord==1) equ2ecl(psr[p].obsn[i].observatory_earth);
		    
		    /* Calculate observatory velocity w.r.t. geocentre (1950.0)!!!! <<<<<<< */
		    speed = 2.0*M_PI*siteCoord[0]/(86400.0/1.00273);
		    sitera = 0.0;
		    if (speed>1.0e-10) sitera = atan2(psr[p].obsn[i].observatory_earth[1],
						      psr[p].obsn[i].observatory_earth[0]);
		    psr[p].obsn[i].siteVel[0] = -sin(sitera)*speed;
		    psr[p].obsn[i].siteVel[1] =  cos(sitera)*speed;
		    psr[p].obsn[i].siteVel[2] =  0.0;
		    if (psr[p].eclCoord==1) equ2ecl(psr[p].obsn[i].siteVel);
		    
		    /* Technically if using TDB these coordinates should be 
		       transformed to that frame. In practise it doesn't matter,
		       we're only talking about 0.3 ns, or 2.5e-14 in v/c */
		    
		    /* hack to transform for faked values of "K" */
		    //  	      vectorscale(psr[p].obsn[i].observatory_earth, 1.15505);
		    //  	      vectorscale(psr[p].obsn[i].siteVel, 1.15505);
		  }
		}
	    }
	  else if (i==0)
	    printf("Delay correction turned off for psr %d\n", p);
	}
    }
}
예제 #8
0
 bool Combinaison::isCombinaisonCompatible(const Combinaison &combiToTest, U32 wantedBlackPigs, U32 wantedWhitePigs) const noexcept {
     U32 computedBlackPigs, computedWhitePigs;
     getCorrection(combiToTest, computedBlackPigs, computedWhitePigs);
     return ((wantedBlackPigs == computedBlackPigs)&&(wantedWhitePigs == computedWhitePigs));
 }