-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_emu.c
More file actions
550 lines (470 loc) · 18.5 KB
/
Copy pathinit_emu.c
File metadata and controls
550 lines (470 loc) · 18.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
double invcov_read(int READ, int ci, int cj);
double data_read(int READ, int ci);
double bary_read(int READ, int PC, int cj);
void init_data_inv_bary(char *INV_FILE, char *DATA_FILE, char *BARY_FILE);
void init_priors(double M_Prior, double SigZ_source, double DeltaZ_source_Prior, double SigZ_source_Prior, double SigZ_lens, double DeltaZ_lens_Prior, double SigZ_lens_Prior, double A_IA_Prior, double betaIA_Prior, double etaIA_Prior, double etaZIA_Prior, double Q1_Prior, double Q2_Prior, double Q3_Prior);
void init_survey(char *surveyname, double nsource, double nlens, double area);
void init_galaxies(char *SOURCE_ZFILE, char *LENS_ZFILE, char *lensphotoz, char *sourcephotoz, char *tomo_binning_source, char *tomo_binning_lens);
void init_cosmo_runmode(char *runmode);
void init_binning_fourier(int Ncl, double lmin, double lmax, double lmax_shear, double Rmin_bias, int Ntomo_source, int Ntomo_lens);
void init_probes(char *probes);
void init_lens_sample(char *lensphotoz, char *tomo_binning_lens);
void init_source_sample(char *sourcephotoz, char *tomo_binning_source);
void set_galaxies_source();
void set_lens_galaxies_LSST();
void set_equal_tomo_bins();
void init_IA(char *model,char *lumfct);
int count_rows(char* filename,const char delimiter){
FILE *file = fopen (filename, "r" );
char line [1000];
if (file != NULL) {
fgets(line,sizeof line,file);
fclose(file);
}
else{
printf("count_rows: file %s not found.\nEXIT\n",filename);
exit(1);
}
int count = 1;
char *p;
p = line;
while (*p != '\0')
{
if (*p == delimiter){
while (*p == delimiter){p++;}
count++;
}
p++;
}
return count;
}
void init_data_inv_bary(char *INV_FILE, char *DATA_FILE, char *BARY_FILE)
{
double init;
printf("\n");
printf("---------------------------------------\n");
printf("Initializing data vector and covariance\n");
printf("---------------------------------------\n");
sprintf(like.INV_FILE,"%s",INV_FILE);
printf("PATH TO INVCOV: %s\n",like.INV_FILE);
sprintf(like.DATA_FILE,"%s",DATA_FILE);
printf("PATH TO DATA: %s\n",like.DATA_FILE);
sprintf(like.BARY_FILE,"%s",BARY_FILE);
printf("PATH TO BARYONS: %s\n",like.BARY_FILE);
init=data_read(0,1);
init=bary_read(0,1,1);
init=invcov_read(0,1,1);
}
double invcov_read(int READ, int ci, int cj)
{
int i,j,intspace;
static double **inv =0;
if(READ==0 || inv == 0){
inv = create_double_matrix(0, like.Ndata-1, 0, like.Ndata-1);
FILE *F;
F=fopen(like.INV_FILE,"r");
for (i=0;i<like.Ndata; i++){
for (j=0;j<like.Ndata; j++){
fscanf(F,"%d %d %le\n",&intspace,&intspace,&inv[i][j]);
}
}
fclose(F);
printf("FINISHED READING COVARIANCE\n");
}
return inv[ci][cj];
}
double data_read(int READ, int ci)
{
int i,intspace;
static double *data = 0;
if(READ==0 || data ==0){
data = create_double_vector(0, like.Ndata-1);
FILE *F;
F=fopen(like.DATA_FILE,"r");
for (i=0;i<like.Ndata; i++){
fscanf(F,"%d %le\n",&intspace,&data[i]);
}
fclose(F);
printf("FINISHED READING DATA VECTOR\n");
}
return data[ci];
}
double bary_read(int READ, int PC, int cj)
{
int i,j,intspace, N_PC=6;
static double **bary =0;
if(READ==0 || bary == 0){
bary = create_double_matrix(0, N_PC-1, 0, like.Ndata-1);
FILE *F;
F=fopen(like.BARY_FILE,"r");
for (i=0;i<like.Ndata; i++){
fscanf(F,"%d %le %le %le %le %le %le\n",&intspace,&bary[0][i],&bary[1][i],&bary[2][i],&bary[3][i],&bary[4][i],&bary[5][i]);
}
fclose(F);
printf("FINISHED READING BARYON MATRIX\n");
}
return bary[PC][cj];
}
void init_cosmo_runmode(char *runmode)
{
printf("\n");
printf("-------------------------------------------\n");
printf("Initializing Standard Runmode/Cosmology\n");
printf("-------------------------------------------\n");
set_cosmological_parameters_to_Planck_15_TT_TE_EE_lowP();
//set_cosmological_parameters_to_Joe();
sprintf(pdeltaparams.runmode,"%s",runmode);
printf("pdeltaparams.runmode =%s\n",pdeltaparams.runmode);
}
void init_binning_fourier(int Ncl, double lmin, double lmax, double lmax_shear, double Rmin_bias, int Ntomo_source, int Ntomo_lens)
{
printf("-------------------------------------------\n");
printf("Initializing Binning\n");
printf("-------------------------------------------\n");
like.Rmin_bias=Rmin_bias;
like.Ncl=Ncl;
like.lmin= lmin; //std=20
like.lmax= lmax; //15,000
like.lmax_shear = lmax_shear; //5000
tomo.shear_Nbin=Ntomo_source;
tomo.clustering_Nbin=Ntomo_lens;
double ell;
int i,k=0;
double logdl=(log(like.lmax)-log(like.lmin))/like.Ncl;
for(i=0;i<like.Ncl;i++){
ell=exp(log(like.lmin)+(i+0.5)*logdl);
}
printf("number of ell bins Ncl: %d\n",like.Ncl);
printf("minimum ell: %le\n",like.lmin);
printf("maximum ell: %le\n",like.lmax);
}
void init_priors(double M_Prior, double SigZ_source, double DeltaZ_source_Prior, double SigZ_source_Prior, double SigZ_lens, double DeltaZ_lens_Prior, double SigZ_lens_Prior, double A_ia_Prior, double beta_ia_Prior, double eta_ia_Prior, double etaZ_ia_Prior, double Q1_Prior, double Q2_Prior, double Q3_Prior)
{
int i;
printf("\n");
printf("---------------------------------------\n");
printf("Initializing observational priors for marginalization\n");
printf("---------------------------------------\n");
for (i=0;i<tomo.shear_Nbin; i++){
prior.shear_calibration_m[i][0] = 0.0;
prior.shear_calibration_m[i][1] = M_Prior;
}
like.shearcalib=1;
for (i=0;i<tomo.shear_Nbin; i++){
nuisance.bias_zphot_shear[i]=0.0;
nuisance.sigma_zphot_shear[i]=SigZ_source;
// center of Gaussian priors
prior.bias_zphot_shear[i][0]=nuisance.bias_zphot_shear[i];
prior.sigma_zphot_shear[i][0]=nuisance.sigma_zphot_shear[i];
// rms width of Gaussian priors
prior.bias_zphot_shear[i][1] = DeltaZ_source_Prior;
prior.sigma_zphot_shear[i][1]= SigZ_source_Prior;
}
like.wlphotoz=1;
for (i=0;i<tomo.clustering_Nbin; i++){
nuisance.bias_zphot_clustering[i]=0.0;
nuisance.sigma_zphot_clustering[i]=SigZ_lens;
// center of Gaussian priors
prior.bias_zphot_clustering[i][0]=nuisance.bias_zphot_clustering[i];
prior.sigma_zphot_clustering[i][0]=nuisance.sigma_zphot_clustering[i];
// rms width of Gaussian priors
prior.bias_zphot_clustering[i][1] = DeltaZ_lens_Prior;
prior.sigma_zphot_clustering[i][1]= SigZ_lens_Prior;
}
like.clphotoz=1;
prior.A_ia[0]=5.92;
prior.A_ia[1]=A_ia_Prior;
prior.beta_ia[0]=1.1;
prior.beta_ia[1]=beta_ia_Prior;
prior.eta_ia[0]=-0.47;
prior.eta_ia[1]=eta_ia_Prior;
prior.eta_ia_highz[0]=0.0;
prior.eta_ia_highz[1]=etaZ_ia_Prior;
like.IA=1;
prior.bary_Q1[0]=0.0;
prior.bary_Q1[1]=Q1_Prior;
prior.bary_Q2[0]=0.0;
prior.bary_Q2[1]=Q2_Prior;
prior.bary_Q3[0]=0.0;
prior.bary_Q3[1]=Q3_Prior;
like.baryons=1;
printf("\n");
printf("---------------------------------------\n");
printf("Shear Calibration Prior\n");
printf("Mean=%le, Sigma=%le\n",prior.shear_calibration_m[0][0],prior.shear_calibration_m[i][1]);
printf("\n");
printf("---------------------------------------\n");
printf("Photo-z priors Weak Lensing\n");
printf("Delta_z=%le, Sigma (Delta_z)=%le\n",prior.bias_zphot_shear[0][0],prior.bias_zphot_shear[0][1]);
printf("Sigma_z=%le, Sigma (Sigma_z)=%le\n",prior.sigma_zphot_shear[0][0],prior.sigma_zphot_shear[0][1]);
printf("\n");
printf("---------------------------------------\n");
printf("Photo-z priors Clustering\n");
printf("Delta_z=%le, Sigma (Delta_z)=%le\n",prior.bias_zphot_clustering[0][0],prior.bias_zphot_clustering[0][1]);
printf("Sigma_z=%le, Sigma (Sigma_z)=%le\n",prior.sigma_zphot_clustering[0][0],prior.sigma_zphot_clustering[0][1]);
printf("\n");
printf("---------------------------------------\n");
printf("IA Priors\n");
printf("A_IA=%le, A_IA_Prior=%le\n",prior.A_ia[0],prior.A_ia[1]);
printf("beta_ia=%le, betaIA_Prior=%le\n",prior.beta_ia[0],prior.beta_ia[1]);
printf("eta_ia=%le, etaIA_Prior=%le\n",prior.eta_ia[0],prior.eta_ia[1]);
printf("eta_ia_highz=%le, etaZIA_Prior=%le\n",prior.eta_ia_highz[0],prior.eta_ia_highz[1]);
printf("\n");
printf("---------------------------------------\n");
printf("Baryon Priors\n");
printf("Q1=%le, Sigma (Q1)=%le\n",prior.bary_Q1[0],prior.bary_Q1[1]);
printf("Q2=%le, Sigma (Q2)=%le\n",prior.bary_Q2[0],prior.bary_Q2[1]);
printf("Q3=%le, Sigma (Q3)=%le\n",prior.bary_Q3[0],prior.bary_Q3[1]);
}
void init_survey(char *surveyname, double nsource, double nlens, double area)
{
printf("\n");
printf("-------------------------------\n");
printf("Initializing Survey Parameters\n");
printf("-------------------------------\n");
survey.area = area;
survey.n_gal = nsource;
survey.n_lens=nlens;
survey.sigma_e = 0.37;
sprintf(survey.name,"%s",surveyname);
survey.area_conversion_factor = 60.0*60.0*constants.arcmin*constants.arcmin;
survey.n_gal_conversion_factor=1.0/constants.arcmin/constants.arcmin;
survey.m_lim=24.5;
printf("Survey set to %s\n",survey.name);
printf("Survey area: %le deg^2\n",survey.area);
printf("Source Galaxy Density: %le galaxies/arcmin^2\n",survey.n_gal);
}
void init_galaxies(char *SOURCE_ZFILE, char *LENS_ZFILE, char *lensphotoz, char *sourcephotoz, char *tomo_binning_source, char *tomo_binning_lens)
{
printf("\n");
printf("-----------------------------------\n");
printf("Initializing galaxy samples\n");
printf("-----------------------------------\n");
sprintf(redshift.shear_REDSHIFT_FILE,"%s",SOURCE_ZFILE);
printf("PATH TO SOURCE_ZFILE: %s\n",redshift.shear_REDSHIFT_FILE);
init_source_sample(sourcephotoz,tomo_binning_source);
sprintf(redshift.clustering_REDSHIFT_FILE,"%s",LENS_ZFILE);
printf("\n");
printf("PATH TO LENS_ZFILE: %s\n",redshift.clustering_REDSHIFT_FILE);
init_lens_sample(lensphotoz,tomo_binning_lens);
}
void init_probes(char *probes)
{
printf("\n");
printf("------------------------------\n");
printf("Initializing Probes\n");
printf("------------------------------\n");
printf("tomo.cluster_Nbin=%d\n",tomo.cluster_Nbin);
printf("tomo.cgl_Npowerspectra=%d\n",tomo.cgl_Npowerspectra);
printf("Cluster.lbin=%d\n",Cluster.lbin);
printf("Cluster.N200_Nbin=%d\n",Cluster.N200_Nbin);
printf("like.Ncl=%d\n",like.Ncl);
printf("tomo.shear_Npowerspectra=%d\n",tomo.shear_Npowerspectra);
printf("tomo.ggl_Npowerspectra=%d\n",tomo.ggl_Npowerspectra);
printf("tomo.clustering_Npowerspectra=%d\n",tomo.clustering_Npowerspectra);
sprintf(like.probes,"%s",probes);
if(strcmp(probes,"clusterN")==0){
like.Ndata=tomo.cluster_Nbin*Cluster.N200_Nbin;
like.clusterN=1;
printf("Cluster Number Counts computation initialized\n");
}
if(strcmp(probes,"clusterN_clusterWL")==0){
like.Ndata=tomo.cluster_Nbin*Cluster.N200_Nbin+tomo.cgl_Npowerspectra*Cluster.N200_Nbin*Cluster.lbin;
like.clusterN=1;
like.clusterWL=1;
printf("Cluster Number Counts computation initialized\n");
printf("Cluster weak lensing computation initialized\n");
}
if(strcmp(probes,"3x2pt_clusterN")==0){
like.Ndata=like.Ncl*(tomo.shear_Npowerspectra+tomo.ggl_Npowerspectra+tomo.clustering_Npowerspectra)+tomo.cluster_Nbin*Cluster.N200_Nbin;
like.shear_shear=1;
like.shear_pos=1;
like.pos_pos=1;
like.clusterN=1;
printf("Shear-Shear computation initialized\n");
printf("Shear-Position computation initialized\n");
printf("Position-Position computation initialized\n");
printf("Cluster Number Counts computation initialized\n");
}
if(strcmp(probes,"shear_shear")==0){
like.Ndata=like.Ncl*tomo.shear_Npowerspectra;
like.shear_shear=1;
printf("Shear-Shear computation initialized\n");
}
if(strcmp(probes,"pos_pos")==0){
like.Ndata= like.Ncl*tomo.clustering_Npowerspectra;
like.pos_pos=1;
printf("Position-Position computation initialized\n");
}
if(strcmp(probes,"ggl_cl")==0){
like.Ndata=like.Ncl*(tomo.ggl_Npowerspectra+tomo.clustering_Npowerspectra);
like.shear_pos=1;
like.pos_pos=1;
printf("Shear-Position computation initialized\n");
printf("Position-Position computation initialized\n");
}
if(strcmp(probes,"3x2pt")==0){
like.Ndata=like.Ncl*(tomo.shear_Npowerspectra+tomo.ggl_Npowerspectra+tomo.clustering_Npowerspectra);
like.shear_shear=1;
like.shear_pos=1;
like.pos_pos=1;
printf("Shear-Shear computation initialized\n");
printf("Shear-Position computation initialized\n");
printf("Position-Position computation initialized\n");
}
printf("Total number of data points like.Ndata=%d\n",like.Ndata);
}
void init_lens_sample(char *lensphotoz, char *tomo_binning_lens)
{
if(strcmp(lensphotoz,"none")==0) redshift.clustering_photoz=0;
if(strcmp(lensphotoz,"voigt")==0) redshift.clustering_photoz=1;
if(strcmp(lensphotoz,"voigt_out")==0) redshift.clustering_photoz=2;
if(strcmp(lensphotoz,"gaussian")==0) redshift.clustering_photoz=3;
if(strcmp(lensphotoz,"multihisto")==0) redshift.clustering_photoz=4;
if ((redshift.clustering_photoz !=0) && (redshift.clustering_photoz !=1) && (redshift.clustering_photoz !=2) && (redshift.clustering_photoz !=3))
{
printf("init.c: init_lens_sample: redshift.clustering_photoz = %d not set properly!\nEXIT!\n",redshift.clustering_photoz);
exit(1);
}
printf("Lens Sample Redshift Errors set to %s: redshift.clustering_photoz=%d\n",lensphotoz,redshift.clustering_photoz);
if(strcmp(tomo_binning_lens,"LSST_gold")==0){
set_lens_galaxies_LSST();
}
//call test_kmax once to initialize look-up tables at reference cosmology
test_kmax(1000.,1);
}
void init_source_sample(char *sourcephotoz, char *tomo_binning_source)
{
if(strcmp(sourcephotoz,"none")==0) redshift.shear_photoz=0;
if(strcmp(sourcephotoz,"voigt")==0) redshift.shear_photoz=1;
if(strcmp(sourcephotoz,"voigt_out")==0) redshift.shear_photoz=2;
if(strcmp(sourcephotoz,"gaussian")==0) redshift.shear_photoz=3;
if(strcmp(sourcephotoz,"multihisto")==0) {
printf("redshift.shear_photoz=4 not supported\n");
exit(1);
}
if ((redshift.shear_photoz !=0) && (redshift.shear_photoz !=1) && (redshift.shear_photoz !=2) && (redshift.shear_photoz !=3))
{
printf("init.c: init_source_sample: redshift.shear_photoz = %d not set properly!\nEXIT!\n",redshift.shear_photoz);
exit(1);
}
printf("Source Sample Redshift Errors set to %s: redshift.shear_photoz=%d\n",sourcephotoz,redshift.shear_photoz);
if(strcmp(tomo_binning_source,"source_std")==0)set_galaxies_source();
}
void set_galaxies_source()
{
int k,j;
double frac, zi;
tomo.shear_Npowerspectra=(int) (tomo.shear_Nbin*(tomo.shear_Nbin+1)/2);
zdistr_histo_1(0.1, NULL);
int zbins =2000;
double da = (redshift.shear_zdistrpar_zmax-redshift.shear_zdistrpar_zmin)/(1.0*zbins);
double *sum;
sum=create_double_vector(0, zbins);
sum[0] = 0.0;
for (k = 0, zi = redshift.shear_zdistrpar_zmin; k<zbins; k++,zi+=da){
sum[k+1] = sum[k]+zdistr_histo_1(zi, NULL);
}
tomo.shear_zmin[0] = redshift.shear_zdistrpar_zmin;
tomo.shear_zmax[tomo.shear_Nbin-1] = redshift.shear_zdistrpar_zmax;
printf("\n");
printf("Source Sample - Tomographic Bin limits:\n");
for(k=0;k<tomo.shear_Nbin-1;k++){
frac=(k+1.)/(1.*tomo.shear_Nbin)*sum[zbins-1];
j = 0;
while (sum[j]< frac){
j++;
}
tomo.shear_zmax[k] = redshift.shear_zdistrpar_zmin+j*da;
tomo.shear_zmin[k+1] = redshift.shear_zdistrpar_zmin+j*da;
printf("min=%le max=%le\n",tomo.shear_zmin[k],tomo.shear_zmax[k]);
}
printf("min=%le max=%le\n",tomo.shear_zmin[tomo.shear_Nbin-1],tomo.shear_zmax[tomo.shear_Nbin-1]);
printf("redshift.shear_zdistrpar_zmin=%le max=%le\n",redshift.shear_zdistrpar_zmin,redshift.shear_zdistrpar_zmax);
free_double_vector(sum,0,zbins);
}
void set_lens_galaxies_LSST()
{
int i,j,n,k;
double frac, zi;
redshift.clustering_zdistrpar_zmin = 0.01;
redshift.clustering_zdistrpar_zmax = 1.5;
tomo.clustering_Npowerspectra=tomo.clustering_Nbin;
tomo.clustering_zmin[0] = 0.2;
tomo.clustering_zmax[tomo.clustering_Nbin-1] = 1.2;
int zbins =2000;
double da = (tomo.clustering_zmax[tomo.clustering_Nbin-1]-tomo.clustering_zmin[0])/(1.0*zbins);
double *sum;
sum=create_double_vector(0, zbins);
sum[0] = 0.0;
for (k = 0, zi = tomo.clustering_zmin[0]; k<zbins; k++,zi+=da){
sum[k+1] = sum[k]+pf_histo(zi, NULL);
}
printf("\n");
printf("Source Sample - Tomographic Bin limits:\n");
for(k=0;k<tomo.clustering_Nbin-1;k++){
frac=(k+1.)/(1.*tomo.clustering_Nbin)*sum[zbins-1];
j = 0;
while (sum[j]< frac){
j++;
}
tomo.clustering_zmax[k] = tomo.clustering_zmin[0]+j*da;
tomo.clustering_zmin[k+1] = tomo.clustering_zmin[0]+j*da;
printf("min=%le max=%le\n",tomo.clustering_zmin[k],tomo.clustering_zmax[k]);
}
printf("min=%le max=%le\n",tomo.clustering_zmin[tomo.clustering_Nbin-1],tomo.clustering_zmax[tomo.clustering_Nbin-1]);
printf("redshift.clustering_zdistrpar_zmin=%le max=%le\n",redshift.clustering_zdistrpar_zmin,redshift.clustering_zdistrpar_zmax);
free_double_vector(sum,0,zbins);
gbias.b1_function = &b1_per_bin;
for (i =0; i < tomo.clustering_Nbin ; i++){
//gbias.b[i] = 0.95/(growfac(1./(1.+(tomo.clustering_zmax[i]+tomo.clustering_zmin[i]/2.)))/growfac(1.));
gbias.b[i] = 1.3+0.1*i;
printf("Bin %d: galaxy bias=%le\n",i,gbias.b[i]);
}
n=0;
for (i = 0; i < tomo.clustering_Nbin; i++){
for(j = 0; j<tomo.shear_Nbin;j++){
n += test_zoverlap(i,j);
printf("GGL combinations zl=%d zs=%d accept=%d\n",i,j,test_zoverlap(i,j));
}
}
tomo.ggl_Npowerspectra = n;
printf("%d GGL Powerspectra\n",tomo.ggl_Npowerspectra);
}
void init_IA(char *model,char *lumfct)
{
if(strcmp(lumfct,"GAMA")==0) set_LF_GAMA();
else if(strcmp(lumfct,"DEEP2")==0) set_LF_DEEP2();
else {
printf("init.c:init_IA: %s lumfct not defined\n",lumfct);
printf("USING GAMA LF INSTEAD\n");
set_LF_GAMA();
}
printf("SET LUMINOSITY FUNCTION=%s\n",lumfct);
nuisance.oneplusz0_ia=1.3;
//z0=0.3 is arbitrary pivot redshift J11 p18
nuisance.c1rhocrit_ia=0.0134;
// J11 p.8
if(strcmp(model,"none")==0) like.IA=0;
else if(strcmp(model,"NLA_HF")==0) like.IA=1;
else if(strcmp(model,"lin")==0) like.IA=2;
else{
printf("init.c:init_IA: %s IA model not defined\n",model);
exit(1);
}
printf("SET IA MODEL=%s\n",model);
set_ia_priors();
log_like_f_red();
}
void init_HOD_rm(){
set_HOD_redmagic_priors();
like.Rmin_bias = 0.1;//use halo+HOD model down to 100 kpc/h
redm.parameterization = 0; //Zehavi et al. 2011 HOD parameterization
redm.cg = 1.0;
redm.fc = 0.2;
redm.hod[0] = 12.1;
redm.hod[1] = 0.4;
redm.hod[2] = 13.65;
redm.hod[3] = 12.2;
redm.hod[4] = 1.0;
}