Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org starting 2 March 2020 at approximately 8am MST. It is expected to take around 10 minutes and will include a short period of downtime towards the end of the maintenance window. Please direct any comments, concerns, or questions to computing-help@igwn.org.

Commit 66906277 authored by John Douglas Veitch's avatar John Douglas Veitch

Rebase from recent master

parent cf7f4cf4
......@@ -1414,13 +1414,6 @@ void LALInferenceWriteMCMCSamples(LALInferenceRunState *runState) {
}
/* TODO: Write metadata */
LALInferenceVariables *injParams = NULL;
if ( (injParams=LALInferencePrintInjectionSample(runState)) )
{
LALInferenceH5VariablesArrayToDataset(group, &injParams, 1, "injection_params");
LALInferenceClearVariables(injParams);
XLALFree(injParams);
}
}
XLALH5FileClose(group);
......
......@@ -76,20 +76,20 @@ def _truncate_at_Kerr_limit(chif, behavior, fitname="this"):
if behavior==bbh_Kerr_trunc_opts.trunc or behavior==bbh_Kerr_trunc_opts.trunc_silent:
chif_trunc = np.sign(chif[idx_over])*1.0
if behavior==bbh_Kerr_trunc_opts.trunc:
print("Truncating %d excessive chif values from %s fit to Kerr limit of +-1.0" % (np.size(idx_over), fitname))
print "Truncating %d excessive chif values from %s fit to Kerr limit of +-1.0" % (np.size(idx_over), fitname)
chif[idx_over] = chif_trunc
elif behavior==bbh_Kerr_trunc_opts.keep:
print("Note: %s fit predicts %d chif values in excess of the Kerr limit." % (fitname, np.size(idx_over)))
print "Note: %s fit predicts %d chif values in excess of the Kerr limit." % (fitname, np.size(idx_over))
elif behavior==bbh_Kerr_trunc_opts.err:
raise ValueError("%s fit predicts %d chif values in excess of the Kerr limit." % (fitname, np.size(idx_over)))
else:
if behavior==bbh_Kerr_trunc_opts.trunc or behavior==bbh_Kerr_trunc_opts.trunc_silent:
chif_trunc = np.sign(chif)*1.0
if behavior==bbh_Kerr_trunc_opts.trunc:
print("Truncating excessive chif of %f from %s fit to Kerr limit of %f" % (chif, fitname, chif_trunc))
print "Truncating excessive chif of %f from %s fit to Kerr limit of %f" % (chif, fitname, chif_trunc)
chif = chif_trunc
elif behavior==bbh_Kerr_trunc_opts.keep:
print("Note: %s fit predicts chif of %f in excess of the Kerr limit." % (fitname, chif))
print "Note: %s fit predicts chif of %f in excess of the Kerr limit." % (fitname, chif)
elif behavior==bbh_Kerr_trunc_opts.err:
raise ValueError("%s fit predicts chif of %f in excess of the Kerr limit." % (fitname, chif))
return chif
......@@ -432,9 +432,9 @@ def bbh_final_mass_projected_spins(m1, m2, chi1, chi2, tilt1, tilt2, fitname, ch
if fitname==bbh_final_state_fits.pan2011:
if np.any(chi1!=0) or np.any(chi2!=0) or np.any(tilt1!=0) or np.any(tilt2!=0):
print("Note: Pan2011 fit does not use spins.")
print "Note: Pan2011 fit does not use spins."
if chif is not None:
print("Note: Precomputed chif not used by this fit.")
print "Note: Precomputed chif not used by this fit."
mf = bbh_final_mass_non_spinning_Panetal(m1, m2)
elif fitname==bbh_final_state_fits.hlz2014:
mf = bbh_final_mass_non_precessing_Healyetal(m1, m2, chi1proj, chi2proj, version="2014", chif=chif)
......@@ -442,15 +442,15 @@ def bbh_final_mass_projected_spins(m1, m2, chi1, chi2, tilt1, tilt2, fitname, ch
mf = bbh_final_mass_non_precessing_Healyetal(m1, m2, chi1proj, chi2proj, version="2016", chif=chif)
elif fitname==bbh_final_state_fits.phenD:
if chif is not None:
print("Note: Precomputed chif not used by this fit.")
print "Note: Precomputed chif not used by this fit."
mf = bbh_final_mass_non_precessing_Husaetal(m1, m2, chi1proj, chi2proj)
elif fitname==bbh_final_state_fits.uib2016:
if chif is not None:
print("Note: Precomputed chif not used by this fit.")
print "Note: Precomputed chif not used by this fit."
mf = bbh_final_mass_non_precessing_UIB2016(m1, m2, chi1proj, chi2proj, version="v2")
elif fitname==bbh_final_state_fits.uib2016v1:
if chif is not None:
print("Note: Precomputed chif not used by this fit.")
print "Note: Precomputed chif not used by this fit."
mf = bbh_final_mass_non_precessing_UIB2016(m1, m2, chi1proj, chi2proj, version="v1")
else:
raise ValueError("Unrecognized fit name.")
......@@ -489,7 +489,7 @@ def bbh_final_spin_projected_spins(m1, m2, chi1, chi2, tilt1, tilt2, fitname, tr
if fitname==bbh_final_state_fits.pan2011:
if np.any(chi1!=0) or np.any(chi2!=0) or np.any(tilt1!=0) or np.any(tilt2!=0):
print("Note: Pan2011 fit does not use spins.")
print "Note: Pan2011 fit does not use spins."
chif = bbh_final_spin_non_spinning_Panetal(m1, m2)
elif fitname==bbh_final_state_fits.hlz2014:
chif = bbh_final_spin_non_precessing_Healyetal(m1, m2, chi1proj, chi2proj, version="2014")
......@@ -687,10 +687,10 @@ def bbh_UIBfits_setup(m1, m2, chi1, chi2):
# symmetric mass ratio
eta = m1*m2/msq
if np.any(eta>0.25):
print("Truncating eta from above to 0.25. This should only be necessary in some rounding corner cases, but better check your m1 and m2 inputs...")
print "Truncating eta from above to 0.25. This should only be necessary in some rounding corner cases, but better check your m1 and m2 inputs..."
eta = np.minimum(eta,0.25)
if np.any(eta<0.0):
print("Truncating negative eta to 0.0. This should only be necessary in some rounding corner cases, but better check your m1 and m2 inputs...")
print "Truncating negative eta to 0.0. This should only be necessary in some rounding corner cases, but better check your m1 and m2 inputs..."
eta = np.maximum(eta,0.0)
eta2 = eta*eta
eta3 = eta2*eta
......
......@@ -94,8 +94,8 @@ def precession_eqns(t, y_vec, m1, m2):
Lmag = (eta*m**2./v)*(1.+(1.5+eta/6.)*v**2.)
# precession freqs. Eqs.(3.8) of Ajith (2011)
Omega1= Omega(v, m1, m2, S1, S2, Ln)
Omega2= Omega(v, m2, m1, S2, S1, Ln)
Omega1= Omega(v, m1, m2, S1, S2, Ln)
Omega2= Omega(v, m2, m1, S2, S1, Ln)
# spin precession eqns. Eqs.(3.7) of Ajith (2011)
dS1_dt = np.cross(Omega1, S1)
......
......@@ -134,7 +134,7 @@ def update_params_norm_hoff(P, IP, param_names, vals, verbose=False):
setattr(P, 'm1', m1)
setattr(P, 'm2', m2)
elif special_params != []:
print(special_params)
print special_params
raise Exception
if verbose==True: # for debugging - make sure params change properly
......@@ -186,18 +186,18 @@ def find_effective_Fisher_region(P, IP, target_match, param_names,param_bounds):
try:
min_param = brentq(func, param_peak, param_bounds[i][0], xtol=TOL)
except ValueError:
print("\nWarning! Value", param_bounds[i][0], "of", param,\
print "\nWarning! Value", param_bounds[i][0], "of", param,\
"did not bound target match", target_match, ". Using",\
param_bounds[i][0], "as the lower bound of", param,\
"range for the effective Fisher region.\n")
"range for the effective Fisher region.\n"
min_param = param_bounds[i][0]
try:
max_param = brentq(func, param_peak, param_bounds[i][1], xtol=TOL)
except ValueError:
print("\nWarning! Value", param_bounds[i][1], "of", param,\
print "\nWarning! Value", param_bounds[i][1], "of", param,\
"did not bound target match", target_match, ". Using",\
param_bounds[i][1], "as the upper bound of", param,\
"range for the effective Fisher region.\n")
"range for the effective Fisher region.\n"
max_param = param_bounds[i][1]
param_cube.append( [min_param, max_param] )
......
......@@ -19,7 +19,7 @@ Code to compute the log likelihood of parameters of a gravitational waveform. Pr
Requires python SWIG bindings of the LIGO Algorithms Library (LAL)
"""
from __future__ import print_function
import lal
import lalsimulation as lalsim
from lalinference.rapid_pe import lalsimutils as lsu
......@@ -106,17 +106,17 @@ def precompute_likelihood_terms(event_time_geo, t_window, P, data_dict,
t = np.arange(N_window) * P.deltaT\
+ float(rho_epoch + N_shift * P.deltaT )
if verbose:
print("For detector", det, "...")
print("\tData starts at %.20g" % float(data_dict[det].epoch))
print("\trholm starts at %.20g" % float(rho_epoch))
print("\tEvent time at detector is: %.18g" % float(t_det))
print("\tInterpolation window has half width %g" % t_window)
print("\tComputed t_shift = %.20g" % t_shift)
print("\t(t_shift should be t_det - t_window - t_rholm = %.20g)" %\
(t_det - t_window - float(rho_epoch)))
print("\tInterpolation starts at time %.20g" % t[0])
print("\t(Should start at t_event - t_window = %.20g)" %\
(float(rho_epoch + N_shift * P.deltaT)))
print "For detector", det, "..."
print "\tData starts at %.20g" % float(data_dict[det].epoch)
print "\trholm starts at %.20g" % float(rho_epoch)
print "\tEvent time at detector is: %.18g" % float(t_det)
print "\tInterpolation window has half width %g" % t_window
print "\tComputed t_shift = %.20g" % t_shift
print "\t(t_shift should be t_det - t_window - t_rholm = %.20g)" %\
(t_det - t_window - float(rho_epoch))
print "\tInterpolation starts at time %.20g" % t[0]
print "\t(Should start at t_event - t_window = %.20g)" %\
(float(rho_epoch + N_shift * P.deltaT))
# The minus N_shift indicates we need to roll left
# to bring the desired samples to the front of the array
rholms_intp[det] = interpolate_rho_lms(rholms[det], t)
......@@ -414,8 +414,8 @@ def compute_mode_cross_term_ip(hlms, psd, fmin, fMax, fNyq, deltaF,
for mode2 in hlms.keys():
crossTerms[ (mode1,mode2) ] = IP.ip(hlms[mode1], hlms[mode2])
if verbose:
print(" : U populated ", (mode1, mode2), " = ",\
crossTerms[(mode1,mode2) ])
print " : U populated ", (mode1, mode2), " = ",\
crossTerms[(mode1,mode2) ]
return crossTerms
......
......@@ -17,7 +17,6 @@
"""
A collection of useful data analysis routines built from the SWIG wrappings of LAL and LALSimulation.
"""
from __future__ import print_function
import sys
import copy
import types
......@@ -125,52 +124,52 @@ class ChooseWaveformParams:
"""
Print all key-value pairs belonging in the class instance
"""
print("This ChooseWaveformParams has the following parameter values:")
print("m1 =", self.m1 / lal.MSUN_SI, "(Msun)")
print("m2 =", self.m2 / lal.MSUN_SI, "(Msun)")
print("spin1x =", self.spin1x)
print("spin1y =", self.spin1y)
print("spin1z =", self.spin1z)
print("spin2x =", self.spin2x)
print("spin2y =", self.spin2y)
print("spin2z =", self.spin2z)
print("lambda1 =", self.lambda1)
print("lambda2 =", self.lambda2)
print("inclination =", self.incl)
print("distance =", self.dist / 1.e+6 / lal.PC_SI, "(Mpc)")
print("reference orbital phase =", self.phiref)
print("time of coalescence =", float(self.tref))
print("detector is:", self.detector)
print "This ChooseWaveformParams has the following parameter values:"
print "m1 =", self.m1 / lal.MSUN_SI, "(Msun)"
print "m2 =", self.m2 / lal.MSUN_SI, "(Msun)"
print "spin1x =", self.spin1x
print "spin1y =", self.spin1y
print "spin1z =", self.spin1z
print "spin2x =", self.spin2x
print "spin2y =", self.spin2y
print "spin2z =", self.spin2z
print "lambda1 =", self.lambda1
print "lambda2 =", self.lambda2
print "inclination =", self.incl
print "distance =", self.dist / 1.e+6 / lal.PC_SI, "(Mpc)"
print "reference orbital phase =", self.phiref
print "time of coalescence =", float(self.tref)
print "detector is:", self.detector
if self.radec==False:
print("Sky position relative to overhead detector is:")
print("zenith angle =", self.theta, "(radians)")
print("azimuth angle =", self.phi, "(radians)")
print "Sky position relative to overhead detector is:"
print "zenith angle =", self.theta, "(radians)"
print "azimuth angle =", self.phi, "(radians)"
if self.radec==True:
print("Sky position relative to geocenter is:")
print("declination =", self.theta, "(radians)")
print("right ascension =", self.phi, "(radians)")
print("polarization angle =", self.psi)
print("starting frequency is =", self.fmin)
print("reference frequency is =", self.fref)
print("Max frequency is =", self.fmax)
print("time step =", self.deltaT, "(s) <==>", 1./self.deltaT,\
"(Hz) sample rate")
print("freq. bin size is =", self.deltaF, "(Hz)")
print("approximant is =", lalsim.GetStringFromApproximant(self.approx))
print("phase order =", self.phaseO)
print("amplitude order =", self.ampO)
print("waveFlags struct is", self.waveFlags)
print("nonGRparams struct is", self.nonGRparams)
print "Sky position relative to geocenter is:"
print "declination =", self.theta, "(radians)"
print "right ascension =", self.phi, "(radians)"
print "polarization angle =", self.psi
print "starting frequency is =", self.fmin
print "reference frequency is =", self.fref
print "Max frequency is =", self.fmax
print "time step =", self.deltaT, "(s) <==>", 1./self.deltaT,\
"(Hz) sample rate"
print "freq. bin size is =", self.deltaF, "(Hz)"
print "approximant is =", lalsim.GetStringFromApproximant(self.approx)
print "phase order =", self.phaseO
print "amplitude order =", self.ampO
print "waveFlags struct is", self.waveFlags
print "nonGRparams struct is", self.nonGRparams
if self.taper==lalsim.SIM_INSPIRAL_TAPER_NONE:
print("Tapering is set to SIM_INSPIRAL_TAPER_NONE")
print "Tapering is set to SIM_INSPIRAL_TAPER_NONE"
elif self.taper==lalsim.SIM_INSPIRAL_TAPER_START:
print("Tapering is set to SIM_INSPIRAL_TAPER_START")
print "Tapering is set to SIM_INSPIRAL_TAPER_START"
elif self.taper==lalsim.SIM_INSPIRAL_TAPER_END:
print("Tapering is set to SIM_INSPIRAL_TAPER_END")
print "Tapering is set to SIM_INSPIRAL_TAPER_END"
elif self.taper==lalsim.SIM_INSPIRAL_TAPER_STARTEND:
print("Tapering is set to SIM_INSPIRAL_TAPER_STARTEND")
print "Tapering is set to SIM_INSPIRAL_TAPER_STARTEND"
else:
print("Warning! Invalid value for taper:", self.taper)
print "Warning! Invalid value for taper:", self.taper
def copy_sim_inspiral(self, row):
"""
......@@ -266,7 +265,7 @@ def xml_to_ChooseWaveformParams_array(fname, minrow=None, maxrow=None,
# Copy the information from requested rows to the ChooseWaveformParams
[Ps[i-minrow].copy_lsctables_sim_inspiral(sim_insp[i]) for i in rng]
except ValueError:
print("No SimInspiral table found in xml file",file=sys.stderr)
print >>sys.stderr, "No SimInspiral table found in xml file"
return Ps
......@@ -543,7 +542,7 @@ class Overlap(InnerProduct):
Compute norm of a COMPLEX16Frequency Series
"""
if h.data.length != self.len1side:
print("Bad data length, needed %d, got %d" % (self.len1side, h.data.length))
print "Bad data length, needed %d, got %d" % (self.len1side, h.data.length)
assert h.data.length == self.len1side
assert abs(h.deltaF-self.deltaF) <= TOL_DF
val = 0.
......@@ -1275,7 +1274,7 @@ def frame_data_to_hoft(fname, channel, start=None, stop=None, window_shape=0.,
strength over that fraction of each end of the data segment.
"""
if verbose:
print(" ++ Loading from cache ", fname, channel)
print " ++ Loading from cache ", fname, channel
with open(fname) as cfile:
cachef = Cache.fromfile(cfile)
for i in range(len(cachef))[::-1]:
......@@ -1283,7 +1282,7 @@ def frame_data_to_hoft(fname, channel, start=None, stop=None, window_shape=0.,
if cachef[i].observatory != channel[0]:
del cachef[i]
if verbose:
print(cachef.to_segmentlistdict())
print cachef.to_segmentlistdict()
fcache = frutils.FrameCache(cachef)
# FIXME: Horrible, horrible hack -- will only work if all requested channels
# span the cache *exactly*
......@@ -1297,7 +1296,7 @@ def frame_data_to_hoft(fname, channel, start=None, stop=None, window_shape=0.,
tmp = lal.CreateREAL8TimeSeries("h(t)",
lal.LIGOTimeGPS(float(ht.metadata.segments[0][0])),
0., ht.metadata.dt, lal.DimensionlessUnit, len(ht))
print(" ++ Frame data sampling rate ", 1./tmp.deltaT, " and epoch ", string_gps_pretty_print(tmp.epoch))
print " ++ Frame data sampling rate ", 1./tmp.deltaT, " and epoch ", string_gps_pretty_print(tmp.epoch)
tmp.data.data[:] = ht
# Window the data - N.B. default is identity (no windowing)
hoft_window = lal.CreateTukeyREAL8Window(tmp.data.length, window_shape)
......@@ -1385,7 +1384,7 @@ def frame_data_to_non_herm_hoff(fname, channel, start=None, stop=None, TDlen=0,
FDlen)
lal.COMPLEX16TimeFreqFFT(hf, hoftC, fwdplan)
if verbose:
print(" ++ Loaded data h(f) of length n= ", hf.data.length, " (= ", len(hf.data.data)*ht.deltaT, "s) at sampling rate ", 1./ht.deltaT)
print " ++ Loaded data h(f) of length n= ", hf.data.length, " (= ", len(hf.data.data)*ht.deltaT, "s) at sampling rate ", 1./ht.deltaT
return hf
......@@ -1468,15 +1467,13 @@ if __name__ == "__main__":
try:
hoft(params)
except RuntimeError:
print("TD waveform generation failed for params\n" \
"masses: %e %e, spins: %e, %e, approx: %s" % (m1i, m2i, s1zi, s2zi, a) \
,file=sys.stderr)
print >>sys.stderr, "TD waveform generation failed for params\n" \
"masses: %e %e, spins: %e, %e, approx: %s" % (m1i, m2i, s1zi, s2zi, a)
params.deltaF = 1.0/8
params.fmax = 2048.
try:
hoff(params)
except RuntimeError:
print("FD waveform generation failed for params\n" \
"masses: %e %e, spins: %e, %e, approx: %s" % (m1i, m2i, s1zi, s2zi, a) \
, file=sys.stderr)
print >>sys.stderr, "FD waveform generation failed for params\n" \
"masses: %e %e, spins: %e, %e, approx: %s" % (m1i, m2i, s1zi, s2zi, a)
......@@ -224,8 +224,8 @@ if __name__ == "__main__":
bin_chosen[i] += 1
bin_chosen = numpy.array(bin_chosen.values(), dtype=numpy.float64)
bin_chosen /= bin_chosen.sum()
print(sorted(probs))
print(sorted(bin_chosen))
print sorted(probs)
print sorted(bin_chosen)
rvs = multivariate_normal(mean=(0,0), cov=((1, 2), (0.5, 2)), size=(100000,)).T
nbin_side = 20
......
......@@ -32,7 +32,7 @@ def send_samples(data, address=None, port=1890, socket=None, verbose=False):
msg_len = numpy.prod(data.shape) * 8
if verbose:
print("Sending %d bytes to %s:%d" % (msg_len, address, port))
print "Sending %d bytes to %s:%d" % (msg_len, address, port)
try:
if socket is None:
......@@ -40,7 +40,7 @@ def send_samples(data, address=None, port=1890, socket=None, verbose=False):
sender.send(data.tobytes("C"))
except pysocket.error as sockerr:
if verbose:
print("Unable to send data.")
print "Unable to send data."
# FIXME: Reenable this
#if sockerr.errno != errno.ECONNREFUSED or sockerr.errno:
#raise sockerr
......
......@@ -53,30 +53,30 @@ class IFO:
self._minlen = minlen
if type(segments) is str:
print("Reading segments for " + self._name + "")
print "Reading segments for " + self._name + ""
self._allsegments = self.readSegments(segments)
elif type(segments) is ndarray:
self._allsegments = segmentData(list(segments))
elif isinstance(segments, segmentData):
self._allsegments = segments
else:
print("Cannot recognize segments!")
print "Cannot recognize segments!"
return -1
self._segments = self._allsegments.fits(self._minlen)
if type(vetoes) is str:
print("Reading veto segments for " + self._name + "")
print "Reading veto segments for " + self._name + ""
self._vetoes = self.readSegments(vetoes)
elif type(vetoes) is ndarray:
self._vetoes = segmentData(list(vetoes))
elif isinstance(vetoes, segmentData):
self._vetoes = vetoes
else:
print("Cannot recognize veto segments!")
print "Cannot recognize veto segments!"
return -1
self.setUnvetoed()
print("Number of unvetoed segments that fit " + str(self._minlen) + ": " + str(self._unvetoed.length()))
print "Number of unvetoed segments that fit " + str(self._minlen) + ": " + str(self._unvetoed.length())
def setUnvetoed(self):
'''This is getting a list of unvetoed segments that fit the minimum length'''
......@@ -84,7 +84,7 @@ class IFO:
#self._unvetoed = self._segments.fits(self._minlen).getUnvetoed(self._vetoes).fits(self._minlen)
def readSegments(self, segfname):
print("Reading " + segfname)
print "Reading " + segfname
segdata = genfromtxt(segfname, dtype=int)
return segmentData(list(segdata))
......@@ -114,7 +114,7 @@ class IFO:
trigtimes.append(t + self._minlen//2)
t += self._minlen
else:
print("Invalid whereInj argument. Output times will be empty.")
print "Invalid whereInj argument. Output times will be empty."
if n is not None:
trigtimes = trigtimes[:n]
......@@ -124,7 +124,7 @@ class IFO:
savetxt(outfile, array(trigtimes), fmt='%i')
def plotCumulativeDurations(self, outfile, maxdur=None):
print("Plotting segment lengths distribution to file " + outfile)
print "Plotting segment lengths distribution to file " + outfile
fig = figure()
ax = fig.add_subplot(111)
ax.set_xlabel("segment length")
......@@ -169,7 +169,7 @@ class IFO:
if outfile is None:
return fig
else:
print('Plotting segments to ', outfile)
print 'Plotting segments to ', outfile
fig.savefig(outfile)
plot_params = {'figure.figsize': [fig_width,fig_height]}
rcParams.update(plot_params)
......@@ -192,17 +192,17 @@ class segment:
elif gpsstart is None and gpsend is None:
'''Overloading to generate segment from an array (id, start, end, length)'''
if len(data) is not 4:
print("Segment data doesn't have the correct length!")
print "Segment data doesn't have the correct length!"
return -1
self._id = data[0]
self._start = data[1]
self._end = data[2]
self._len = data[3]
else:
print("Wrong arguments to create segment!")
print "Wrong arguments to create segment!"
return -1
# if self._len != (self._end - self._start):
# print("Error in segment data: inconsistent length! " + str(self._len) + " " + str(self._end - self._start))
# print "Error in segment data: inconsistent length! " + str(self._len) + " " + str(self._end - self._start)
def intersectWithList(self, id0, other, sortedlist=True, startid=None):
'''Intersect segment with list of (non-overlapping) segments'''
......@@ -289,7 +289,7 @@ class segmentData:
notlist = []
c = 0
times = array(self._seglist)[:,[1,2]]
# print(shape(times))
# print shape(times)
times = times[argsort(times[:,1])]
t1 = start
for i in (arange(len(times))):
......@@ -333,7 +333,7 @@ class segmentData:
sgn = ds*de #should be negative if segment contains t
ids = where(sgn < 0)[0]
if len(ids) > 1:
print("Time " + time + " contained in more than one segment!")
print "Time " + time + " contained in more than one segment!"
if len(ids) == 1:
return [ds[ids[0]], -de[ids[0]]]
else:
......@@ -341,7 +341,7 @@ class segmentData:
def printToFile(self, outfile):
print("Printing segment list to file " + outfile)
print "Printing segment list to file " + outfile
savetxt(outfile, array(self._seglist), fmt='%i')
def plotSegments(self, outfile=None, lenperline=200000, segcolor='b', title=None):
......@@ -367,12 +367,12 @@ class segmentData:
if outfile is None:
return fig
else:
print('Plotting segments to ', outfile)
print 'Plotting segments to ', outfile
fig.savefig(outfile)
def plotCumulativeDurations(self, outfile, maxdur=None):
print("Plotting segment lengths distribution to file " + outfile)
print "Plotting segment lengths distribution to file " + outfile
fig = figure()
ax = fig.add_subplot(111)
ax.set_xlabel("segment length")
......@@ -418,7 +418,7 @@ def getDoubles(ifo1, ifo2, unvetoed=False):
minl2 = ifo2._minlen
name12 = name1 + name2
print('Combining ' + name1 + ' and ' + name2 + ' into ' + name12)
print 'Combining ' + name1 + ' and ' + name2 + ' into ' + name12
if unvetoed:
seg12 = unv1.intersectSegments(unv2) # only uses unvetoed long segment list for each IFO
else:
......@@ -471,8 +471,8 @@ def generateTimeslides(tdict, n, ref=None, outfolder=None, verbose=False):
slidefile.write(header+'\n')
slidedata = array(slidedict.values()).T
if verbose:
print(injtimes)
print(slidedict)
print injtimes
print slidedict
savetxt(injtimesfile, array(injtimes), fmt='%i')
savetxt(slidefile, slidedata, delimiter=' ', fmt='%i')
slidefile.close()
......@@ -579,10 +579,10 @@ if __name__ == "__main__":
single.getTrigTimes(whereInj=whereInj, n=Ninj, interval=interval, lmargin=seglen, outfile=os.path.join(outfolder, 'injtimes_' + single._name + '_' + str(single._minlen) + '.dat'))
# Check unvetoedness and prints the distance of trigger times to edges of unvetoed segments
if check:
print('checking single ' + single._name)
print 'checking single ' + single._name
for time in single.getTrigTimes(whereInj=whereInj, n=Ninj, interval=interval, lmargin=seglen):
dist = single._unvetoed.timeIn(time)
print(dist, dist > 0)
print dist, dist > 0
# Dump unvetoed segment list to file and plot segments to file
if dumpunvetoed:
single._unvetoed.printToFile(os.path.join(outfolder, 'segments', single._name + '_unvetoed_segs.dat'))
......@@ -603,10 +603,10 @@ if __name__ == "__main__":
double.plotCumulativeDurations(os.path.join(outfolder,'doubleseg_' + double._name +'.png'), maxplot)
# Check unvetoedness and prints the distance of trigger times to edges of unvetoed segments