Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few bugfixes #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions nrcatalogtools/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, *args, **kwargs) -> None:
def simulations_list(self):
return list(self.simulations)

def get(self, sim_name):
def get(self, sim_name, **kwargs):
"""Retrieve waveform modes for this simulation

Args:
Expand All @@ -63,9 +63,9 @@ def get(self, sim_name):
f"..As data does not exist in cache:"
f" (in {filepath}),\n"
f"..we will now download it from"
" {}".format(self.waveform_url_from_simname(sim_name))
" {}".format(self.waveform_url_from_simname(sim_name, **kwargs))
)
self.download_waveform_data(sim_name)
self.download_waveform_data(sim_name, **kwargs)
metadata = self.get_metadata(sim_name)
if type(metadata) is not dict and hasattr(metadata, "to_dict"):
metadata = metadata.to_dict()
Expand Down
25 changes: 18 additions & 7 deletions nrcatalogtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,29 @@
rit_catalog_info["url"] = "https://ccrgpages.rit.edu/~RITCatalog/"
rit_catalog_info["metadata_url"] = rit_catalog_info["url"] + "/Metadata/"
rit_catalog_info["data_url"] = rit_catalog_info["url"] + "/Data/"
rit_catalog_info["possible_resolutions"] = [100, 120, 88, 118, 130, 140, 144, 160, 200]
rit_catalog_info["possible_resolutions"] = [
100,
120,
88,
84,
118,
130,
140,
144,
160,
200,
]
rit_catalog_info["metadata_file_fmts"] = [
"RIT:BBH:{:04d}-n{:3d}-id{:d}_Metadata.txt",
"RIT:eBBH:{:04d}-n{:3d}-ecc_Metadata.txt",
"RIT:BBH:{:04d}-n{:03d}-id{:d}_Metadata.txt",
"RIT:eBBH:{:04d}-n{:03d}-ecc_Metadata.txt",
]
rit_catalog_info["waveform_file_fmts"] = [
"ExtrapStrain_RIT-BBH-{:04d}-n{:3d}.h5",
"ExtrapStrain_RIT-eBBH-{:04d}-n{:3d}.h5",
"ExtrapStrain_RIT-BBH-{:04d}-n{:03d}.h5",
"ExtrapStrain_RIT-eBBH-{:04d}-n{:03d}.h5",
]
rit_catalog_info["psi4_file_fmts"] = [
"ExtrapPsi4_RIT-BBH-{:04d}-n{:3d}-id{:d}.tar.gz",
"ExtrapPsi4_RIT-eBBH-{:04d}-n{:3d}-ecc.tar.gz",
"ExtrapPsi4_RIT-BBH-{:04d}-n{:03d}-id{:d}.tar.gz",
"ExtrapPsi4_RIT-eBBH-{:04d}-n{:03d}-ecc.tar.gz",
]
rit_catalog_info["max_id_val"] = 6

Expand Down
19 changes: 15 additions & 4 deletions nrcatalogtools/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,21 @@ def load_from_h5(cls, file_path_or_open_file, metadata={}, verbosity=0):
pfmt = f"phase_l{ell}_m{em}"
if afmt not in h5_file or pfmt not in h5_file:
continue
amp_time = h5_file[afmt]["X"][:]
amp = h5_file[afmt]["Y"][:]
phase_time = h5_file[pfmt]["X"][:]
phase = h5_file[pfmt]["Y"][:]

try:
amp_time = h5_file[afmt]["X"][:]
amp = h5_file[afmt]["Y"][:]
phase_time = h5_file[pfmt]["X"][:]
phase = h5_file[pfmt]["Y"][:]
except KeyError:
# Some RIT files have empty modes stored (*sigh*)
# Skip these modes, and print a warning
if verbosity > 0:
print(
f"Skipping mode l={ell}, m={em} for {file_path_or_open_file} "
"since columns 'X' and 'Y' not found"
)
continue
mode_data[(ell, em)] = [amp_time, amp, phase_time, phase]
# get the minimum time and maximum time stamps for all modes
t_min = max(t_min, amp_time[0], phase_time[0])
Expand Down
Loading