Skip to content
Merged
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
5 changes: 3 additions & 2 deletions ringdown/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def load(cls, path: str | None = None, channel: str | None = None, **kws):
ts.attrs.update(dict(load=info))
return ts

_DEF_INTERP_KWS = dict(kind='cubic', fill_value=0, bounds_error=False)
_DEF_INTERP_KWS = dict(kind='linear', fill_value=0, bounds_error=False)

def interpolate_to_index(self, new_index, **kwargs):
"""Reinterpolate the :class:`Series` to new index.
Expand Down Expand Up @@ -462,7 +462,8 @@ def interpolate_to_index(self, freq: np.ndarray | None = None,
f_min = f_min_orig if f_min is None else f_min
f_max = f_max_orig if f_max is None else f_max
delta_f = delta_f or self.delta_f
n = int((f_max - f_min) / delta_f) + 1
# n = int((f_max - f_min) / delta_f) + 1
n = len(self.freq)
freq = np.arange(n)*delta_f + f_min

if min(freq) < f_min_orig or max(freq) > f_max_orig:
Expand Down
2 changes: 2 additions & 0 deletions ringdown/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,7 @@ def from_imr_result(
set_target: bool = True,
update_model: bool = True,
duration: float | bool = "auto",
imr_kws: dict | None = None,
data_kws: dict | None = None,
peak_kws: dict | None = None,
acf_kws: dict | None = None,
Expand All @@ -1932,6 +1933,7 @@ def from_imr_result(
approximant=approximant,
reference_frequency=reference_frequency,
psds=psds,
**(imr_kws or {})
)
imr = fit.imr_result

Expand Down
17 changes: 12 additions & 5 deletions ringdown/imr.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ def ifos(self):
"""List of detectors in the DataFrame."""
# try config first
if "detectors" in self.attrs.get("config", {}):
return self.attrs["config"]["detectors"]
return [k.replace("'", "") for k in self.attrs["config"]['detectors']]
# return self.attrs["config"]['detectors']
time_keys = [k for k in self.columns if TIME_KEY in k]
return [k.replace(TIME_KEY, "") for k in time_keys]

Expand Down Expand Up @@ -803,9 +804,15 @@ def get_waveforms(
logger.warning("time arrays have inconsistent lengths")

for _, sample in tqdm(df.iterrows(), **tqdm_kws):
h = waveforms.get_detector_signals(
times=time, ifos=ifos, **sample, **kws
if np.array([self.reference_frequency < self.minimum_frequency[ifo] for ifo in ifos]).any():
h = waveforms.get_detector_signals(
times=time, ifos=ifos, f_low=self.minimum_frequency['waveform'],
**sample, **kws
)
else:
h = waveforms.get_detector_signals(
times=time, ifos=ifos, **sample, **kws
)
for ifo in ifos:
if condition:
# look for target time 't0' which can be a dict with
Expand Down Expand Up @@ -1169,7 +1176,7 @@ def from_pesummary(
logger.info(f"no group provided; using {group}")
config = pe.config.get(group, {}).get("config", {})
p = {
i: data.PowerSpectrum(p).fill_low_frequencies().gate()
i: data.PowerSpectrum(p).fill_low_frequencies().gate().interpolate_to_index()
for i, p in pe.psd.get(group, {}).items()
}
attrs = (attrs or {}).update({"config": config})
Expand Down Expand Up @@ -1205,7 +1212,7 @@ def from_pesummary(
)
if "psds" in f[group]:
p = {
i: data.PowerSpectrum(p).fill_low_frequencies().gate()
i: data.PowerSpectrum(p).fill_low_frequencies().gate().interpolate_to_index()
for i, p in f[group]["psds"].items()
}
else:
Expand Down
4 changes: 2 additions & 2 deletions ringdown/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ def get_bilby_dict(d):
"""Parse bilby-style data dict string.
"""
if isinstance(d, str):
chars_to_remove = "'{}"
chars_to_remove = " '{}"
translation_table = str.maketrans('', '', chars_to_remove)
d = {k.translate(translation_table): v.translate(translation_table)
for k, v in [i.split(':') for i in d.split(',')]}
for k, v in [i.split(':') for i in d.split(',') if ':' in i] }
return d
Loading