diff --git a/src/archive/newsrc.tar b/src/archive/newsrc.tar deleted file mode 100644 index cbc313c..0000000 Binary files a/src/archive/newsrc.tar and /dev/null differ diff --git a/src/archive/oldsrc.tar b/src/archive/oldsrc.tar deleted file mode 100644 index 8f1eca2..0000000 Binary files a/src/archive/oldsrc.tar and /dev/null differ diff --git a/src/inc/def.hpp b/src/inc/def.hpp deleted file mode 100644 index 84fa165..0000000 --- a/src/inc/def.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * def.hpp - * - * Created on: May 24, 2013 - * Author: abduz - */ - -#ifndef DEF_HPP_ -#define DEF_HPP_ - -#include -#include -#include - -using namespace alglib; -using namespace std; - -typedef real_1d_array vec; -typedef real_2d_array vec2; -typedef integer_1d_array ivec; - - -class lcurve { -public: - int len; double dt; vec lc,lce,t; - lcurve(int n=1){t.setlength(n); lc.setlength(n); lce.setlength(n) ;len=n;dt=1.0;} - lcurve(vec& t_,vec& lc_,vec& lce_,double dt_){t=t_;lc=lc_;lce=lce_;len=t.length();dt=dt_;} - double demean(){double m=0;int i;for(i=0;i -#include -#include -#include - -#include "def.hpp" -#include "psd.hpp" -#include "psd_rms.hpp" -#include "lag.hpp" -#include "lag_rms.hpp" -#include "psdlag.hpp" -#include "psdlag_rms.hpp" -#include "mcmc.hpp" - - -void usage(); -void do_work( char* ); -void readLC( vector >&, string , int , int , int , bool ); - - -double mcmc_lag10( vec& x ,void*ptr ){ - int i,hnp,np = x.length();hnp=np/2; double phi,twopi=2*M_PI; - for(i=0;i7){x[i]=7;}if(x[i]<-7){x[i]=-7;} - phi = x[i+hnp]+M_PI; - while(phi>twopi){phi -= twopi;} - while(phi<0){phi += twopi;} - x[i+hnp] = phi-M_PI; - } - Mod *mod = (Mod*) ptr; double logl=mod->loglikelihood(x); - return logl; -} - -double mcmc_psdlag10( vec& x ,void*ptr ){ - int i,hnp,np = x.length();hnp=np/2; double phi,twopi=2*M_PI; - for(i=0;i7){x[i]=7;}if(x[i]<-7){x[i]=-7;} - phi = x[i+hnp]+M_PI; - while(phi>twopi){phi -= twopi;} - while(phi<0){phi += twopi;} - x[i+hnp] = phi-M_PI; - } - Mod *mod = (Mod*) ptr; double logl=mod->loglikelihood(x); - return logl; -} - -#endif /* MAIN_HPP_ */ diff --git a/src/inc/mcmc.hpp b/src/inc/mcmc.hpp deleted file mode 100644 index 7cfb0e4..0000000 --- a/src/inc/mcmc.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * mcmc.hpp - * - * Created on: May 14, 2013 - * Author: abduz - */ - -#ifndef MCMC_HPP_ -#define MCMC_HPP_ - -#include -#include -#include -#include -#include -using namespace alglib; -using namespace std; - -typedef real_1d_array vec; -typedef real_2d_array vec2; -typedef integer_1d_array ivec; -typedef integer_2d_array ivec2; - -class mcmc { - int npar; double(*loglikelihood)(vec&,void*); void*ptr; - hqrndstate rnd; -public: - int nrun,nburn,nwk,ncheck; double avalue; - mcmc(int np,double (*f)(vec&,void*),void *p); - void setseed(int s1,int s2 ){hqrndseed(s1,s2,rnd);} - void run( vec& , vec& , const char*fname="mcmc.dat"); - virtual ~mcmc(); -}; - -#endif /* MCMC_HPP_ */ diff --git a/src/inc/mod.hpp b/src/inc/mod.hpp deleted file mode 100644 index fa24844..0000000 --- a/src/inc/mod.hpp +++ /dev/null @@ -1,289 +0,0 @@ -/* - * mod.hpp - * - * Created on: May 31, 2013 - * Author: azoghbi - */ - -#ifndef MOD_HPP_ -#define MOD_HPP_ - -#include "def.hpp" -#include -#include - -class mod { - - void _CSfq( vec , vector& , vector& ); - -public: - - int n,nfq,npar; - double dt,f1,f2; - vec lc,lce,t,FqL; - vector Cfq,Sfq,Cv,Cfq2,Sfq2; - - vec2 C,Ci,I,yyT,yyTmC,dC,C2,C3; - vec Cilc; - - ae_int_t info; densesolverreport rep; - - mod(); - virtual ~mod(); - - virtual void _C( vec ); - virtual void _dC( vec , int ); - virtual void step_pars( int , vec& , vec& ); - virtual void print_pars( vec& , vec& ); - virtual void print_pars( vec& , vec& , vec& ); - virtual void what_pars( int&, int& ); - - void setlc(){ lc.setlength(n); lce.setlength(n); t.setlength(n);} - void init( vec , int ); - double loglikelihood( vec ); - void dlikelihood( vec , double& , vec& , vec2& ); - void optimize( vec& , vec& ); -}; - -// ----------------------------------------- // -// ---------- mod container ---------------- // -// ----------------------------------------- // - -template -class Mod { - - int nmod,nfq; - vector mods; - -public: - int npar; - Mod( vector inlc , vec fqL ){ - int i; - nmod = inlc.size(); - for( i=0 ; i lc1, vector lc2 , vec fqL , vec pars ){ - int i; - nmod = lc1.size(); - for( i=0 ; i lc1, vector lc2 , vec fqL ){ - int i; - nmod = lc1.size(); - for( i=0 ; i ic,iv; sing = 0; - for( i=0; i 10 ){for(i=0;i ic,iv; - vec g; vec2 h,hi,iii; - - dlikelihood( pars , loglike , grad , hess ); - if( fabs(grad[k])<1e-5 ) { return loglike;} - - for( i=0 ; i10 ){for(i=0;i10 ) { continue ;} - pd = pars[ip]; - for( i=0 ;itol ){ - phalf = (pu+pd)/2.0; - tmpp[ip] = phalf; - tmplike = opti( tmpp , errs , ip ); - dl = 2*(bestlike - tmplike); - cout << "+++ " << bestlike << " " << tmplike << " " << pars[ip] << " "<< phalf << " " << dl << endl; - if( dl3000 ){dpar[i] = 3000;} if( dpar[i]<-3000 ){dpar[i] = -3000;} - pars[i] += dpar[i]/((n<10)?10:1); - } -} - - -void lag::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+nfq] -= 2*M_PI; } - while( pars[i+nfq] <-M_PI ){ pars[i+nfq] += 2*M_PI; } - } - mod::print_pars( pars , errs ); -} - - -// ****************************************** // - - -lag10::lag10( lcurve lc1 , lcurve lc2 , vec fqL , vec pars ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - lc1.demean(); lc2.demean(); - int i; - for( i=0 ; i3 ){dpar[i] = 3;} if( dpar[i]<-3 ){dpar[i] = -3;} - //pars[i] += dpar[i]; - pars[i] += dpar[i]/((n<5)?10:1); - } -} - - -void lag10::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+nfq] -= 2*M_PI; } - while( pars[i+nfq] <-M_PI ){ pars[i+nfq] += 2*M_PI; } - } - mod::print_pars( pars , errs ); -} - -void lag10::what_pars( int& ip1 , int& ip2 ){ - ip1 = nfq; ip2 = npar; -} diff --git a/src/lag_rms.cpp b/src/lag_rms.cpp deleted file mode 100644 index 9ac355a..0000000 --- a/src/lag_rms.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - * lag.cpp - * - * Created on: Jun 1, 2013 - * Author: azoghbi - */ - -#include "inc/lag_rms.hpp" - -lag_rms::lag_rms( lcurve lc1 , lcurve lc2 , vec fqL , vec pars ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - mean1 = lc1.demean(); mean2 = lc2.demean(); - mean1sq = mean1*mean1; mean2sq = mean2*mean2; mean12 = mean1*mean2; - int i; - for( i=0 ; i3000 ){dpar[i] = 3000;} if( dpar[i]<-3000 ){dpar[i] = -3000;} - pars[i] += dpar[i]/((n<10)?10:1); - } -} - - -void lag_rms::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+nfq] -= 2*M_PI; } - while( pars[i+nfq] <-M_PI ){ pars[i+nfq] += 2*M_PI; } - } - mod::print_pars( pars , errs ); -} - - -// ****************************************** // - - -lag10_rms::lag10_rms( lcurve lc1 , lcurve lc2 , vec fqL , vec pars ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - mean1 = lc1.demean(); mean2 = lc2.demean(); - mean1sq = mean1*mean1; mean2sq = mean2*mean2; mean12 = mean1*mean2; - int i; - for( i=0 ; i3 ){dpar[i] = 3;} if( dpar[i]<-3 ){dpar[i] = -3;} - //pars[i] += dpar[i]; - pars[i] += dpar[i]/((n<5)?10:1); - } -} - - -void lag10_rms::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+nfq] -= 2*M_PI; } - while( pars[i+nfq] <-M_PI ){ pars[i+nfq] += 2*M_PI; } - } - mod::print_pars( pars , errs ); -} - -void lag10_rms::what_pars( int& ip1 , int& ip2 ){ - ip1 = nfq; ip2 = npar; -} diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index a17e05c..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * main.cpp - * - * Created on: May 31, 2013 - * Author: azoghbi - */ - -#include "inc/main.hpp" - -/************************************** - * Main function - * Checks if there is an input and - * raises an error. - * otherwise, call do_work(fname) - **************************************/ -int main( int argc , char* argv[] ){ - if ( argc < 2 ){ - cerr << "** Error ** No input file given." << endl; - usage(); - }else { - do_work( argv[1] ); - } - return 0; -} - - - - -/************************************** - * Main function that does the work - * INPUT: char* fname: input file name - * RETURN: void - **************************************/ - -void do_work( char* fname ){ - - /************ Reading the input file ***********/ - ifstream fp(fname); - string line,mcmcfile,colon; stringstream ss; - int i,nfiles,nfq,mode,npar,bin1,bin2,fit_type,nrun,nburn,nwk,ref; bool strict; - getline(fp,line);ss.str(line); ss >> nfiles; ss.clear(); - vector files(nfiles);ivec secL;secL.setlength(nfiles);for(i=0;i> files[i] >> secL[i]; ss.clear();} - getline(fp,line); ss.str(line); ss >> nfq;vec fqL;fqL.setlength(nfq+1); - for(i=0;i<=nfq;i++){ss >> fqL[i];} ss.clear(); - getline(fp,line); ss.str(line); ss >> mode; ss.clear(); - npar = (mode==0)?4*nfq:nfq; vec pars; pars.setlength(npar); - getline(fp,line); ss.str(line); for(i=0;i> pars[i];} ss.clear(); - getline(fp,line); ss.str(line); ss >> ref >> colon >> bin2; ss.clear(); - if(colon.compare(0,1,":") == 0 ){ - bin1 = atoi(colon.substr(1).c_str()); - }else{ - bin1 = ref; ref = -10; bin2 = atoi(colon.c_str()); - } - if(mode!=0){bin1 = (mode==-1)?-1:(mode-1);bin2=-1;} - getline(fp,line); ss.str(line); ss >> fit_type; ss.clear(); - getline(fp,line); ss.str(line); ss >> i; strict = i!=0; ss.clear(); - getline(fp,line); ss.str(line); ss >> nrun >> nburn >> nwk >> mcmcfile; ss.clear(); - fp.close(); - /********* END Reading the input file **********/ - - /********** Read the light curves **************/ - vector > LC,LC_ref; - if ( ref == -10 ){ - for(i=0;i 0 or mode==-1 ){ - vec errs; errs.setlength(nfq); - vector lc1; for( i=0 ; i p1( lc1 , fqL ); - - p1.optimize( pars , errs ); - if( fit_type==1 ) p1.errors( pars , errs ); - }else if( mode == 0 ){ - vec ec,e1,e2,errs; ec.setlength(2*nfq);e1.setlength(nfq);e2.setlength(nfq);errs.setlength(4*nfq); - vector lc1,lc2; - if( ref==-10 ){ // standard way of getting reference - for( i=0 ; i p1( lc1 , fqL ), p2( lc2 , fqL ); - vec pars1,pars2;pars1.setlength(nfq);pars2.setlength(nfq);for(i=0;i l( lc1 , lc2 , fqL , pars ); - l.optimize( pc , ec ); - if( fit_type==1 ) l.errors( pc , ec ); - if( fit_type==2 ) { - mcmc mc( 2*nfq , mcmc_lag10 , (void*)&l ); - mc.nrun=nrun; mc.nburn=nburn; mc.nwk=nwk; - mc.run( pc , ec , mcmcfile.c_str() ); - } - - for(i=0;i pl( lc1 , lc2 , fqL ); - if( fit_type==3 ) pl.errors( pars , errs ); - if( fit_type==4 ) { - mcmc mc( 4*nfq , mcmc_psdlag10 , (void*)&pl ); - mc.nrun=nrun; mc.nburn=nburn; mc.nwk=nwk; - mc.run( pars , errs , mcmcfile.c_str() ); - } - - pl.print_pars( pars , errs ); - } -} - - - - - - - -/************************************** - * Usage function - * prints a sample input text - * INPUT: none - * RETURN: void - **************************************/ -void usage(){ - cerr << setw(40) << setfill('*') << "\n"; - cout << setw(30) << left << "1" << "# of lc" << endl; - cout << setw(30) << left << "lc.dat 0" << "name1 secL1" << endl; - cout << setw(30) << left << "3 1e-5 1e-4 5e-4 1e-3" << "nfq fqL1 fqL2.." << endl; - cout << setw(30) << left << "1" << "mode? 0:lag, n:psd" << endl; - cout << setw(30) << left << "1 1 1 1 1 1 1 1 1 1 1 1" << "init. pars" << endl; - cout << setw(30) << left << "0 1" << "bin1, bin2,-1: all" << endl; - cout << setw(30) << left << "0" << "fit_type" << endl; - cout << setw(30) << left << "0" << "strict" << endl; - cout << setw(30) << left << "100 50 50 mcmc.dat" << "nrun,nburn,nwk,file"<< endl; - cerr << setw(40) << setfill('*') << "\n"; -} - - - - - -/*************************************** - * READ LIGHTCURVES - * Read a standard light curve file that has a description at the top - * the first line is something like: # dT nlc b0 b1 b2 ... b_lc (b0 .. are bins boundaries) - * Then the content with: time lc1 err1 lc2 err2 ... etc - * - * INPUT: - * LC : a vector of vectors of light curves, where the first dimension is the number of - * light curves (i.e. segments), this is incremented in this function when reading a new file. - * The other dimension is either 1 for psd and 2 for lags, which contains either one light curve - * or two for the lag. Passed by reference - * fname : name of the light curve file - * secL : the section length to split the light curves to. - * b1 : the bin1 to read for the first light curve. 0-based, -1 for all - * b2 : the bin2 to read, 0-based, -1 for none (.i.e just psd) - * strict : a boolean on whether to be strict or not in segmenting the light curve - * e.g. for secL=220: 0 gives 100,100 and 1 gives 100,120 - * - **************************************/ -void readLC( vector >&LC , string fname , int secL , int b1 , int b2 , bool strict ){ - - /* Initialize file stream, define some variables */ - ifstream fp(fname.c_str()); string line,sdum; stringstream ss; - int i,j,nlc,n,nsec,ns,sl; double dt; - - /* read dt from the description line */ - getline(fp,line); ss.str(line); ss >> sdum >> dt >> nlc; ss.clear(); - - /* get the number of lines */ - n=0;while(getline(fp,line)){if(line!="")n++;} fp.clear(); fp.seekg(0,ios::beg);getline(fp,line); - - /* calculate section lengths */ - if(secL==0){secL=n;} - nsec = n/secL; vector secl(nsec,secL); if(not strict) secl[nsec-1] += n-nsec*secL; - - /* Start looping through the number of sections */ - for(ns=0;ns Lc; - vec t; vector lc(nlc),lce(nlc); t.setlength( sl ); for(i=0;i>t[i];for(j=0;j>lc[j][i]>>lce[j][i];} ss.clear(); - } - - // if we want the whole light curves in bin1 - if( b1==-1 ){ - vec lc_,lce_; lc_.setlength( sl );lce_.setlength( sl );for(i=0;i to LC - LC.push_back(Lc); - } - fp.close(); -} diff --git a/src/makefile b/src/makefile deleted file mode 100644 index 08bd484..0000000 --- a/src/makefile +++ /dev/null @@ -1,13 +0,0 @@ - -# original -#libdir='/eos/azoghbi/soft/usr/lib' -#incdir='/eos/azoghbi/soft/usr/include' -# most systems -#libdir='/home/caes/science/psdlag-agn/src/inc' -#incdir='/home/caes/science/psdlag-agn/src/inc' -# thor -libdir='/home/research/xaw5719/psdlag-agn/src/inc' -alglibdir='/home/research/xaw5719/psdlag-agn/src/inc/alglib' -incdir='/home/research/xaw5719/psdlag-agn/src/inc' -psdlag: - g++ *cpp inc/alglib/*cpp -o psdlag -O3 -Wall -I${incdir} -L${libdir} -L${alglibdir} -I${alglibdir} diff --git a/src/mcmc.cpp b/src/mcmc.cpp deleted file mode 100644 index 565061b..0000000 --- a/src/mcmc.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * mcmc.cpp - * - * Created on: May 14, 2013 - * Author: abduz - */ - -#include "inc/mcmc.hpp" - -mcmc::mcmc(int np,double (*f)(vec&,void*),void *p) { - npar = np; - loglikelihood = f; - ptr = p; - hqrndrandomize(rnd); - nrun = 100; nburn = 100; nwk = 100; ncheck = 10;avalue = 2.0; -} - -mcmc::~mcmc() {} - -void mcmc::run( vec& p, vec& pe, const char*fname){ - int i,j,k,nacc,nr,n,nsum; - vec2 pars; pars.setlength(nwk,npar); - vec prob,currp,bestp,sum,sum2; - ivec2 compj; - double bestlike,tmplike=-1e20,z,q,a1=1./sqrt(avalue),a2=sqrt(avalue);; - prob.setlength(nwk);currp.setlength(npar);bestp.setlength(npar);sum.setlength(npar);sum2.setlength(npar); - compj.setlength(nwk,nwk-1); - nsum=0;for(i=0;i-1e10 ){ - nacc++;for(i=0;inburn) { - for(i=0;i&cfq , vector& sfq ){ - //fqL[0] *= 1e-6; fqL[nfq]*=2; - int i,j,k, nfq=fqL.length()-1; - double tt,norm,t1,t2,pi=M_PI,pidt=pi*dt,sdt2,sdt1,cdt2,cdt1,s2dt2,s2dt1,c2dt2,c2dt1,dtmt,dtpt; - double st2,st1,ct2,ct1, sm2,sm1,cm2,cm1, sp2,sp1,cp2,cp1; - vec w; w.setlength(nfq+1); for( k=0 ; k<=nfq ; k++ ){ w[k] = 2*pi*fqL[k]; } - norm = 1./( pidt*pidt ); - - for( i=0 ; i3 ){dpar[i] = 3;} if( dpar[i]<-3 ){dpar[i] = -3;} - pars[i] += dpar[i]; - } -} diff --git a/src/psd_rms.cpp b/src/psd_rms.cpp deleted file mode 100644 index 0c90a2e..0000000 --- a/src/psd_rms.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * psd.cpp - * - * Created on: May 31, 2013 - * Author: azoghbi - */ - -#include "inc/psd_rms.hpp" - -psd_rms::psd_rms( lcurve inlc , vec fqL ) { - - // ----------- initial parameters ------------ // - n = inlc.len; - dt = inlc.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - mean = inlc.demean(); - mean2 = mean*mean; - int i; - for( i=0 ; i3 ){dpar[i] = 3;} if( dpar[i]<-3 ){dpar[i] = -3;} - pars[i] += dpar[i]; - } -} diff --git a/src/psdlag.cpp b/src/psdlag.cpp deleted file mode 100644 index 79f68fd..0000000 --- a/src/psdlag.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * psdlag.cpp - * - * Created on: Jun 1, 2013 - * Author: azoghbi - */ - -#include "inc/psdlag.hpp" - -psdlag::psdlag( lcurve lc1, lcurve lc2 , vec fqL ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - lc1.demean(); lc2.demean(); - int i; - for( i=0 ; i3000 ){dpar[i] = 3000;} if( dpar[i]<-3000 ){dpar[i] = -3000;} - pars[i] += dpar[i]/((n<10)?10:1); - } -} - - -void psdlag::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+3*nfq] -= 2*M_PI; } - while( pars[i+3*nfq] <-M_PI ){ pars[i+3*nfq] += 2*M_PI; } - mod::print_pars( pars , errs ); - } -} - -// ++++++++++++++++++++++++++++++++++++++++++++++++++++++ // - -psdlag10::psdlag10( lcurve lc1, lcurve lc2 , vec fqL ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - lc1.demean(); lc2.demean(); - int i; - for( i=0 ; i3 ){dpar[i] = 3;} if( dpar[i]<-3 ){dpar[i] = -3;} - //pars[i] += dpar[i]; - pars[i] += dpar[i]/((n<5)?10:1); - } -} - - -void psdlag10::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+3*nfq] -= 2*M_PI; } - while( pars[i+3*nfq] <-M_PI ){ pars[i+3*nfq] += 2*M_PI; } - } - mod::print_pars( pars , errs ); -} - -void psdlag10::what_pars( int& ip1 , int& ip2 ){ - ip1 = 3*nfq; ip2 = 4*nfq; -} diff --git a/src/psdlag_rms.cpp b/src/psdlag_rms.cpp deleted file mode 100644 index 1f78912..0000000 --- a/src/psdlag_rms.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * psdlag.cpp - * - * Created on: Jun 1, 2013 - * Author: azoghbi - */ - -#include "inc/psdlag_rms.hpp" - -psdlag_rms::psdlag_rms( lcurve lc1, lcurve lc2 , vec fqL ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - mean1 = lc1.demean(); mean2 = lc2.demean(); - mean1sq = mean1*mean1; mean2sq = mean2*mean2; mean12 = mean1*mean2; - int i; - for( i=0 ; i3000 ){dpar[i] = 3000;} if( dpar[i]<-3000 ){dpar[i] = -3000;} - pars[i] += dpar[i]/((n<10)?10:1); - } -} - - -void psdlag_rms::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+3*nfq] -= 2*M_PI; } - while( pars[i+3*nfq] <-M_PI ){ pars[i+3*nfq] += 2*M_PI; } - mod::print_pars( pars , errs ); - } -} - -// ++++++++++++++++++++++++++++++++++++++++++++++++++++++ // - -psdlag10_rms::psdlag10_rms( lcurve lc1, lcurve lc2 , vec fqL ) { - - // ----------- initial parameters ------------ // - n1 = lc1.len; - n = n1 + lc2.len; - dt = lc1.dt; - // ------------------------------------------ // - - - // ----------- light curve setup ------------ // - setlc(); - mean1 = lc1.demean(); mean2 = lc2.demean(); - mean1sq = mean1*mean1; mean2sq = mean2*mean2; mean12 = mean1*mean2; - int i; - for( i=0 ; i3 ){dpar[i] = 3;} if( dpar[i]<-3 ){dpar[i] = -3;} - //pars[i] += dpar[i]; - pars[i] += dpar[i]/((n<5)?10:1); - } -} - - -void psdlag10_rms::print_pars( vec& pars , vec& errs ){ - for( int i=0 ; i M_PI ){ pars[i+3*nfq] -= 2*M_PI; } - while( pars[i+3*nfq] <-M_PI ){ pars[i+3*nfq] += 2*M_PI; } - } - mod::print_pars( pars , errs ); -} - -void psdlag10_rms::what_pars( int& ip1 , int& ip2 ){ - ip1 = 3*nfq; ip2 = 4*nfq; -}