Search code examples
pythonscipycurve-fittingmodel-fittingscipy.stats

How to use scipy.stats.maxwell to find temperature?


I have speed data of many particles to which I want to fit the Maxwellian curve. I am trying to use the fit method from scipy.stats.maxwell to fit to my data and extract the temperature of the system from that.

From the documentation, I am unable to put my finger on what the parameters that we are trying to fit exactly are and hence how they relate to temperature.


Solution

  • It's related to scale. You also likely want to set floc=0 in maxwell.fit(...)

    Cf the argument of the exponential: with non-zero scale it's -x**2 / scale**2 / 2, which you compare to the expected mv**2 / 2kT.