Skip to content

Commit

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

nui_type = eltype(valtype(Nuisances))
if !(nui_type <: Float64) & (nui_type != Any)
Expand All @@ -26,8 +25,7 @@ function Theory(cosmology::Cosmology,
dz = get(Nuisances, string(name, "_", "dz"), 0.0)
tracer = NumberCountsTracer(cosmology, zs .+ dz, nz;
b=b, res=res_gc,
nz_interpolation=int_gc,
smooth=smooth_gc)
nz_interpolation=int_gc)
elseif t_type == "galaxy_shear"
zs_mean, nz_mean = files[string("nz_", name)]
m = get(Nuisances, string(name, "_", "m"), 0.0)
Expand Down
21 changes: 0 additions & 21 deletions src/tracers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ NumberCountsTracer(cosmo::Cosmology, z_n, nz;
hz = Hmpc(cosmo, z_w)

w_arr = @. (nz_w*hz/nz_norm)
if smooth != 0
w_arr = smooth_w_neighbors(w_arr, k=smooth)
end
wint = linear_interpolation(chi, b .* w_arr, extrapolation_bc=0.0)
F::Function =-> 1
NumberCountsTracer(wint, F)
Expand Down Expand Up @@ -178,21 +175,3 @@ function nz_interpolate(z, nz, res; mode="linear")
return z, nz
end
end

function smooth_w_neighbors(arr; k::Int = 5)
N = length(arr)
neighbors = Vector{}(undef, N) # Create an array to hold neighbor arrays

half_k = div(k, 2) # This is 2 if k=5, so we look at two neighbors on each side

for i in 1:N
# Define the range around the current element, clamping to avoid out-of-bounds
start_idx = max(1, i - half_k)
end_idx = min(N, i + half_k)

# Collect neighbors and assign to the current position
neighbors[i] = mean(arr[start_idx:end_idx])
end

return neighbors
end

0 comments on commit 9042651

Please sign in to comment.