Skip to content

Commit

Permalink
Renaming the instruments argument as instruments and not detectors
Browse files Browse the repository at this point in the history
after discussion
  • Loading branch information
jacquot committed Jan 8, 2025
1 parent 1e8bb5a commit 44eff8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
18 changes: 9 additions & 9 deletions bin/pycbc_make_sky_grid
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import pycbc
from pycbc.detector import Detector
from pycbc.io.hdf import HFile
from pycbc.types import angle_as_radians

from pycbc.tmpltbank import sky_grid

def spher_to_cart(sky_points):
"""Convert spherical coordinates to cartesian coordinates."""
Expand Down Expand Up @@ -58,11 +58,11 @@ parser.add_argument(
"otherwise radians are assumed.",
)
parser.add_argument(
'--detectors',
'--instruments',
nargs="+",
type=str,
required=True,
help="List of detectors to analyze.",
help="List of instuments to analyze.",
)
parser.add_argument(
'--sky-error',
Expand Down Expand Up @@ -92,11 +92,11 @@ args = parser.parse_args()

pycbc.init_logging(args.verbose)

if len(args.detectors) == 1:
if len(args.instruments) == 1:
parser.error('Can not make a sky grid for only one detector.')

args.detectors.sort() # Put the ifos in alphabetical order
detectors = args.detectors
args.instruments.sort() # Put the ifos in alphabetical order
detectors = args.instruments
detectors = [Detector(d) for d in detectors]
detector_pairs = list(itertools.combinations(detectors, 2))

Expand Down Expand Up @@ -165,8 +165,8 @@ spher = cart_to_spher(rota)

# Calculate the time delays between the Earth center
# and each detector for each sky point
sky_grid = SkyGrid(
spher[:, 0], spher[:, 1], args.detectors, args.trigger_time
sky_grid = sky_grid.SkyGrid(
spher[:, 0], spher[:, 1], args.instruments, args.trigger_time
)
time_delays = sky_grid.calculate_time_delays()

Expand All @@ -177,4 +177,4 @@ extra_attributes = {
'timing_uncertainty': args.timing_uncertainty
}

sky_grid.write_to_file(args.output, extra_attributes, extra_datasets)
sky_grid.write_to_file(args.output, extra_attributes)
Binary file removed bin/sky_grid.hdf5
Binary file not shown.
1 change: 0 additions & 1 deletion pycbc/tmpltbank/sky_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def read_from_file(cls, path):
def write_to_file(self, path, extra_attrs=None, extra_datasets=None):
"""Writes a sky grid to an HDF5 file."""
with h5py.File(path, 'w') as hf:
breakpoint()
hf['ra'] = self.ras
hf['dec'] = self.decs
hf.attrs['detectors'] = self.detectors
Expand Down

0 comments on commit 44eff8d

Please sign in to comment.