Skip to content

Commit 8026b67

Browse files
extend compatibility to astropy4
1 parent aa8da42 commit 8026b67

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

stingray/simulator/models.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,13 @@ def bounding_box(self, factor=25):
9595

9696
return (x0 - dx, x0 + dx)
9797

98-
@property
99-
def input_units(self):
100-
if self.x_0.input_unit is None:
101-
return None
102-
return {self.inputs[0]: self.x_0.input_unit}
98+
# NOTE:
99+
# In astropy 4.3 'Parameter' object has no attribute 'input_unit',
100+
# whereas newer versions of Astropy include this attribute.
103101

104-
def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):
105-
return {
106-
"x_0": inputs_unit[self.inputs[0]],
107-
"fwhm": inputs_unit[self.inputs[0]],
108-
"value": outputs_unit[self.outputs[0]],
109-
}
102+
# TODO:
103+
# Add 'input_units' and '_parameter_units_for_data_units' methods
104+
# when we drop support for Astropy < 5.3.
110105

111106

112107
class SmoothBrokenPowerLaw(Fittable1DModel):
@@ -190,17 +185,13 @@ def fit_deriv(x, norm, gamma_low, gamma_high, break_freq):
190185
)
191186
return [del_func_x, del_func_norm, del_func_g_low, del_func_g_high, del_func_b_freq]
192187

193-
@property
194-
def input_units(self):
195-
if self.break_freq.input_unit is None:
196-
return None
197-
return {self.inputs[0]: self.break_freq.input_unit}
198-
199-
def _parameter_units_for_data_units(self, inputs_unit, outputs_unit):
200-
return {
201-
"break_freq": inputs_unit[self.inputs[0]],
202-
"norm_": outputs_unit[self.outputs[0]],
203-
}
188+
# NOTE:
189+
# In astropy 4.3 'Parameter' object has no attribute 'input_unit',
190+
# whereas newer versions of Astropy include this attribute.
191+
192+
# TODO:
193+
# Add 'input_units' and '_parameter_units_for_data_units' methods
194+
# when we drop support for Astropy < 5.3.
204195

205196

206197
def generalized_lorentzian(x, p):

0 commit comments

Comments
 (0)