CosmicFish  Reference documentation for version 1.0
Looking into future Cosmology
008_Fisher_calculator_Cls_windows.f90
Go to the documentation of this file.
1 !----------------------------------------------------------------------------------------
2 !
3 ! This file is part of CosmicFish.
4 !
5 ! Copyright (C) 2015-2016 by the CosmicFish authors
6 !
7 ! The CosmicFish code is free software;
8 ! You can use it, redistribute it, and/or modify it under the terms
9 ! of the GNU General Public License as published by the Free Software Foundation;
10 ! either version 3 of the License, or (at your option) any later version.
11 ! The full text of the license can be found in the file LICENSE at
12 ! the top level of the CosmicFish distribution.
13 !
14 !----------------------------------------------------------------------------------------
15 
20 
21 !----------------------------------------------------------------------------------------
23 
25 
27 
28  use precision
29  use constants, only: const_pi
30  use redshiftspacedata
32 
33  implicit none
34 
35  type(cosmicfish_params), save :: window_fp
36 
37  private
38 
40 
41 contains
42 
43  ! ---------------------------------------------------------------------------------------------
47  subroutine init_camb_sources_windows( FP )
48 
49  implicit none
50 
51  Type(cosmicfish_params), intent(in) :: FP
52 
53  window_fp = fp
54 
55  if ( fp%fisher_cls%window_type == 1 ) then
56  window_function_calc => default_window
57  else if ( fp%fisher_cls%window_type == 2 ) then
58  window_function_calc => bin_window
59  else if ( fp%fisher_cls%window_type == 3 ) then
60  window_function_calc => flat_window
61  else if ( fp%fisher_cls%window_type == 4 ) then
62  window_function_calc => flat_smooth_window
63  else
64  window_function_calc => null()
65  end if
66 
67  end subroutine init_camb_sources_windows
68 
69  ! ---------------------------------------------------------------------------------------------
73  function gaussian_window(Win, z, winamp)
74 
75  implicit none
76 
77  Type(tredwin) :: Win
78  real(dl), intent(in) :: z
79  real(dl) :: winamp
80 
81  real(dl) :: gaussian_window
82 
83  real(dl) :: dz
84 
85  gaussian_window = 0._dl
86 
87  dz = z - win%Redshift
88  winamp = exp(-0.5_dl*(dz/win%sigma)**2)
89  gaussian_window = winamp/win%sigma/sqrt(2._dl*const_pi)
90 
91  end function gaussian_window
92 
93  ! ---------------------------------------------------------------------------------------------
96  function bin_window(Win, z, winamp)
97 
98  implicit none
99 
100  Type(tredwin) :: Win
101  real(dl), intent(in) :: z
102  real(dl) :: winamp
103 
104  real(dl) :: bin_window
105 
106  real(dl) :: alpha, beta, z0, sigma, total_number_z
107 
108  alpha = window_fp%fisher_cls%window_alpha
109  beta = window_fp%fisher_cls%window_beta
110  z0 = window_fp%fisher_cls%redshift_zero
111  sigma = window_fp%fisher_cls%photoz_error*(1._dl+z)
112 
113  total_number_z = beta*z**alpha*exp(-(z/z0)**beta)/(z0**(alpha+1._dl))/gamma((alpha+1._dl)/beta)
114 
115  winamp = 0.5_dl*total_number_z*( &
116  & +erf( (win%Redshift + win%sigma - z)/(sqrt(2._dl))/sigma ) &
117  & -erf( (win%Redshift - z)/(sqrt(2._dl))/sigma ) )
118 
119  if ( winamp<1.d-10 ) winamp = 0._dl
120 
121  bin_window = winamp
122 
123  end function bin_window
124 
125  ! ---------------------------------------------------------------------------------------------
128  function flat_window(Win, z, winamp)
130  implicit none
131 
132  Type(tredwin) :: Win
133  real(dl), intent(in) :: z
134  real(dl) :: winamp
135 
136  real(dl) :: flat_window
137 
138  real(dl) :: alpha, beta, z0, sigma, total_number_z
139 
140  winamp = 0._dl
141 
142  if ( win%Redshift<z .and. z<win%Redshift + win%sigma ) then
143  winamp = 1._dl
144  end if
145 
146  flat_window = winamp
147 
148  end function flat_window
149 
150  ! ---------------------------------------------------------------------------------------------
153  function flat_smooth_window(Win, z, winamp)
155  implicit none
156 
157  Type(tredwin) :: Win
158  real(dl), intent(in) :: z
159  real(dl) :: winamp
160 
161  real(dl) :: flat_smooth_window
162 
163  real(dl) :: alpha, beta, z0, sigma, total_number_z
164 
165  winamp = 0._dl
166 
167  if ( win%Redshift<z .and. z<win%Redshift + win%sigma ) then
168  winamp = 1._dl
169  end if
170 
171  sigma = window_fp%fisher_cls%photoz_error*(1._dl+z)
172 
173  winamp = 0.5_dl*winamp*( &
174  & +erf( (win%Redshift + win%sigma - z)/(sqrt(2._dl))/sigma ) &
175  & -erf( (win%Redshift - z)/(sqrt(2._dl))/sigma ) )
176 
177  if ( winamp<1.d-10 ) winamp = 0._dl
178 
179  flat_smooth_window = winamp
180 
181  end function flat_smooth_window
182 
real(dl) function, public gaussian_window(Win, z, winamp)
This function computes a gaussian window function. Note this is the total count distribution observed...
real(dl) function, public flat_smooth_window(Win, z, winamp)
This function computes a flat binned window function smoothed by photo z errors. For more details ref...
This module contains the definitions of derived data types used to store the informations about the f...
This module contains the definition of the window functions that are used by CAMB sources...
real(dl) function, public bin_window(Win, z, winamp)
This function computes a Gaussian smoothed binned window. For more details refer to the documentation...
subroutine, public init_camb_sources_windows(FP)
This function initialises the camb sources number counts and lensing window function. The default is the gaussian window that is included in camb sources. If another window is chosen it will be initialised by the CosmicFish value.
real(dl) function, public flat_window(Win, z, winamp)
This function computes a flat binned window. For more details refer to the documentation.
This derived data type contains all the informations that the cosmicfish code needs to run...