Create DensityFit objects that can be called as functions to interpolate density
Enable beam_me_up to accept either the name of a DensityFit, a pre-constructed DensityFit, or any function that can act like one. Adds a new argument density_fit_method to support this. The existing argument density_fit_parameters still works, and still looks up the method based on the length of this array.
The DensityFit base class basically just handles zeroing the density outside of poloidal_flux_enter. This means the derived classes only need to handle the fitting. This is done through having a private method _fit_impl ("impl" is a standard abbreviation for "implementation") that the base class calls. The magic method __call__ allows instances to be called like functions.
These changes don't touch the actual uses of find_density_1D -- as far as the rest of the code is concerned, this is still the same thing.
Make density fitting more flexible:
DensityFit
objects that can be called as functions to interpolate densitybeam_me_up
to accept either the name of aDensityFit
, a pre-constructedDensityFit
, or any function that can act like one. Adds a new argumentdensity_fit_method
to support this. The existing argumentdensity_fit_parameters
still works, and still looks up the method based on the length of this array.The
DensityFit
base class basically just handles zeroing the density outside ofpoloidal_flux_enter
. This means the derived classes only need to handle the fitting. This is done through having a private method_fit_impl
("impl" is a standard abbreviation for "implementation") that the base class calls. The magic method__call__
allows instances to be called like functions.These changes don't touch the actual uses of
find_density_1D
-- as far as the rest of the code is concerned, this is still the same thing.