Not ready yet, but opening this PR for discussion.
I added code to chose the k-range used in the fitting. Current is 0.5 < k / k_p < 2.0, but if we really want to use localized derivatives it would be better to use something like 0.95 < k / k_p < 1.05. Less than that is dangerous, I guess, since numpy might not have enough points to fit the polynomial.
The alternative could have been to provide the fixed alpha you want to use in the fit (when compressing at fixed alpha). Then the code would remove that curvature from the linear power and then fit a simple power law. I didn't implement this because the other was easier to do and to explain.
Not ready yet, but opening this PR for discussion.
I added code to chose the k-range used in the fitting. Current is 0.5 < k / k_p < 2.0, but if we really want to use localized derivatives it would be better to use something like 0.95 < k / k_p < 1.05. Less than that is dangerous, I guess, since numpy might not have enough points to fit the polynomial.
The alternative could have been to provide the fixed alpha you want to use in the fit (when compressing at fixed alpha). Then the code would remove that curvature from the linear power and then fit a simple power law. I didn't implement this because the other was easier to do and to explain.