Commit 795148fd authored by Sudarshan Ghonge's avatar Sudarshan Ghonge
Browse files

Merge branch 'bwpipefix' into 'master'

BW Pipe Fix and Q_Scan Plot fix

See merge request !231
parents f3eed81c ce5b72a5
Pipeline #346426 passed with stages
in 22 minutes and 48 seconds
......@@ -40,12 +40,16 @@ class Flags:
self.Niter = 4000000
self.Ncycle = 100
self.chirplets = False
self.Qmax = 100
self.gSNRpeak = 5 # puts peak of glitch waveform proposals at this SNR
self.Dmax = 100 # Maximum number of wavelets per channel
# Windows, cleaning, and bayesLine
self.bayesLine = False
self.noClean = 0
self.CBCwindow = -1 #window around cbc event
self.window = 0
self.cleanwindow = 0 # time from the edges to subtract glitches out of
# Parameters describing what run type was used
self.signalGlitch_flag = False
......@@ -138,15 +142,17 @@ class Flags:
# TODO not sure what units the xml files are in
# but I will assume they are in units that match up with conventions here
# https://arxiv.org/abs/1409.7215 (pg 6, a_i = |s_i| / m_i^2, otherwise missing a factor of c / G)
# NVM it's literally s1z and s2z
if p[-1] == '1':
p = 'spin1'
else:
p = 'spin2'
spin = np.zeros(3)
mass = self.get_xml_parameter('mass{0}'.format(p[-1])) #detector frame
for i, k in enumerate(['x', 'y', 'z']):
spin[i] = self.inj_dat.getColumnByName(p + k)[self.event]
return(np.linalg.norm(spin) / mass ** 2)
return(self.inj_dat.getColumnByName(p + 'z')[self.event])
#spin = np.zeros(3)
#mass = self.get_xml_parameter('mass{0}'.format(p[-1])) #detector frame
#for i, k in enumerate(['x', 'y', 'z']):
# spin[i] = self.inj_dat.getColumnByName(p + k)[self.event]
#return(np.linalg.norm(spin) / mass ** 2)
elif (p == 'chi_eff'):
a1 = self.get_xml_parameter('spin1')
m1 = self.get_xml_parameter('mass1')
......@@ -237,6 +243,14 @@ def readbwb(runFlags, verbose = True):
runFlags.Ncycle = int(cmdline[index + 1])
elif arg == '--chirplets':
runFlags.chirplets = True
elif arg == '--Qmax':
runFlags.Qmax = float(cmdline[index + 1])
elif arg == '--Dmax':
runFlags.Dmax = float(cmdline[index + 1])
elif arg == '--ampPriorPeak':
runFlags.gSNRpeak = float(cmdline[index + 1])
elif arg == '--cleanwindow':
runFlags.cleanwindow = float(cmdline[index + 1])
# IFOs
elif arg=='--ifo':
......
......@@ -107,7 +107,7 @@ def localize_xml(xmlfile, old_path, new_path):
filedata = oldxml.read()
# Search and replace on the abs path
newdata = filedata.replace(old_path.encode(),new_path.encode())
newdata = filedata.replace(str(old_path.encode()),str(new_path.encode()))
# Backup the original xml file
shutil.move(xmlfile, xmlfile+'.bk')
......
......@@ -770,11 +770,12 @@ def Q_scan(subDir,model, Q, t, f, ifo, axwinner, f_axwinner, climwinner=[1,1], r
print("Oops! you're probably using python 2, {cmap} doesn't exist yet!".format(cmap = cmap_name))
qplot = ax.imshow(data,aspect='auto',origin='lower',extent=[t[0],t[-1],f[0],f[-1]], cmap='OrRd')
if model == 'data':
qplot.set_clim(np.min(data),np.max(data))
if model == 'signal_residual' or model == 'glitch_residual':
# Set the clim of the cmap based on which was 'best' as calculated from the data
if 'residual' in model:
qplot.set_clim(climwinner)
else:
qplot.set_clim(np.min(data),np.max(data))
ax.set_xlabel('Time (s)')
ax.set_ylabel('Frequency (Hz)')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment