pynbody.analysis.theoretical_profiles.AbstractBaseProfile#

class pynbody.analysis.theoretical_profiles.AbstractBaseProfile[source]#

Bases: ABC

Base class to generate functional form of known profiles. The class is organised a dictionary: access the profile parameters through profile.keys().

To define a new profile, create a new class inheriting from this base class and define your own profile_functional() method. The static version can be handy to avoid having to create and object every time. As a example, the NFW functional is implemented.

A generic fitting function is provided. Given profile data, e.g. quantity as a function of radius, it uses standard least-squares to fit the given functional form to the data.

Methods

fit(radial_data, profile_data[, ...])

Fit profile data with a leastsquare method.

jacobian_profile_functional_static(radius, ...)

Analytical expression of the jacobian of the profile for more robust fitting.

keys

profile_functional

profile_functional_static

__init__()[source]#
classmethod fit(radial_data, profile_data, profile_err=None, use_analytical_jac=None, guess=None)[source]#

Fit profile data with a leastsquare method.

  • profile_err * Error bars on the profile data as a function of radius. Can be a covariance matrix.

  • guess * Provide a list of parameters initial guess for optimisation

abstract static jacobian_profile_functional_static(radius, **kwargs)[source]#

Analytical expression of the jacobian of the profile for more robust fitting.