From f65e1cd0ca5371ffc381bea0edb9babc1e9792c0 Mon Sep 17 00:00:00 2001
From: Moritz <email@moritz-huebner.de>
Date: Thu, 2 May 2019 20:03:21 +1000
Subject: [PATCH] Moved SubclassPropertyAccessor

---
 bilby/gw/detector/interferometer.py |  2 +-
 bilby/gw/detector/strain_data.py    |  2 +-
 bilby/gw/detector/utils.py          | 29 ---------------------------
 bilby/gw/utils.py                   | 31 +++++++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 31 deletions(-)
 delete mode 100644 bilby/gw/detector/utils.py

diff --git a/bilby/gw/detector/interferometer.py b/bilby/gw/detector/interferometer.py
index c82683f1f..7ee47ba11 100644
--- a/bilby/gw/detector/interferometer.py
+++ b/bilby/gw/detector/interferometer.py
@@ -9,7 +9,7 @@ from bilby.core.utils import logger
 from bilby.gw import utils as gwutils
 from bilby.gw.calibration import Recalibrate
 from bilby.gw.detector.geometry import InterferometerGeometry
-from bilby.gw.detector.utils import SubclassPropertyAccessor
+from bilby.gw.utils import SubclassPropertyAccessor
 from .strain_data import InterferometerStrainData
 
 try:
diff --git a/bilby/gw/detector/strain_data.py b/bilby/gw/detector/strain_data.py
index 47d7c280a..46d62d69e 100644
--- a/bilby/gw/detector/strain_data.py
+++ b/bilby/gw/detector/strain_data.py
@@ -5,7 +5,7 @@ from bilby.core import utils
 from bilby.core.series import CoupledTimeAndFrequencySeries
 from bilby.core.utils import logger
 from bilby.gw import utils as gwutils
-from bilby.gw.detector.utils import SubclassPropertyAccessor
+from bilby.gw.utils import SubclassPropertyAccessor
 
 try:
     import gwpy
diff --git a/bilby/gw/detector/utils.py b/bilby/gw/detector/utils.py
deleted file mode 100644
index c14856197..000000000
--- a/bilby/gw/detector/utils.py
+++ /dev/null
@@ -1,29 +0,0 @@
-class SubclassPropertyAccessor(object):
-    """
-    Generic descriptor class that allows handy access of properties without long
-    boilerplate code. The properties of Interferometer are defined as instances
-    of this class. Don't touch this if you don't know what you are doing.
-
-    This avoids lengthy code like
-    ```
-    @property
-    def length(self):
-        return self.geometry.length
-
-    @length_setter
-    def length(self, length)
-        self.geometry.length = length
-
-    in the Interferometer class
-    ```
-    """
-
-    def __init__(self, property_name, container_instance_name):
-        self.property_name = property_name
-        self.container_instance_name = container_instance_name
-
-    def __get__(self, instance, owner):
-        return getattr(getattr(instance, self.container_instance_name), self.property_name)
-
-    def __set__(self, instance, value):
-        setattr(getattr(instance, self.container_instance_name), self.property_name, value)
diff --git a/bilby/gw/utils.py b/bilby/gw/utils.py
index 789d60228..bf0cff4d1 100644
--- a/bilby/gw/utils.py
+++ b/bilby/gw/utils.py
@@ -926,3 +926,34 @@ def plot_spline_pos(log_freqs, samples, nfreqs=100, level=0.9, color='k', label=
     plt.fill_between(freqs, credible_interval(data, level), credible_interval(data, level, lower=False),
                      color=color, alpha=.1, linewidth=0.1)
     plt.xlim(freq_points.min() - .5, freq_points.max() + 50)
+
+
+class SubclassPropertyAccessor(object):
+    """
+    Generic descriptor class that allows handy access of properties without long
+    boilerplate code. The properties of Interferometer are defined as instances
+    of this class. Don't touch this if you don't know what you are doing.
+
+    This avoids lengthy code like
+    ```
+    @property
+    def length(self):
+        return self.geometry.length
+
+    @length_setter
+    def length(self, length)
+        self.geometry.length = length
+
+    in the Interferometer class
+    ```
+    """
+
+    def __init__(self, property_name, container_instance_name):
+        self.property_name = property_name
+        self.container_instance_name = container_instance_name
+
+    def __get__(self, instance, owner):
+        return getattr(getattr(instance, self.container_instance_name), self.property_name)
+
+    def __set__(self, instance, value):
+        setattr(getattr(instance, self.container_instance_name), self.property_name, value)
\ No newline at end of file
-- 
GitLab