Skip to content

Commit

Permalink
old make_data
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeRZP committed Apr 17, 2024
1 parent 6e17d56 commit 76aaa1b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/data_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ end
```
-files: npz file
"""
function make_data(sacc_file, yaml_file; nzs_path="")
function make_data(sacc_file, yaml_file; kwargs...)

kwargs=Dict(kwargs)
kwargs_keys = [string(i) for i in collect(keys(kwargs))]

#cut
s = _apply_scale_cuts(sacc_file, yaml_file)

Expand Down Expand Up @@ -125,17 +129,18 @@ function make_data(sacc_file, yaml_file; nzs_path="")
# Load in nz's
for (name, tracer) in s.tracers.items()
if string(name) in names
if nzs_path == ""
if string("nz_", name) in kwargs_keys
println(string("using custom nz for ", string("nz_", name)))
nzs = kwargs[Symbol("nz_", name)]
z= pyconvert(Vector{Float64}, nzs["z"])
nz=pyconvert(Vector{Float64}, nzs["dndz"])
merge!(files, Dict(string("nz_", name)=>[z, nz]))
else
if string(tracer.quantity) != "cmb_convergence"
z=pyconvert(Vector{Float64}, tracer.z)
nz=pyconvert(Vector{Float64}, tracer.nz)
merge!(files, Dict(string("nz_", name)=>[z, nz]))
end
else
nzs = np.load(nzs_path+string("nz_", name)+".npz")
z = nzs["z"]
dndz = nzs["dndz"]
merge!(files, Dict(string("nz_", name)=>[z, nz]))
end
end
end
Expand Down

0 comments on commit 76aaa1b

Please sign in to comment.