source: Sophya/trunk/Cosmo/RadioBeam/subtractradsrc.cmd@ 3976

Last change on this file since 3976 was 3975, checked in by ansari, 14 years ago

Changement ds les indices spectrales synchrotron/radio-sources, Reza 29/04/2011

File size: 10.0 KB
Line 
1#####################################################################################
2#### Commands to run the different programs to produce foreground maps
3#### and compute radio-source subtracted P(k)
4#####################################################################################
5
6### Cube definition in file cubedef.h
7
8### Step 1/ Produce an LSS data cube with appropriate size and redshift using SimLSS
9# 1.a/ Run SimLSS
10csh> ~/Objs/exe/cmvginit3df -a -1 -2 -C -G 0. -F 0 -x 360,3 -y 360,3 -z 256,1.5 -Z 0.56 -8 1. -n 10000 -O 0,2 -o lssz056 -T 2
11# 1.b/ To run SimLSS with GSM map parameters (DeltaFreq=500 MHz)
12csh> ~/Objs/exe/cmvginit3df -a -1 -2 -C -G 0. -F 0 -x 360,3 -y 360,3 -z 256,3 -Z 0.60 -8 1. -n 10000 -O 0,2 -o lssz060 -T 2
13
14# 1.c/ To run SimLSS with GSM map parametersand 40x40 deg maps (DeltaFreq=500 MHz)
15csh> ~/Objs/exe/cmvginit3df -a -1 -2 -C -G 0. -F 0 -x 600,1.9 -y 800,1.9 -z 256,2.8 -Z 0.60 -8 1. -n 10000 -O 0,2 -o lssz060 -T 2
16
17# 1.c/ Change the X and Z axis of the cube to adapt it to RadioBeam package convention
18# SimLSS output : the radial (redshift) direction along X axis of the cube (TArray)
19# RadioBeam cubes : the radial (redshift) direction along Z axis of the cube (TArray)
20# Execucte the following script in spiapp :
21
22csh> cat > racube.pic
23set f lssz060
24readfits ${f}_r.fits
25rename ${f}_r map
26print map
27c++exec \
28 TArray<r_4> omap(map.SizeY(),map.SizeZ(),map.SizeX()-2 ); \
29 for(sa_size_t i=0;i<omap.SizeX();i++) \
30 for(sa_size_t j=0;j<omap.SizeY();j++) \
31 for(sa_size_t k=0;k<omap.SizeZ();k++) \
32 omap(i,j,k)=map(k+1,i,j); \
33 KeepObj(omap);
34
35rename omap lsscube
36print lsscube
37# expmeansig lsscube val
38saveppf lsscube lsscubez060.ppf
39
40csh> spiapp -term -exec racube.pic
41
42#### Cube LSS 40x30 deg (3') @ z=0.6 ( lsscubez060.ppf )
43#### -> Size= 122880000 Mean=-7.01664e-05 Sigma=2.53016 Min=-13.7439 Max=14.4648
44
45## Step 2/ Produce synchrotron and radio source sky cubes (cube unit is Temparature- Kelvin)
46# 2.a/ Synchrotron map from HASLAM 400 MHz map
47csh> ./Objs/syncube syncmap_eq.fits syncube.ppf syncmap.ppf
48# 2.b/ radio source cube from NVSS catalog
49csh> ./Objs/srcat2cube -nvss nvss.fits nvsscube.ppf nvssmap.ppf
50# Or from the north20 catalog :
51csh> ./Objs/srcat2cube -north20 north20cm.fits north20cube.ppf north20map.ppf
52
53# 2.c/ Add the two cubes using the following spiapp script
54csh> cat > sumcubes.pic
55openppf syncube.ppf
56openppf radsrccube.ppf
57# expmeansig syncube val
58# expmeansig nvsscube val
59c++exec TArray<r_4> fgndcube = syncube+radsrccube; KeepObj(fgndcube);
60print fgndcube
61# expmeansig fgndcube val
62saveppf fgndcube fgndcube.ppf
63
64csh> spiapp -term -exec sumcubes.pic
65
66#### syncube:Mean= 1.8101 Sigma= 0.326538 Min= 0.857019 Max= 3.58987
67#### nvsscube: Mean= 1.95073 Sigma= 1.68515 Min= 0.857019 Max= 428.398
68#### fgndcube=syncube+nvsscube: Mean= 0.140623 Sigma= 1.65068 Min= 0 Max= 426.559
69#### north20: fgndcube_north:
70
71## Step 2.b/ Produce foreground cube from GSM
72csh> ./Objs/gsm2cube ../Catalogs/GSM/ 1 256 fgndcube_gsm.ppf
73
74## Step 3/ Apply lobe (50 meter diameter array) effect on foreground cube and LSS cube
75csh> set ddish=55.
76csh> set ddishcor=55.
77csh> ./Objs/applobe $ddish fgndcube.ppf fgndcube_lobe.ppf
78csh> ./Objs/applobe -fib $ddish fgndcube.ppf fgndcube_flobe.ppf
79csh> ./Objs/applobe $ddish lsscube.ppf lsscube_lobe.ppf
80csh> ./Objs/applobe -fib $ddish lsscube.ppf lsscube_flobe.ppf
81## Step 3.b/ Correct for the lobe effect by bringing all to the beam of Diam/Lambda = 150 (55 m @ z=0.7 - 820 MHz)
82csh> ./Objs/applobe $ddish lsscube_lobe.ppf lsscube_corlobe.ppf $ddishcor
83csh> ./Objs/applobe $ddish fgndcube_lobe.ppf fgndcube_corlobe.ppf $ddishcor
84
85## Step 3.c/ Apply lobe (Filled 11x11 5m dishes array) effect on foreground cube and LSS cube
86csh> ./Objs/applobe repf11x11.ppf fgndcube.ppf fgndcube_lobe.ppf
87csh> ./Objs/applobe repf11x11.ppf lsscube.ppf lsscube_lobe.ppf
88## Step 3.d/ Correct for the lobe effect by bringing all to the beam of Diam/Lambda = 150 (55 m @ z=0.7 - 820 MHz)
89csh> ./Objs/applobe repf11x11.ppf lsscube_lobe.ppf lsscube_corlobe.ppf $ddishcor
90csh> ./Objs/applobe repf11x11.ppf fgndcube_lobe.ppf fgndcube_corlobe.ppf $ddishcor
91
92### Step 4/ Compute power spectra
93## mass to temperature converion factor CT21 ~= 0.21 mK for gHI=2% , 0.11 for gHI=1% , 0.13 for gHI=0.008x(1+0.6)
94## Foreground maps are in temperature
95## Noise fluctuations Sigma^2 ~ T_sys^2 / t_obs * DeltaFreq
96## Tsys ~ 50 K , DeltaFreq ~ 0.5 MHz , t_obs ~ 1 day ~ 80 000 s.
97## sigma_noise ~ 0.25 mK -> 3 mK
98# 4.a/ LSS power spectrum without noise
99csh> ./Objs/calcpk lsscube.ppf lsspk.ppf 0.13
100# and with noise
101csh> ./Objs/calcpk lsscube.ppf lsspkwn.ppf 0.13 3
102# with the lobe effect
103csh> ./Objs/calcpk lsscube_lobe.ppf lsspklobe.ppf 0.13
104csh> ./Objs/calcpk lsscube_flobe.ppf lsspkflobe.ppf 0.13
105csh> ./Objs/calcpk lsscube_lobe.ppf lsspklobewn.ppf 0.13 3
106csh> ./Objs/calcpk lsscube_corlobe.ppf lsspkcorlobe.ppf 0.13
107
108# 4.b/ Foreground power spectrum
109csh> ./Objs/calcpk fgndcube.ppf fgndpk.ppf 1000
110csh> ./Objs/calcpk fgndcube_lobe.ppf fgndpklobe.ppf 1000
111csh> ./Objs/calcpk fgndcube_flobe.ppf fgndpkflobe.ppf 1000
112csh> ./Objs/calcpk fgndcube_corlobe.ppf fgndpkcorlobe.ppf 1000
113
114# 4.c/ Extract LSS P(k) from Foreground+LSS+noise , after cleaning/subtraction without beam
115csh> set beamdesc=repf11x11.ppf
116csh> set ddishcor=55.
117csh> set noiselev=1.
118csh> ./Objs/calcpk2 lsscube.ppf 0.13 fgndcube.ppf 1000 subpk.ppf $noiselev $beamdesc 0. 0. P2
119# 4.d / Extract LSS P(k) from Foreground+LSS+noise and beam effect, without beam correction
120csh> ./Objs/calcpk2 lsscube_lobe.ppf 0.13 fgndcube_lobe.ppf 1000 subpklobe.ppf $noiselev $beamdesc 0. 0. P2
121# 4.e / Extract LSS P(k) from Foreground+LSS+noise and beam effect - correcting to a beam of Diam= $ddishcor
122csh> ./Objs/calcpk2 lsscube_lobe.ppf 0.13 fgndcube_lobe.ppf 1000 subpkcorlobe.ppf $noiselev $beamdesc $ddishcor 0. P2 reclsscorlobe.ppf
123# Or using a linear fit for foreground subtraction (old version)
124csh> ./Objs/calcpk2 lsscube_lobe.ppf 0.13 fgndcube_lobe.ppf 1000 subpkcorlobep1.ppf $noiselev $beamdesc $ddishcor 0. P2
125# 4.f / Estimate residual noise from Foreground removal :
126csh> ./Objs/calcpk2 lsscube.ppf 0. fgndcube_lobe.ppf 1000 residcorlobe.ppf $noiselev $beamdesc $ddishcor 0. P2
127csh> ./Objs/calcpk2 lsscube.ppf 0. fgndcube_lobe.ppf 1000 residnocor.ppf $noiselev $beamdesc 0. 0. P2
128
129### Step 5 / Check the results using spiapp
130setaxesatt 'font=helvetica,bold,16 fixedfontsize minorticks'
131delobjs *
132openppf fgndpk.ppf
133openppf fgndpklobe.ppf
134openppf fgndpkflobe.ppf
135openppf fgndpkcorlobe.ppf
136openppf lsspk.ppf
137openppf lsspklobe.ppf
138openppf lsspkcorlobe.ppf
139
140openppf lsspkflobe.ppf
141openppf lsspklobewn.ppf
142openppf subpklobe.ppf
143
144openppf subpkcorlobe.ppf
145
146openppf residcorlobe.ppf
147openppf residnocor.ppf
148# openppf subpknolssnocor.ppf
149
150disp lsspk 'logx logy nsta xylimits=0.01,2.,4e-11,8e-6 gold'
151disp lsspklobe 'same nsta orange'
152disp lsspklobewn 'same nsta siennared'
153settitle ' Pk[LSS] - without normalisation' ' ' 'font=helvetica,bold,16 black'
154
155
156disp fgndpk 'logx logy nsta xylimits=0.01,2.,1e-10,1. navyblue'
157disp fgndpklobe 'same nsta blue'
158disp fgndpkcorlobe 'same nsta skyblue'
159disp lsspk 'same nsta gold'
160disp lsspkflobe 'same nsta yellow'
161disp subpkcorlobe 'same nsta red'
162disp residcorlobe 'same nsta green'
163disp residnocor 'same nsta forestgreen'
164
165disp lsspklobewn 'same nsta siennared'
166# settitle 'Pk[LSS] , Pk[Foreground] and lobe effect (Dish D=50 m)' ' ' 'font=helvetica,bold,18'
167settitle 'Pk[LSS] , Pk[Foreground=GSM] and lobe effect (Dish D=50 m)' ' ' 'font=helvetica,bold,18'
168
169set lines ( 'Pk[Foreground]' 'Pk[fgnd]*Lobe' 'Pk[fgnd]*Lobe/Corrected' 'Pk[LSS]' 'Pk[LSS]*Lobe+Noise' )
170set cols ( navyblue blue skyblue gold siennared )
171textdrawer lines cols 'font=helvetica,bold,16 frame'
172
173
174disp lsspk 'logx logy nsta xylimits=0.005,2.,4e-9,4e-5 gold'
175disp lsspklobewn 'same nsta siennared'
176disp subpkcorlobe 'same nsta red'
177disp subpknolss 'same nsta green'
178
179# Calcul du volume total en Mpc^3
180set VOL (1.9*1.9*2.8*800*600*256)
181# set VOL (1.9*1.9*2.8*1800*600*256)
182plot2d
183# plot2d lsspk x val*$VOL 1 'logx logy nsta xylimits=0.01,2.,10.,1e4 cpts marker=box,5 gold'
184plot2d lsspklobewn x val*$VOL 1 'same nsta cpts marker=box,5 siennared'
185plot2d subpkcorlobe x val*$VOL 1 'same nsta cpts marker=box,5 red'
186plot2d subpklobe x val*$VOL 1 'same nsta cpts marker=box,5 blueviolet'
187plot2d subpknolss x val*$VOL 1 'same nsta cpts marker=box,5 green'
188
189# settitle 'Recovered Pk[LSS] In=LSS+(GSM) (D=50 m)' ' ' 'font=helvetica,bold,18'
190settitle 'Recovered Pk[LSS] In=LSS+(Haslam+North20cm) (D=50 m)' ' ' 'font=helvetica,bold,18'
191setaxelabels 'k (Mpc^-1) h=0.7' 'P(k) (mK^2 Mpc^3)' 'font=helvetica,bolditalic,16'
192set lines ( 'Pk[LSS]' 'Pk[LSS*lobe+noise]' 'Pk[ExtractedLSS]' 'Pk[ExtLSS,NoBeamCor]' 'Pk[residual,NoLSS]' )
193set cols ( gold siennared red blueviolet green )
194textdrawer lines cols 'font=helvetica,bold,16 frame'
195
196plot2d fgndpk x val*$VOL 1 'logx logy xylimits=0.01,1.,1.,1e10 nsta cpts marker=box,5 black'
197plot2d fgndpkflobe x val*$VOL 1 ' nsta cpts marker=circle,5 navyblue same'
198plot2d fgndpklobe x val*$VOL 1 ' nsta cpts marker=circle,5 blue same'
199
200plot2d lsspk x val*$VOL 1 ' nsta cpts marker=box,5 red same'
201plot2d lsspkflobe x val*$VOL 1 ' nsta cpts marker=circle,5 orange same'
202plot2d lsspklobe x val*$VOL 1 ' nsta cpts marker=circle,5 yellow same'
203
204c++exec \
205 Histo lsspkratioA = subpkcorlobe/lsspk; KeepObj(lsspkratioA); \
206 Histo lsspkratioB = subpkcorlobe/lsspkflobe; KeepObj(lsspkratioB);
207
208plot2d lsspk x val*$VOL 1 'logx logy nsta xylimits=0.01,2.,10.,1e4 cpts marker=box,5 gold'
209plot2d lsspklobewn x val*$VOL 1 'same nsta cpts marker=box,5 red'
210plot2d subpknolss x val*$VOL 1 'same nsta cpts marker=box,5 green'
211plot2d subpknolssnocor x val*$VOL 1 'same nsta cpts marker=box,5 magenta'
212setaxelabels 'k (Mpc^-1) h=0.7' 'P(k) (mK^2 Mpc^3)' 'font=helvetica,bolditalic,16'
213settitle 'Recovered Pk[LSS] and residual systematics' ' ' 'font=helvetica,bold,18'
214set lines ( 'Pk[LSS]' 'Pk[LSS*lobe+noise]' 'Pk[residual,NoLSS]' 'Pk[residual,NoLSS,NoBeamCorrection]' )
215set cols ( gold red green magenta )
216textdrawer lines cols 'font=helvetica,bold,16 frame'
Note: See TracBrowser for help on using the repository browser.