Skip to content

Commit

Permalink
smoothing option
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeRZP committed Nov 4, 2024
1 parent e0d3e39 commit 8ea23de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/theory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ function Theory(cosmology::Cosmology,
idx, files;
Nuisances=Dict(),
res_wl=350, res_gc=1000,
int_wl="linear", int_gc="linear")
int_wl="linear", int_gc="linear",
smooth_gc=0)

nui_type = eltype(valtype(Nuisances))
if !(nui_type <: Float64) & (nui_type != Any)
Expand All @@ -26,7 +27,7 @@ function Theory(cosmology::Cosmology,
tracer = NumberCountsTracer(cosmology, zs .+ dz, nz;
b=b, res=res_gc,
nz_interpolation=int_gc,
smooth=true)
smooth=smooth_gc)
elseif t_type == "galaxy_shear"
zs_mean, nz_mean = files[string("nz_", name)]
m = get(Nuisances, string(name, "_", "m"), 0.0)
Expand Down
6 changes: 3 additions & 3 deletions src/tracers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Returns:
- `NumberCountsTracer::NumberCountsTracer` : Number counts tracer structure.
"""
NumberCountsTracer(cosmo::Cosmology, z_n, nz;
b=1.0, res=1000, nz_interpolation="linear", smooth=false) = begin
b=1.0, res=1000, nz_interpolation="linear", smooth=0) = begin
z_w, nz_w = nz_interpolate(z_n, nz, res;
mode=nz_interpolation)
nz_norm = integrate(z_w, nz_w, SimpsonEven())
Expand All @@ -37,8 +37,8 @@ NumberCountsTracer(cosmo::Cosmology, z_n, nz;
hz = Hmpc(cosmo, z_w)

w_arr = @. (nz_w*hz/nz_norm)
if smooth
w_arr = smooth_w_neighbors(w_arr)
if smooth!=0
w_arr = smooth_w_neighbors(w_arr, k=smooth)
end
wint = linear_interpolation(chi, b .* w_arr, extrapolation_bc=Line())
F::Function =-> 1
Expand Down

0 comments on commit 8ea23de

Please sign in to comment.