docs: def dynamical_potential(xdata, dt, order=3):
      """
      Computes potential from spring function
  
      Parameters
      ----------
      xdata : ndarray
          Position data for a degree of freedom,
          at which to calculate potential
      dt : float
          time between measurements
      order : int
          order of polynomial to fit
  
      Returns
      -------
      Potential : ndarray
          valued of potential at positions in
          xdata
  
      """
      import numpy as np
      adata = CalcAcceleration(xdata, dt)
      xdata = xdata[2:] # removes first 2 values as differentiating twice means
      # we have acceleration[n] corresponds to position[n-2]
      
      z=np.polyfit(xdata,adata,order)
      p=np.poly1d(z)
      spring_pot=np.polyint(p)
      return -spring_pot