From 0ef25a9c4290c0a9e315a6e743105a7fc8c8cbac Mon Sep 17 00:00:00 2001
From: Sylvia Biscoveanu <violinasb@yahoo.com>
Date: Fri, 8 Mar 2019 12:09:34 -0800
Subject: [PATCH] Add label to output file name with the frequency domain
 strain for each IFO.

---
 bilby/gw/detector.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/bilby/gw/detector.py b/bilby/gw/detector.py
index 6ceb555c..b3b18e07 100644
--- a/bilby/gw/detector.py
+++ b/bilby/gw/detector.py
@@ -1580,17 +1580,20 @@ class Interferometer(object):
         label: str
             The name of the output files
         """
-        np.savetxt('{}/{}_frequency_domain_data.dat'.format(outdir, self.name),
+
+        if label is None:
+            filename_psd = '{}/{}_psd.dat'.format(outdir, self.name)
+            filename_data = '{}/{}_frequency_domain_data.dat'.format(outdir, self.name)
+        else:
+            filename_psd = '{}/{}_{}_psd.dat'.format(outdir, self.name, label)
+            filename_data = '{}/{}_{}_frequency_domain_data.dat'.format(outdir, self.name, label)
+        np.savetxt(filename_data,
                    np.array(
                        [self.frequency_array,
                         self.frequency_domain_strain.real,
                         self.frequency_domain_strain.imag]).T,
                    header='f real_h(f) imag_h(f)')
-        if label is None:
-            filename = '{}/{}_psd.dat'.format(outdir, self.name)
-        else:
-            filename = '{}/{}_{}_psd.dat'.format(outdir, self.name, label)
-        np.savetxt(filename,
+        np.savetxt(filename_psd,
                    np.array(
                        [self.frequency_array,
                         self.amplitude_spectral_density_array]).T,
-- 
GitLab