pwl3_flatend
- PlasmaCalcs.addons.instability_tools.instability_data_tools.pwl3_flatend(xx, b0, m0, end0, m1, end1add)
evaluate xx at piecewise linear function with 3 pieces, with final piece slope=0.
xx: 1D array. Assumed to be monotonically increasing.
b0: y-intercept of piece 0m0: slope of piece 0end0: “index” of end of piece 0if end0 is not an int, does weighted averaging of xx[floor(end0)] and xx[ceil(end0)].E.g. end0 = 10.25 –> extend piece 0 to xx[10] + 0.25 * (xx[11] - xx[10])m1: slope of piece 1end1add: “index” of end of piece 1, minus end0.end1 = end0 + end1add. (max=len(xx)-1)if end1 is not an int, handle similarly to end0 (see above).b2 is computed based on the other inputs.This is a decent approx. for ln(val) with linear growth, then damped linear growth, then saturation.xx <–> timeb0 <–> pre-growth noise levelm0 <–> growth rate of linear growthend0 <–> “damped index” when linear growth stops.x0 <–> “damped time” when linear growth stops, where:x0 = xx[i0] + (end0 - i0) * (xx[i0+1] - xx[i0], where i0 = int(end0).y0 <–> pre-damped-growth level, where:y0 = m0 * x0 + b0.(–> damped growth piece has y-intercept b1 = y0 - m1 * x0.)m1 <–> growth rate of damped linear growthend1 <–> “saturation index” when damped growth stops, where:end1 = end0 + end1addx1 <–> “saturation time” when damped growth stops, where:x1 = xx[i1] + (end1 - i1) * (xx[i1+1] - xx[i1], where i1 = int(end1).y1 <–> “saturation level”; value when saturated, where:y21= m1 * x1 + b1.