From 26b2e7bd397e09143e736b83b19674370e1c4534 Mon Sep 17 00:00:00 2001 From: Alex Correia Date: Mon, 11 Nov 2024 14:22:11 -0500 Subject: [PATCH] fixed import errors and removed print statements --- pycbc/detector.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pycbc/detector.py b/pycbc/detector.py index 104d5a314fc..b41b2cbbacf 100644 --- a/pycbc/detector.py +++ b/pycbc/detector.py @@ -650,6 +650,7 @@ def overhead_antenna_pattern(right_ascension, declination, polarization): """ Space-based detector class """ from pycbc.coordinates.space import TIME_OFFSET_20_DEGREES +from abc import ABC, abstractmethod class AbsSpaceDet(ABC): """ @@ -802,7 +803,7 @@ def preprocess(self, hp, hc, polarization=0, reference_time=None): logging.warning("Time of signal end is greater than end of orbital data. " + "Cutting signal at orbit end time.") # cut off data succeeding orbit end time - orbit_end_idx = numpy.argwhere(hp.sample_times.numpy() <= self.orbit_end_time)[-1][0] + orbit_end_idx = np.argwhere(hp.sample_times.numpy() <= self.orbit_end_time)[-1][0] hp = hp[:orbit_end_idx] hc = hc[:orbit_end_idx] @@ -810,7 +811,7 @@ def preprocess(self, hp, hc, polarization=0, reference_time=None): logging.warning("Time of signal start is less than start of orbital data. " + "Cutting signal at orbit start time.") # cut off data preceding orbit start time - orbit_start_idx = numpy.argwhere(hp.sample_times.numpy() >= self.orbit_start_time)[0][0] + orbit_start_idx = np.argwhere(hp.sample_times.numpy() >= self.orbit_start_time)[0][0] hp = hp[orbit_start_idx:] hc = hc[orbit_start_idx:] @@ -920,7 +921,7 @@ def orbits_init(self, orbits, size=316, dt=100000.0, t_init=0.0): defaults = ['EqualArmlength', 'Keplerian'] assert type(orbits) == str, ("Must input either a file path as a string, " + "'EqualArmlength', or 'Keplerian'") - + # generate a new file if orbits in defaults: try: @@ -996,7 +997,7 @@ def strain_container(self, response, orbits=None): if orbits is None: orbits = self.orbits return Data.from_orbits(orbits, df, t0, 'tcb/ltt', **measurements) - + def get_links(self, hp, hc, lamb, beta, polarization, reference_time=None): """ Project a radiation frame waveform to the LISA constellation. @@ -1056,7 +1057,7 @@ def get_links(self, hp, hc, lamb, beta, polarization, reference_time=None): # project the signal wf_proj = self.proj_init.compute_gw_response(self.sample_times, self.proj_init.LINKS) - + return wf_proj def project_wave(self, hp, hc, lamb, beta, polarization=0, @@ -1127,7 +1128,7 @@ def project_wave(self, hp, hc, lamb, beta, polarization=0, from pytdi import michelson except ImportError: raise ImportError('pyTDI required for TDI combinations') - + # set TDI generation if tdi == 1: X, Y, Z = michelson.X1, michelson.Y1, michelson.Z1 @@ -1156,11 +1157,10 @@ def project_wave(self, hp, hc, lamb, beta, polarization=0, if tdi_chan == 'XYZ': tdi_dict = {'X': chanx, 'Y': chany, 'Z': chanz} elif tdi_chan == 'AET': - chana = (chanz - chanx)/numpy.sqrt(2) - chane = (chanx - 2*chany + chanz)/numpy.sqrt(6) - chant = (chanx + chany + chanz)/numpy.sqrt(3) + chana = (chanz - chanx)/np.sqrt(2) + chane = (chanx - 2*chany + chanz)/np.sqrt(6) + chant = (chanx + chany + chanz)/np.sqrt(3) tdi_dict = {'A': chana, 'E': chane, 'T': chant} - print("Orthogonal observables calculated") else: raise ValueError('Unrecognized TDI channel input. ' + 'Please input either "XYZ" or "AET".')