Skip to content

Commit

Permalink
fixed import errors and removed print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
acorreia61201 committed Nov 14, 2024
1 parent c45aa61 commit bfc0cc7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pycbc/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,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):
"""
Expand Down Expand Up @@ -810,15 +811,15 @@ 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]

if hp.start_time < self.orbit_start_time:
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:]

Expand Down Expand Up @@ -928,7 +929,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:
Expand Down Expand Up @@ -1004,7 +1005,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.
Expand Down Expand Up @@ -1064,7 +1065,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,
Expand Down Expand Up @@ -1135,7 +1136,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
Expand Down Expand Up @@ -1164,11 +1165,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".')
Expand Down

0 comments on commit bfc0cc7

Please sign in to comment.