Skip to content
Open
Changes from 1 commit
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
24 changes: 22 additions & 2 deletions pycbc/inference/models/relbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ class Relative(BaseGaussianNoise, DistMarg):
Default is False. If True, then vary the fp/fc polarization values
as a function of frequency bin, using a predetermined PN approximation
for the time offsets.
is_hom : boolean, optional
Default is False. Gives the presence (absence) of higer order mode if is
True (False). Calculations are in comparison with the l=|m|=2 if
`is_hom` activated (True).
\**kwargs :
All other keyword arguments are passed to
:py:class:`BaseGaussianNoise`.
Expand All @@ -157,6 +161,7 @@ def __init__(
epsilon=0.5,
earth_rotation=False,
marginalize_phase=True,
is_hom = False,
**kwargs
):

Expand Down Expand Up @@ -185,6 +190,15 @@ def __init__(
if self.fid_params[k] == 'REPLACE':
self.fid_params.pop(k)

# make sure fid_param has ['mode_array'] which means one
# needs to declare this in the model section
if 'is_hom' in self.static_params:
logging.info("Extracting mode information")
is_hom = self.static_params['is_hom']
self._mode_ = int(self.fid_params['mode_array'])
self._mode_m = self._mode_ % 10
self._mode_l = int((self._mode_ % 100) / 10)

for ifo in data:
# store data and frequencies
d0 = self.data[ifo]
Expand All @@ -195,7 +209,13 @@ def __init__(

# generate fiducial waveform
f_lo = self.kmin[ifo] * self.df[ifo]

if is_hom:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit artificial here. Is there a reason this can't be set from the config file rather than hard coding the relation? There may be times we don't want to truncate at the same time for example.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed this can be set from the config file directly and was not required for this case

# make sure the frequency of higher order mode follows
# f_{l,m} = self._mode_m * f_{2,2}
self.kmax[ifo] = int(self.kmax[ifo] * 2 / self._mode_m)
f_hi = self.kmax[ifo] * self.df[ifo]

logging.info(
"%s: Generating fiducial waveform from %s to %s Hz",
ifo, f_lo, f_hi,
Expand Down Expand Up @@ -253,7 +273,7 @@ def __init__(
self.edges[ifo] = fbin_ind

self.init_from_frequencies(h00, fbin_ind, ifo)
self.antenna_time[ifo] = self.setup_antenna(earth_rotation,
self.antenna_time[ifo] = self.setup_antenna(is_hom, earth_rotation,
self.fedges[ifo])
self.combine_layout()

Expand Down Expand Up @@ -296,7 +316,7 @@ def combine_layout(self):
self.edge_unique.append(Array(self.fedges[ifo]))
logging.info("%s unique ifo layouts", len(self.edge_unique))

def setup_antenna(self, earth_rotation, fedges):
def setup_antenna(self, is_hom, earth_rotation, fedges):
# Calculate the times to evaluate fp/fc
if earth_rotation is not False:
logging.info("Enabling frequency-dependent earth rotation")
Expand Down