Changeset 4008 in Sophya
- Timestamp:
- Jun 23, 2011, 2:53:23 PM (13 years ago)
- Location:
- trunk/Cosmo/SimLSS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/cmvgsmcfit.cc
r3983 r4008 25 25 public: 26 26 MyFCN(TVector<r_4>& FreqMHz,TVector<r_4>& V,TVector<r_4>& EV); 27 void SetNu0(double nu0Mhz) {_nu0 = nu0Mhz;} 28 void SetTyp(bool law2 = false) {_law2 = law2;} 27 29 void InitFit(MnUserParameters& upar); 28 30 double Func(double fr,const vector<double>& par) const; 29 31 double operator()(const vector<double>& par) const; 30 32 double Up(void) const {return 1.;} 31 void SetNu0(double nu0Mhz) {_nu0 = nu0Mhz;}32 33 //protected: 33 34 double _nu0; 35 bool _law2; 34 36 mutable int _ndata; 35 37 TVector<r_4> _F; … … 43 45 { 44 46 int nslicemax = -1; 47 int typfit = 0; 45 48 if(narg<=1) { 46 cout<<"cmvgsmcfit cubefile.ppf [nslicemax] "<<endl;49 cout<<"cmvgsmcfit cubefile.ppf [nslicemax] [typfit=0,1]"<<endl; 47 50 return -1; 48 51 } 49 52 50 53 if(narg>2) nslicemax = atoi(arg[2]); 51 cout<<"Fitting "<<arg[1]<<" , nslicemax="<<nslicemax<<endl; 54 if(narg>3) typfit = atoi(arg[3]); 55 cout<<"Fitting "<<arg[1]<<" , nslicemax="<<nslicemax<<" , typfit="<<typfit<<endl; 52 56 53 57 int rc = 0; … … 61 65 pis>>PPFNameTag("freq")>>Freq; 62 66 63 const int nvar = 8;64 const char *vname[nvar] = {"x2r","ok","ph","th","v0","vn","A","N" };67 const int nvar = 10; 68 const char *vname[nvar] = {"x2r","ok","ph","th","v0","vn","A","N","B","DN"}; 65 69 NTuple nt(nvar,vname); 66 70 double xnt[nvar]; for(int i=0;i<nvar;i++) xnt[i] = 0.; … … 70 74 cout<<"...j = "<<j<<endl; 71 75 for(int k=0;k<Cube.SizeZ();k++) { 76 //cout<<"...k = "<<k<<endl; 72 77 73 78 TVector<r_4> V(Cube.SizeX()), EV(Cube.SizeX()); … … 79 84 MyFCN myfcn(Freq,V,EV); 80 85 myfcn.SetNu0(Freq(0)); 86 //myfcn.SetNu0((Freq(0)+Freq(Freq.Size()-1))/2.); 87 myfcn.SetTyp( ((typfit==1)? true: false) ); 81 88 MnUserParameters upar; 82 89 myfcn.InitFit(upar); … … 102 109 xnt[2] = j; xnt[3] = k; 103 110 xnt[4] = V(0); xnt[5] = V(V.Size()-1); 104 for( unsigned int i=0;i<par.size();i++) xnt[6+i] = par[i];111 for(int i=6;i<6+par.size() && i<nvar;i++) xnt[i] = par[i-6]; 105 112 nt.Fill(xnt); 106 113 //vector<double> err = ustate.Errors(); … … 155 162 throw SzMismatchError("MyFCN::MyFCN_Error: incompatible F / V / EV sizes"); 156 163 _nu0 = _F(0); 164 _law2 = false; 157 165 _ndata =_V.Size(); 158 166 } … … 165 173 166 174 upar.Add("A",a,a/50.); 167 upar.Add("N",ni,fabs(ni/50.)); 175 upar.Add("Nu",ni,fabs(ni/50.)); 176 177 if(!_law2) return; 178 upar.Add("B",0.,a/200.); 179 upar.Add("DNu",0.,fabs(ni/200.)); 180 168 181 } 169 182 170 183 double MyFCN::Func(double fr,const vector<double>& par) const 171 // v = A*(nu/nu0)^N 184 // v = A*(nu/nu0)^Nu 185 // v = A*(nu/nu0)^Nu + B/A*(nu/nu0)^(Nu+DNu) = A*(nu/nu0)^Nu * (1 + B*(nu/nu0)^DNu) 172 186 { 173 187 double f = par[0]*pow(fr/_nu0,par[1]); 188 if(_law2) f *= 1. + par[2]*pow(fr/_nu0,par[3]); 174 189 return f; 175 190 } … … 210 225 n/plot nt.log10(v0/vn)%v0 ! ! "crossmarker3" 211 226 212 213 227 zone 214 n/plot nt.A%_nl ! ! "crossmarker3" 215 n/plot nt.N%_nl ! ! "crossmarker3" 216 217 n/plot nt.A%v0 ! ! "crossmarker3" 218 n/plot nt.(A-v0)/v0%_nl ! ! "crossmarker3" 219 n/plot nt.N%A ! ! "crossmarker3" 228 n/plot nt.A%_nl ok>0 ! "crossmarker3" 229 n/plot nt.N%_nl ok>0 ! "crossmarker3" 230 n/plot nt.B%_nl ok>0 ! "crossmarker3" 231 n/plot nt.DN%_nl ok>0 ! "crossmarker3" 232 233 n/plot nt.A%v0 ok>0 ! "crossmarker3" 234 n/plot nt.(A-v0)/v0%_nl ok>0 ! "crossmarker3" 235 236 n/plot nt.N%A ok>0 ! "crossmarker3" 237 n/plot nt.B%A ok>0 ! "crossmarker3" 238 n/plot nt.DN%N ok>0 ! "crossmarker3" 220 239 221 240 set n 0 -
trunk/Cosmo/SimLSS/genefluct3d.cc
r3924 r4008 964 964 ---- ATTENTION: Le spectre Pk doit etre (dRho/Rho)(k) 965 965 ---- On genere la vitesse particuliere (dans le referentiel comobile au redshift "z") 966 Vlos(k) = i*Beta(z)*k(los)/k^2*(dRho/Rho)(k) 966 Vlos(k) = i*Beta(z)*k(los)/k^2*(dRho/Rho)(k) (unite Mpc) 967 967 .avec Beta(z) = dln(D)/da = -(1+z)/D*dD/dz 968 . on convertit en vitesse en faisant Vlos(k)/H(z)968 .puis on convertit en vitesse en faisant Vlos(k) * H(z) (unite lm/s) 969 969 */ 970 970 {
Note: See TracChangeset
for help on using the changeset viewer.