app: stacked_cores: minimize what we extrapolate from beyond the measured transfer domain

This commit is contained in:
2022-10-16 04:28:44 -07:00
parent 74858ee247
commit 226e4949d0
2 changed files with 22 additions and 10 deletions

View File

@@ -71,11 +71,19 @@ class Piecewise:
(x, y * scale) for (x, y) in self.xy
])
def clipped(self, min_: float = 0.00, max_: float = 1.0) -> 'Piecewise':
def clipped(self, min_y: float = 0.00, max_y: float = 1.0) -> 'Piecewise':
return Piecewise([
(x, min(max_, max(min_, y))) for (x, y) in self.xy
(x, min(max_y, max(min_y, y))) for (x, y) in self.xy
])
def flat_extrapolation(self) -> 'Piecewise':
""" make it so f(x) for x OOB returns the nearest in-bounds y """
first = self.xy[0]
last = self.xy[-1]
new_first = (first[0] - 1.0, first[1])
new_last = (last[0] + 1.0, last[1])
return Piecewise([new_first] + self.xy + [new_last])
def cascaded(self, second: 'Piecewise') -> 'Piecewise':
""" return a function equivalent to y = second(self(x)) """
b_min, b_max = extrema(x for (x, y) in self.xy)

View File

@@ -131,8 +131,10 @@ of_interest += [(p, get_meas(p)) for p in
# plot all viable inverters
of_interest += filter_meas(run="40")
# of_interest += filter_meas(run="40")
# of_interest += filter_meas(viable_inverter=True)
of_interest += filter_meas(rad_um=400, run="41")
# of_interest += filter_meas(run="40", rad_um=800, couplings=18, wrappings=5)
# of_interest += filter_meas(run="41", viable_inverter=True)
# of_interest += filter_meas(run="42", rad_um=400, couplings=4)
# of_interest += filter_meas(run="42", rad_um=400, couplings=9)
@@ -152,16 +154,18 @@ of_interest += filter_meas(run="40")
# of_interest += filter_meas(is_inverter=False)
# of_interest += filter_meas(is_inverter=True)
# of_interest.sort(key = lambda i: -i[1].max_abs_slope())
of_interest.sort(key = lambda i: -i[1].get_range()) # output range
of_interest.sort(key = lambda i: -i[1].max_abs_slope())
# of_interest.sort(key = lambda i: -i[1].get_range()) # output range
# of_interest.sort(key = lambda i: i[1].get(0.5) - i[1].get(1.0)) # delayed output swing
# of_interest.sort(key = lambda i: i[1].get(0.5) - i[1].get(0.0)) # early output swing
# of_interest.sort(key = lambda i: i[1].get_repeated(1.0) - i[1].get_repeated(0.0)) # inverter strength
for (params, curve) in of_interest[:5]:
for (params, curve) in of_interest[:10]:
curve = curve.flat_extrapolation()
curve.plot(title = f"{params.human_name} mapping")
curve.plot_slope(title = f"{params.human_name} slope")
# if not params.is_inverter:
# curve = curve.logically_inverted()
if params.is_inverter:
if not params.is_inverter:
curve = curve.logically_inverted()
if params.is_inverter or True:
curve.plot_equilibrium(title = f"{params.human_name} equilibrium")