From 3b6a5d0ae0ee3ec62c3407bd6ef4c3e6869d7c5a Mon Sep 17 00:00:00 2001
From: Jameson Graef Rollins <jrollins@finestructure.net>
Date: Fri, 15 Dec 2017 17:17:56 -0800
Subject: [PATCH] minor code cleanup

---
 gwinc/noise/newtonian.py         | 11 +++++++----
 gwinc/noise/seismic.py           |  6 +++---
 gwinc/noise/suspensionthermal.py |  4 ++--
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/gwinc/noise/newtonian.py b/gwinc/noise/newtonian.py
index 006b776..a8a6054 100644
--- a/gwinc/noise/newtonian.py
+++ b/gwinc/noise/newtonian.py
@@ -28,8 +28,9 @@ def gravg(f, ifo):
     L     = ifo.Infrastructure.Length
     G     = scipy.constants.G
     rho   = ifo.Seismic.Rho
-    beta  = ifo.Seismic.Beta        # factor to account for correlation between masses
-                                    # and the height of the mirror above the ground
+    # factor to account for correlation between masses
+    # and the height of the mirror above the ground
+    beta  = ifo.Seismic.Beta
 
     if 'Spectrum' in ifo.Seismic:
         seismic = ifo.Seismic.Spectrum
@@ -43,7 +44,8 @@ def gravg(f, ifo):
     n = (beta*4*pi/L*(fgg**2/f**2)*seismic)**2
 
     # Feedforward cancellation
-    n = n / (ifo.Seismic.Omicron)**2
+    n /= (ifo.Seismic.Omicron)**2
+
     return n
 
 
@@ -96,5 +98,6 @@ def ground(Seismic, f):
         raise 'Unknown seismic.site'
 
     # convert into displacement
-    n = n/(2*pi*f)
+    n /= 2*pi*f
+
     return n
diff --git a/gwinc/noise/seismic.py b/gwinc/noise/seismic.py
index 124269c..b161a68 100644
--- a/gwinc/noise/seismic.py
+++ b/gwinc/noise/seismic.py
@@ -40,9 +40,9 @@ def seismic(f, ifo):
     n = nv + nh
 
     # Convert into Strain PSD (4 TMs)
-    nh = 4 * nh / ifo.Infrastructure.Length**2
-    nv = 4 * nv / ifo.Infrastructure.Length**2
-    n  = 4 * n  / ifo.Infrastructure.Length**2
+    nh *= 4 / ifo.Infrastructure.Length**2
+    nv *= 4 / ifo.Infrastructure.Length**2
+    n  *= 4 / ifo.Infrastructure.Length**2
 
     return n
 
diff --git a/gwinc/noise/suspensionthermal.py b/gwinc/noise/suspensionthermal.py
index a00a932..6e99e75 100644
--- a/gwinc/noise/suspensionthermal.py
+++ b/gwinc/noise/suspensionthermal.py
@@ -63,7 +63,7 @@ def suspR(f, ifo):
 
             # thermal noise (m^2/Hz) for one suspension
             w = 2*pi*f
-            noise = noise + 4 * kB * Temp[ii] * abs(imag(dxdF[ii,:])) / w
+            noise += 4 * kB * Temp[ii] * abs(imag(dxdF[ii,:])) / w
 
     if ifo.Suspension.Type == 'Quad_MB':
         raise Exception('not dealing with Quad_MB suspensions currently')
@@ -75,7 +75,7 @@ def suspR(f, ifo):
         #noise = noise.^2; %square to make strain^2
     else:
         # turn into gravitational wave strain; 4 masses
-        noise = 4 * noise / ifo.Infrastructure.Length**2
+        noise *= 4 / ifo.Infrastructure.Length**2
         return np.squeeze(noise)
 
 
-- 
GitLab