Functions#

General functions#

SpinWaveToolkit.distBE(w, temp=300, mu=-6.626070145940079e-22)#

Returns Bose-Einstein distribution for given chemical potential and temperature.

Parameters:
wfloat

(rad Hz) angular frequency.

tempfloat
  1. temperature.

mufloat
  1. chemical potential.

Returns:
BEdistfloat or ndarray

Bose-Einstein distribution in dependance to frequency.

SpinWaveToolkit.wavenumber2wavelength(wavenumber)#

Convert wavelength to wavenumber. lambda = 2*pi/k

Parameters:
wavenumberfloat or array_like

(rad/m) wavenumber of the wave.

Returns:
wavelengthfloat or ndarray
  1. corresponding wavelength.

SpinWaveToolkit.wavelength2wavenumber(wavelength)#

Convert wavenumber to wavelength. k = 2*pi/lambda

Parameters:
wavelengthfloat or array_like
  1. wavelength of the wave.

Returns:
wavenumberfloat or ndarray

(rad/m) wavenumber of the corresponding wavelength.

SpinWaveToolkit.wrapAngle(angle)#

Wrap angle in radians to range [0, 2*np.pi).

Parameters:
anglefloat or array_like

(rad) angle to wrap.

Returns:
wrapped_anglefloat or ndarray

(rad) angle wrapped to [0, 2*np.pi).

SpinWaveToolkit.roots(f, a, b, dx=0.001, eps=1e-09, args=())#

Find all roots of a continuous function f(x, *args) within a given interval [a, b].

Detects all roots spaced at least by dx with a precision given by eps.

For optimal performance, normalize dx and eps to the scale of your input. In case it didn’t find all expected roots, try decreasing dx, but note that it can extend the calculation time significantly.

Parameters:
fcallable()

Function to evaluate with signature f(x, *args).

a, bfloat

(x units) left and right boundaries of the interval to search.

dxfloat

(x units) stepsize of evaluation points (coarse search).

epsfloat, optional

(x units) tolerance of the to-be-found roots (fine search).

argslist, optional

List of arguments to be passed to f.

Returns:
xslist[float]

(x units) list of all found roots.

See also

bisect, rootsearch