Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Sanchez authored and Javier Sanchez committed Feb 15, 2024
1 parent 333a604 commit d187a17
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions augur/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def generate_sacc_and_stats(config):
sources[sacc_tracer].bias = bias
sys_params[f'{sacc_tracer}_bias'] = bias
sys_params[f'{sacc_tracer}_delta_z'] = delta_z[i]

# Read data vector combinations
if 'statistics' not in config.keys():
raise ValueError('statistics key is required in config file')
Expand All @@ -231,8 +231,18 @@ def generate_sacc_and_stats(config):
ells_here = ells[ells < ell_max]
else:
ells_here = ells
for ell in ells_here:
S.add_data_point(key, (tr1, tr2), 0.0, ell=ell, error=1e30)
# Trying to add bandpower windows
ells_aux = np.arange(0, np.max(ells_here)+1)
wgt = np.zeros((len(ells_aux), len(ells_here)))
for i in range(len(ells_here)):
in_win = (ells_aux > ell_edges[i]) & (ells_aux < ell_edges[i+1])
wgt[in_win, i] = 1.0
win = sacc.BandpowerWindow(ells_aux, wgt)
S.add_ell_cl(key, tr1, tr2,
ells_here, np.zeros(len(ells_here)), window=win)
# # For some reason add_ell_cl does not update the sacc file properly on the fly...
# for i, ell in enumerate(ells_here):
# S.add_data_point(key, (tr1, tr2), 0.0, ell=ell, error=1e30, window=win[i])
# Now create TwoPoint objects for firecrown
_aux_stat = TwoPoint(source0=sources[tr1], source1=sources[tr2],
sacc_data_type=key)
Expand Down Expand Up @@ -264,19 +274,23 @@ def generate(config, return_all_outputs=False, write_sacc=True, force_read=True)
Returns:
-------
noise : float
Noise power for Cls for that particular tracer. That is 1/nbar for
number counts and e**2/nbar for weak lensing tracer.
lk : firecrown.likelihood.ConstGaussian
Likelihood object, only returned if `return_all_outputs` is True.
S : sacc.Sacc
Sacc object with fake data vector and covariance. It is only returned if `return_all_outputs`
is True.
tools : firecrown.modeling.ModelingTools
Modeling tools, only returned if `return_all_outputs` is True.
sys_params : dict
Dictionary containing the modeling systematic parameters. It is only returned if `return_all_outputs`
is True.
Note:
-----
The input number_densities are #/arcmin.
The output units are in steradian.
"""

config = parse_config(config)
# Generate placeholders
S, cosmo, stats, sys_params = generate_sacc_and_stats(config)

# Generate likelihood object
lk = ConstGaussian(statistics=stats)
# Pass the correct binning/tracers
Expand Down

0 comments on commit d187a17

Please sign in to comment.