From d22d37765f0f07676fdbd8104b5eb55429d96383 Mon Sep 17 00:00:00 2001 From: Moritz <email@moritz-huebner.de> Date: Thu, 2 May 2019 20:09:44 +1000 Subject: [PATCH] Renamed SubclassPropertyAccessor to just PropertyAccessor --- bilby/gw/detector/interferometer.py | 46 ++++++++++++++--------------- bilby/gw/detector/strain_data.py | 12 ++++---- bilby/gw/utils.py | 4 +-- bilby/gw/waveform_generator.py | 12 ++++---- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bilby/gw/detector/interferometer.py b/bilby/gw/detector/interferometer.py index 7ee47ba11..e4af33179 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.utils import SubclassPropertyAccessor +from bilby.gw.utils import PropertyAccessor from .strain_data import InterferometerStrainData try: @@ -23,28 +23,28 @@ except ImportError: class Interferometer(object): """Class for the Interferometer """ - length = SubclassPropertyAccessor('length', 'geometry') - latitude = SubclassPropertyAccessor('latitude', 'geometry') - latitude_radians = SubclassPropertyAccessor('latitude_radians', 'geometry') - longitude = SubclassPropertyAccessor('longitude', 'geometry') - longitude_radians = SubclassPropertyAccessor('longitude_radians', 'geometry') - elevation = SubclassPropertyAccessor('elevation', 'geometry') - x = SubclassPropertyAccessor('x', 'geometry') - y = SubclassPropertyAccessor('y', 'geometry') - xarm_azimuth = SubclassPropertyAccessor('xarm_azimuth', 'geometry') - yarm_azimuth = SubclassPropertyAccessor('yarm_azimuth', 'geometry') - xarm_tilt = SubclassPropertyAccessor('xarm_tilt', 'geometry') - yarm_tilt = SubclassPropertyAccessor('yarm_tilt', 'geometry') - vertex = SubclassPropertyAccessor('vertex', 'geometry') - detector_tensor = SubclassPropertyAccessor('detector_tensor', 'geometry') - - frequency_array = SubclassPropertyAccessor('frequency_array', 'strain_data') - time_array = SubclassPropertyAccessor('time_array', 'strain_data') - minimum_frequency = SubclassPropertyAccessor('minimum_frequency', 'strain_data') - maximum_frequency = SubclassPropertyAccessor('maximum_frequency', 'strain_data') - frequency_mask = SubclassPropertyAccessor('frequency_mask', 'strain_data') - frequency_domain_strain = SubclassPropertyAccessor('frequency_domain_strain', 'strain_data') - time_domain_strain = SubclassPropertyAccessor('time_domain_strain', 'strain_data') + length = PropertyAccessor('length', 'geometry') + latitude = PropertyAccessor('latitude', 'geometry') + latitude_radians = PropertyAccessor('latitude_radians', 'geometry') + longitude = PropertyAccessor('longitude', 'geometry') + longitude_radians = PropertyAccessor('longitude_radians', 'geometry') + elevation = PropertyAccessor('elevation', 'geometry') + x = PropertyAccessor('x', 'geometry') + y = PropertyAccessor('y', 'geometry') + xarm_azimuth = PropertyAccessor('xarm_azimuth', 'geometry') + yarm_azimuth = PropertyAccessor('yarm_azimuth', 'geometry') + xarm_tilt = PropertyAccessor('xarm_tilt', 'geometry') + yarm_tilt = PropertyAccessor('yarm_tilt', 'geometry') + vertex = PropertyAccessor('vertex', 'geometry') + detector_tensor = PropertyAccessor('detector_tensor', 'geometry') + + frequency_array = PropertyAccessor('frequency_array', 'strain_data') + time_array = PropertyAccessor('time_array', 'strain_data') + minimum_frequency = PropertyAccessor('minimum_frequency', 'strain_data') + maximum_frequency = PropertyAccessor('maximum_frequency', 'strain_data') + frequency_mask = PropertyAccessor('frequency_mask', 'strain_data') + frequency_domain_strain = PropertyAccessor('frequency_domain_strain', 'strain_data') + time_domain_strain = PropertyAccessor('time_domain_strain', 'strain_data') def __init__(self, name, power_spectral_density, minimum_frequency, maximum_frequency, length, latitude, longitude, elevation, xarm_azimuth, yarm_azimuth, xarm_tilt=0., yarm_tilt=0., calibration_model=Recalibrate()): diff --git a/bilby/gw/detector/strain_data.py b/bilby/gw/detector/strain_data.py index 46d62d69e..f5781cbd4 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.utils import SubclassPropertyAccessor +from bilby.gw.utils import PropertyAccessor try: import gwpy @@ -24,11 +24,11 @@ except ImportError: class InterferometerStrainData(object): """ Strain data for an interferometer """ - duration = SubclassPropertyAccessor('duration', '_times_and_frequencies') - sampling_frequency = SubclassPropertyAccessor('sampling_frequency', '_times_and_frequencies') - start_time = SubclassPropertyAccessor('start_time', '_times_and_frequencies') - frequency_array = SubclassPropertyAccessor('frequency_array', '_times_and_frequencies') - time_array = SubclassPropertyAccessor('time_array', '_times_and_frequencies') + duration = PropertyAccessor('duration', '_times_and_frequencies') + sampling_frequency = PropertyAccessor('sampling_frequency', '_times_and_frequencies') + start_time = PropertyAccessor('start_time', '_times_and_frequencies') + frequency_array = PropertyAccessor('frequency_array', '_times_and_frequencies') + time_array = PropertyAccessor('time_array', '_times_and_frequencies') def __init__(self, minimum_frequency=0, maximum_frequency=np.inf, roll_off=0.2): diff --git a/bilby/gw/utils.py b/bilby/gw/utils.py index bf0cff4d1..6a9363094 100644 --- a/bilby/gw/utils.py +++ b/bilby/gw/utils.py @@ -928,7 +928,7 @@ def plot_spline_pos(log_freqs, samples, nfreqs=100, level=0.9, color='k', label= plt.xlim(freq_points.min() - .5, freq_points.max() + 50) -class SubclassPropertyAccessor(object): +class PropertyAccessor(object): """ Generic descriptor class that allows handy access of properties without long boilerplate code. The properties of Interferometer are defined as instances @@ -956,4 +956,4 @@ class SubclassPropertyAccessor(object): 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 + setattr(getattr(instance, self.container_instance_name), self.property_name, value) diff --git a/bilby/gw/waveform_generator.py b/bilby/gw/waveform_generator.py index 60edf6828..db174ae44 100644 --- a/bilby/gw/waveform_generator.py +++ b/bilby/gw/waveform_generator.py @@ -2,16 +2,16 @@ import numpy as np from ..core import utils from ..core.series import CoupledTimeAndFrequencySeries -from .utils import SubclassPropertyAccessor +from .utils import PropertyAccessor class WaveformGenerator(object): - duration = SubclassPropertyAccessor('duration', '_times_and_frequencies') - sampling_frequency = SubclassPropertyAccessor('sampling_frequency', '_times_and_frequencies') - start_time = SubclassPropertyAccessor('start_time', '_times_and_frequencies') - frequency_array = SubclassPropertyAccessor('frequency_array', '_times_and_frequencies') - time_array = SubclassPropertyAccessor('time_array', '_times_and_frequencies') + duration = PropertyAccessor('duration', '_times_and_frequencies') + sampling_frequency = PropertyAccessor('sampling_frequency', '_times_and_frequencies') + start_time = PropertyAccessor('start_time', '_times_and_frequencies') + frequency_array = PropertyAccessor('frequency_array', '_times_and_frequencies') + time_array = PropertyAccessor('time_array', '_times_and_frequencies') def __init__(self, duration=None, sampling_frequency=None, start_time=0, frequency_domain_source_model=None, time_domain_source_model=None, parameters=None, -- GitLab