removed concserved_quantity from PlotRange
This commit is contained in:
@@ -38,6 +38,7 @@ MANDATORY_PARAMETERS = {
|
||||
"ifft",
|
||||
"w0",
|
||||
"spec_0",
|
||||
"c_to_a_factor",
|
||||
"field_0",
|
||||
"mean_power",
|
||||
"input_transmission",
|
||||
|
||||
@@ -382,15 +382,10 @@ class PlotRange(tuple):
|
||||
left: float = property(itemgetter(0))
|
||||
right: float = property(itemgetter(1))
|
||||
unit: Callable[[float], float] = property(itemgetter(2))
|
||||
conserved_quantity: bool = property(itemgetter(3))
|
||||
__slots__ = []
|
||||
|
||||
@property
|
||||
def must_correct_wl(self) -> bool:
|
||||
return self.unit.type == "WL" and self.conserved_quantity
|
||||
|
||||
def __new__(cls, left, right, unit, conserved_quantity=True):
|
||||
return tuple.__new__(cls, (left, right, get_unit(unit), conserved_quantity))
|
||||
def __new__(cls, left, right, unit):
|
||||
return tuple.__new__(cls, (left, right, get_unit(unit)))
|
||||
|
||||
def __iter__(self):
|
||||
yield self.left
|
||||
|
||||
@@ -572,8 +572,6 @@ def transform_mean_values_1d(
|
||||
values = abs2(values)
|
||||
new_axis, ind, ext = sort_axis(x_axis, plt_range)
|
||||
values = values[:, ind]
|
||||
if plt_range.unit.type == "WL" and plt_range.conserved_quantity:
|
||||
values = np.apply_along_axis(units.to_WL, -1, values, new_axis)
|
||||
|
||||
if isinstance(spacing, (float, np.floating)):
|
||||
tmp_axis = np.linspace(*span(new_axis), int(len(new_axis) / spacing))
|
||||
@@ -790,8 +788,6 @@ def transform_1D_values(
|
||||
values = abs2(values)
|
||||
new_axis, ind, ext = sort_axis(x_axis, plt_range)
|
||||
values = values[ind]
|
||||
if plt_range.unit.type == "WL" and plt_range.conserved_quantity:
|
||||
values = units.to_WL(values, units.m_rads(plt_range.unit(new_axis)))
|
||||
|
||||
if isinstance(spacing, (float, np.floating)):
|
||||
tmp_axis = np.linspace(*span(new_axis), int(len(new_axis) / spacing))
|
||||
@@ -891,9 +887,6 @@ def plot_spectrogram(
|
||||
|
||||
new_t = t_range.unit.inv(new_t)
|
||||
|
||||
if w_range.must_correct_wl:
|
||||
spec = np.apply_along_axis(units.to_WL, 1, spec, new_w)
|
||||
|
||||
if time_axis == 1:
|
||||
spec = spec.T
|
||||
x_axis = new_t
|
||||
|
||||
Reference in New Issue
Block a user