From c0f2bbe7f2ab5161fe35d18c19ebee3235287ef7 Mon Sep 17 00:00:00 2001 From: Sophie Hourihane Date: Thu, 21 Oct 2021 13:57:19 -0700 Subject: [PATCH 1/3] Fixed python 2->3 conversion in bayeswave_pipe --- BayesWaveUtils/scripts/bayeswave_pipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BayesWaveUtils/scripts/bayeswave_pipe b/BayesWaveUtils/scripts/bayeswave_pipe index c1ca4b1..dd172e6 100755 --- a/BayesWaveUtils/scripts/bayeswave_pipe +++ b/BayesWaveUtils/scripts/bayeswave_pipe @@ -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') -- GitLab From d00c6876d07c8100319f784ca9c93b8fca7d6826 Mon Sep 17 00:00:00 2001 From: Sophie Hourihane Date: Mon, 4 Oct 2021 18:24:04 -0700 Subject: [PATCH 2/3] Adding BW_Flags, Qmax, gSNRpeak, cleanwindow --- BayesWaveUtils/bayeswave_plot/BW_Flags.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BayesWaveUtils/bayeswave_plot/BW_Flags.py b/BayesWaveUtils/bayeswave_plot/BW_Flags.py index f76a597..142a139 100644 --- a/BayesWaveUtils/bayeswave_plot/BW_Flags.py +++ b/BayesWaveUtils/bayeswave_plot/BW_Flags.py @@ -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 @@ -237,6 +241,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': -- GitLab From ce5b72a59de0babd76327cb75c6bfd75658221e7 Mon Sep 17 00:00:00 2001 From: Sophie Hourihane Date: Thu, 21 Oct 2021 13:54:59 -0700 Subject: [PATCH 3/3] Fixed clim on residual Qscans and definition of spin in BW_Flags --- BayesWaveUtils/bayeswave_plot/BW_Flags.py | 12 +++++++----- BayesWaveUtils/scripts/megaplot.py | 7 ++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/BayesWaveUtils/bayeswave_plot/BW_Flags.py b/BayesWaveUtils/bayeswave_plot/BW_Flags.py index 142a139..d69ca2c 100644 --- a/BayesWaveUtils/bayeswave_plot/BW_Flags.py +++ b/BayesWaveUtils/bayeswave_plot/BW_Flags.py @@ -142,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') diff --git a/BayesWaveUtils/scripts/megaplot.py b/BayesWaveUtils/scripts/megaplot.py index dea66e7..6a2a2c7 100755 --- a/BayesWaveUtils/scripts/megaplot.py +++ b/BayesWaveUtils/scripts/megaplot.py @@ -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)') -- GitLab