solarwindpy.fitfunctions.trend_fits.TrendFitο
- class TrendFit(agged, trendfunc, trend_logx=False, ykey1d='mu', wkey1d='sigma', ffunc1d=None)[source]ο
Bases:
object- __init__(agged, trendfunc, trend_logx=False, ykey1d='mu', wkey1d='sigma', ffunc1d=None)[source]ο
Note that TrendFit.make_1dfits must be called by the user.
So that any kwargs may be passed to the 1D make_fit method, which are passed to curve_fit, allowing the user to specify fit methods, bounds, etc.
Similarly, TrendFit.trend_fit.make_fit must be called by the user so that kwargs can be appropriately passed to curve_fit.
call signagure after instantiation is:
Set x and y labels: TrendFunc.set_labels(x=<x label>, y=<y label>)
Make the 1D fit functions: TrendFunc.make_ffunc1ds()
TrendFunc.make_1dfits(): Run 1D fits
TrendFunc.make_trend_func(): init trend function
TrendFunc.trend_func.make_fit(): run trend fits
- Parameters:
agged (pd.DataFrame) β x-values along the columns and y-values along the index.
trendfunc (fitfunctoins.FitFunction) β The function to fit the trend of the ffunc1d popts.
trend_logx (bool) β If True, take \(10.0^x\) for x-values passed to trendfunc_class.
ykey1d (str) β The keys to select y-values and weights from the 1D FitFunction`s for passing to the `FitFunction for fitting the trend.
wkey1d (str) β The keys to select y-values and weights from the 1D FitFunction`s for passing to the `FitFunction for fitting the trend.
ffunc1d (fitfunctoins.FitFunction or None) β Applied in each x-bin. If None, fitfunctions.Gaussian.
- property aggedο
- property ffunc1d_classο
FitFunctionto apply in each x-bin.
- property trendfunc_classο
FitFunctionto apply each popt.Of the ffunc1d along the x-axis.
- property ffuncsο
The 1D
FitFunctionapplied in each x-bin.
- property popt_1dο
Optimized parameters from 1D fits.
- property psigma_1dο
Fit uncertainties from 1D fits.
- property trend_funcο
trendfunc_class applied along the x-axis.
- property bad_fitsο
Bad 1D fits identifyied when running make_1dfits.
- property popt1d_keysο
- property trend_logxο
If True, trendβs x-axis is log-scaled.
Should probably change this to pull from trend_func somehow, but unsure how to do so.
- make_1dfits(**kwargs)[source]ο
Execute fits for all 1D functions.
Removes bad fits from ffuncs and saves them in bad_fits.
- Parameters:
**kwargs β Passed to each FitFunction.make_fit()
- plot_all_ffuncs(legend_title_fmt='%.0f', **kwargs)[source]ο
Plot all fit functions.
- Parameters:
legend_title_fmt (str) β A string template for formatting the legend titles. Use % formatting so we can easily instert TeX into legend_title_fmt should we desire.
kwargs β Passed to
ffunc.plot_raw_used_fit().
- make_trend_func(**kwargs)[source]ο
Make trend function.
- Parameters:
kwargs β passed to trendfunc_class(x, y, **kwargs)
- plot_all_popt_1d(ax=None, only_plot_data_in_trend_fit=False, plot_window=True, **kwargs)[source]ο
Plot all the 1D popt appropriate for identifying the trend on ax.
Plot all the 1D popt appropriate for identifying the trend on ax.
kwargs passed to ax.errorbar
- plot_trend_and_resid_on_ffuncs(trend_kwargs=None, fit1d_kwargs=None)[source]ο
Plot the trend fit on the 1D popt and the trend fit residuals.
- plot_1d_popt_and_trend(ax=None, **kwargs)[source]ο
Plot the trend and 1D popt, without trend residuals, on ax
Axis labels are shared between the trend_func and ffuncs.
Here, we update them according to placement in
trend_func(), but properly locating them forffuncs().- Parameters:
x β
trend_func()x-label. Maps toffuncs()legend label.y β
trend_func()y-label. Maps toffuncs()x-label.z β
trend_func()z-label. Maps toffuncs()y-label.