Skip to content

Commit

Permalink
Merge pull request #880 from igmhub/fix_bal_masking
Browse files Browse the repository at this point in the history
fixed bugs in BAL masking
  • Loading branch information
iprafols authored Apr 21, 2022
2 parents ad18ae1 + af91ff3 commit 54a94a8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions py/picca/delta_extraction/masks/bal_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(self, config):
f" or 'TARGETID'. Found {los_id_name}")

# setup bal index limit
self.bal_index_type = config.getfloat("bal index type")
self.bal_index_type = config.get("bal index type")
if self.bal_index_type is None:
self.bal_index_type = MaskError(
"Missing argument 'bal index type' "
Expand Down Expand Up @@ -133,7 +133,7 @@ def __init__(self, config):
# compute info for each line of sight
self.los_ids = {}
for los_id in np.unique(self.cat[los_id_name]):
self.los_ids[los_id] = self.add_bal_rest_frame(los_id)
self.los_ids[los_id] = self.add_bal_rest_frame(los_id, los_id_name)

num_bals = np.sum([len(los_id) for los_id in self.los_ids.values()])
self.logger.progress('In catalog: {} BAL quasars'.format(num_bals))
Expand Down Expand Up @@ -180,8 +180,13 @@ def add_bal_rest_frame(self, los_id, los_id_name):
# Calculate mask width for each velocity pair, for each emission line
for min_vel, max_vel in zip(min_velocities, max_velocities):
for line in lines.values():
log_lambda_min = np.log10(line * (1 - min_vel / SPEED_LIGHT))
log_lambda_max = np.log10(line * (1 - max_vel / SPEED_LIGHT))
# This might be bit confusing, since BAL absorption is
# blueshifted from the emission lines. The “minimum velocity”
# corresponds to the red side of the BAL absorption (the larger
# wavelength value), and the “maximum velocity” corresponds to
# the blue side (the smaller wavelength value).
log_lambda_max = np.log10(line * (1 - min_vel / SPEED_LIGHT))
log_lambda_min = np.log10(line * (1 - max_vel / SPEED_LIGHT))
mask_rest_frame_bal.add_row([
log_lambda_min,
log_lambda_max,
Expand Down Expand Up @@ -219,4 +224,4 @@ def apply_mask(self, forest):
if param in ['resolution_matrix']:
setattr(forest, param, getattr(forest, param)[:, w])
else:
setattr(forest, param, getattr(forest, param)[w])
setattr(forest, param, getattr(forest, param)[w])

0 comments on commit 54a94a8

Please sign in to comment.