From a43989fc5abfc9634afcf0bdf90cc4957c2c4b21 Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Fri, 8 Dec 2017 17:02:25 +0100
Subject: [PATCH] Minor PEP 8 fixes

---
 pyfstat/core.py                | 38 +++++++++++++++++-------------
 pyfstat/grid_based_searches.py |  9 ++++---
 pyfstat/make_sfts.py           | 43 ++++++++++++++++++----------------
 pyfstat/mcmc_based_searches.py |  3 ++-
 4 files changed, 51 insertions(+), 42 deletions(-)

diff --git a/pyfstat/core.py b/pyfstat/core.py
index 0c41b5c..9e0499e 100755
--- a/pyfstat/core.py
+++ b/pyfstat/core.py
@@ -348,13 +348,13 @@ class ComputeFstat(BaseSearchClass):
             this epoch
         binary : bool
             If true, search of binary parameters.
+        BSGL : bool
+            If true, compute the BSGL rather than the twoF value.
         transientWindowType: str
             If 'rect' or 'exp',
             allow for the Fstat to be computed over a transient range.
-            ('none' instead of None explicitly calls the transient-window function,
-             but with the full range, for debugging)
-        BSGL : bool
-            If true, compute the BSGL rather than the twoF value.
+            ('none' instead of None explicitly calls the transient-window
+            function, but with the full range, for debugging)
         detectors : str
             Two character reference to the data to use, specify None for no
             contraint. If multiple-separate by comma.
@@ -606,27 +606,32 @@ class ComputeFstat(BaseSearchClass):
             if self.transientWindowType in transientWindowTypes:
                 self.windowRange.type = transientWindowTypes[self.transientWindowType]
             else:
-                raise ValueError('Unknown window-type ({}) passed as input. Allowed are: [{}].'.format(self.transientWindowType, ', '.join(transientWindowTypes)))
+                raise ValueError(
+                    'Unknown window-type ({}) passed as input, [{}] allows.'
+                    .format(self.transientWindowType,
+                            ', '.join(transientWindowTypes)))
 
             self.Tsft = int(1.0/SFTCatalog.data[0].header.deltaF)
             if self.t0Band is None:
-                self.windowRange.t0Band  = 0
-                self.windowRange.dt0     = 1
+                self.windowRange.t0Band = 0
+                self.windowRange.dt0 = 1
             else:
-                if not isinstance(self.t0Band,int):
-                    logging.warn('Casting non-integer t0Band={} to int...'.format(self.t0Band))
+                if not isinstance(self.t0Band, int):
+                    logging.warn('Casting non-integer t0Band={} to int...'
+                                 .format(self.t0Band))
                     self.t0Band = int(self.t0Band)
-                self.windowRange.t0Band  = self.t0Band
-                self.windowRange.dt0     = self.Tsft
+                self.windowRange.t0Band = self.t0Band
+                self.windowRange.dt0 = self.Tsft
             if self.tauBand is None:
                 self.windowRange.tauBand = 0
-                self.windowRange.dtau    = 1
+                self.windowRange.dtau = 1
             else:
-                if not isinstance(self.tauBand,int):
-                    logging.warn('Casting non-integer tauBand={} to int...'.format(self.tauBand))
+                if not isinstance(self.tauBand, int):
+                    logging.warn('Casting non-integer tauBand={} to int...'
+                                 .format(self.tauBand))
                     self.tauBand = int(self.tauBand)
                 self.windowRange.tauBand = self.tauBand
