Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions vega/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def __init__(self, options={}, overwrite=False):
self.options['rp_only_metal_mats'] = options.get('rp_only_metal_mats', False)
self.options['metal-matrix'] = options.get('metal-matrix', {})
self.options['use_metal_bias_eta'] = options.get('use_metal_bias_eta', False)
self.options['zmin'] = options.get('zmin', 0.0)
self.options['zmax'] = options.get('zmax', 10.0)

metals = options.get('metals', None)
if metals is not None:
Expand Down Expand Up @@ -287,6 +289,8 @@ def _build_corr_config(self, name, corr_info, git_hash):

config['data']['weights-tracer1'] = corr_info.get('weights-tracer1')
config['data']['weights-tracer2'] = corr_info.get('weights-tracer2')
config['data']['zmin'] = str(self.options.get('zmin'))
config['data']['zmax'] = str(self.options.get('zmax'))

config['metal-matrix'] = {}
config['metal-matrix']['rebin_factor'] = self.options['metal-matrix'].get(
Expand Down
12 changes: 11 additions & 1 deletion vega/metals.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def __init__(self, corr_item, fiducial, scale_params, data=None):
self.fast_metal_bias = corr_item.config['model'].getboolean('fast_metal_bias', True)
self.rp_only_metal_mats = corr_item.config['model'].getboolean('rp_only_metal_mats', False)

# Redshift bins
self.zmin = corr_item.config['data'].getfloat('zmin', 0.0)
self.zmax = corr_item.config['data'].getfloat('zmax', 10.0)

# Read the growth rate and sigma_smooth from the fiducial config
if 'growth_rate' in fiducial:
self.growth_rate = fiducial['growth_rate']
Expand Down Expand Up @@ -331,6 +335,9 @@ def compute_metal_dmat(self, true_abs_1, true_abs_2):

# Compute weights
weights = ((weights1 * scaling_1)[:, None] * (weights2 * scaling_2)[None, :]).ravel()
zpair = (assumed_z1[:, None] + assumed_z2[None, :]) / 2.
zmask = (zpair >= self.zmin) & (zpair <= self.zmax)
weights *= zmask.ravel()

# Distortion matrix grid
rp_bin_edges = np.linspace(
Expand Down Expand Up @@ -465,6 +472,9 @@ def compute_metal_rp_dmat(self, true_abs_1, true_abs_2):

# Compute weights
weights = ((weights1 * scaling_1)[:, None] * (weights2 * scaling_2)[None, :]).ravel()
zpair = (assumed_z1[:, None] + assumed_z2[None, :]) / 2.
zmask = (zpair >= self.zmin) & (zpair <= self.zmax)
weights *= zmask.ravel()

# Distortion matrix grid
rp_bin_edges = np.linspace(
Expand Down Expand Up @@ -512,4 +522,4 @@ def compute_metal_rp_dmat(self, true_abs_1, true_abs_2):
full_rt_eff[indices] = rt_bins[j]
full_z_eff[indices] = z_eff

return dmat, full_rp_eff, full_rt_eff, full_z_eff
return dmat, full_rp_eff, full_rt_eff, full_z_eff