-                self.windowRange.dtau    = self.Tsft
+                self.windowRange.dtau = self.Tsft
 
     def get_fullycoherent_twoF(self, tstart, tend, F0, F1, F2, Alpha, Delta,
                                asini=None, period=None, ecc=None, tp=None,
@@ -667,7 +672,8 @@ class ComputeFstat(BaseSearchClass):
             # actual (t0,tau) window was set with tstart, tend before
             self.windowRange.tau = int(tend - tstart)  # TYPE UINT4
         else:
-            # grid search: start at minimum tau required for nondegenerate F-stat computation
+            # grid search: start at minimum tau required for nondegenerate
+            # F-stat computation
             self.windowRange.tau = int(2*self.Tsft)
 
         FS = lalpulsar.ComputeTransientFstatMap(
diff --git a/pyfstat/grid_based_searches.py b/pyfstat/grid_based_searches.py
index daad3b1..7dab5bf 100644
--- a/pyfstat/grid_based_searches.py
+++ b/pyfstat/grid_based_searches.py
@@ -50,11 +50,10 @@ class GridSearch(BaseSearchClass):
         input_arrays: bool
             if true, use the F0s, F1s, etc as is
         transientWindowType: str
-            If 'rect' or 'exp',
-            compute atoms so that a transient (t0,tau) map can later be computed.
-            ('none' instead of None explicitly calls the transient-window function,
-             but with the full range, for debugging)
-            Currently only supported for nsegs=1.
+            If 'rect' or 'exp', compute atoms so that a transient (t0,tau) map
+            can later be computed.  ('none' instead of None explicitly calls
+            the transient-window function, but with the full range, for
+            debugging). Currently only supported for nsegs=1.
         t0Band, tauBand: int
             if >0, search t0 in (minStartTime,minStartTime+t0Band)
                    and tau in (2*Tsft,2*Tsft+tauBand).
diff --git a/pyfstat/make_sfts.py b/pyfstat/make_sfts.py
index 5088c27..5e47b56 100644
--- a/pyfstat/make_sfts.py
+++ b/pyfstat/make_sfts.py
@@ -93,7 +93,7 @@ class Writer(BaseSearchClass):
         self.run_makefakedata()
 
     def get_base_template(self, i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref):
+                          F1, F2, tref):
         return (
 """[TS{}]
 Alpha = {:1.18e}
@@ -107,17 +107,18 @@ f1dot = {:1.18e}
 f2dot = {:1.18e}
 refTime = {:10.6f}""")
 
-    def get_single_config_line_cw(self, i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref):
-        template = (self.get_base_template(i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref) + """\n""")
-        return template.format(i, Alpha, Delta, h0, cosi, psi, phi, F0, F1,
-                               F2, tref)
-
-    def get_single_config_line_tcw(self, i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref, window, tstart, duration_days):
-        template = (self.get_base_template(i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref) + """
+    def get_single_config_line_cw(
+            self, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref):
+        template = (self.get_base_template(
+            i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref) + """\n""")
+        return template.format(
+            i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref)
+
+    def get_single_config_line_tcw(
+            self, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref,
+            window, tstart, duration_days):
+        template = (self.get_base_template(
+            i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref) + """
 transientWindowType = {:s}
 transientStartTime = {:10.3f}
 transientTauDays = {:1.3f}\n""")
@@ -126,12 +127,13 @@ transientTauDays = {:1.3f}\n""")
 
     def get_single_config_line(self, i, Alpha, Delta, h0, cosi, psi, phi, F0,
                                F1, F2, tref, window, tstart, duration_days):
-        if window=='none':
-            return self.get_single_config_line_cw(i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref)
+        if window == 'none':
+            return self.get_single_config_line_cw(
+                i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref)
         else:
-            return self.get_single_config_line_tcw(i, Alpha, Delta, h0, cosi, psi, phi, F0,
-                               F1, F2, tref, window, tstart, duration_days)
+            return self.get_single_config_line_tcw(
+                i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref, window,
+                tstart, duration_days)
 
     def make_cff(self):
         """
@@ -141,8 +143,8 @@ transientTauDays = {:1.3f}\n""")
 
         content = self.get_single_config_line(
             0, self.Alpha, self.Delta, self.h0, self.cosi, self.psi,
-            self.phi, self.F0, self.F1, self.F2, self.tref, self.transientWindowType, self.tstart,
-            self.duration_days)
+            self.phi, self.F0, self.F1, self.F2, self.tref,
+            self.transientWindowType, self.tstart, self.duration_days)
 
         if self.check_if_cff_file_needs_rewritting(content):
             config_file = open(self.config_file_name, "w+")
@@ -340,7 +342,8 @@ class GlitchWriter(Writer):
                                            self.tbounds[:-1])):
             line = self.get_single_config_line(
                 i, self.Alpha, self.Delta, self.h0, self.cosi, self.psi,
-                t[0], t[1], t[2], t[3], self.tref, self.transientWindowType, ts, d)
+                t[0], t[1], t[2], t[3], self.tref, self.transientWindowType,
+                ts, d)
 
             content += line
 
diff --git a/pyfstat/mcmc_based_searches.py b/pyfstat/mcmc_based_searches.py
index d663874..3da12b6 100644
--- a/pyfstat/mcmc_based_searches.py
+++ b/pyfstat/mcmc_based_searches.py
@@ -2208,7 +2208,8 @@ class MCMCTransientSearch(MCMCSearch):
         self.search = core.ComputeFstat(
             tref=self.tref, sftfilepattern=self.sftfilepattern,
             minCoverFreq=self.minCoverFreq, maxCoverFreq=self.maxCoverFreq,
-            detectors=self.detectors, transientWindowType=self.transientWindowType,
+            detectors=self.detectors,
+            transientWindowType=self.transientWindowType,
             minStartTime=self.minStartTime, maxStartTime=self.maxStartTime,
             BSGL=self.BSGL, binary=self.binary,
             injectSources=self.injectSources)
-- 
GitLab