Curves module¶
Curves.
-
physicslab.curves.
black_body_radiation
(frequency, T)[source]¶ UNIT = W/sr/m^2/Hz
To express the law per unit wavelength, input
frequency = c / wavelength
(UNIT = W/sr/m^3).- Parameters
frequency (numpy.ndarray) –
T (float) – Temperature
- Returns
Spectral radiance
- Return type
-
physicslab.curves.
gaussian_curve
(x, expected_value, variance, amplitude=None, zero=0)[source]¶ Gauss curve function of given parameters.
- Parameters
x (numpy.ndarray) – Free variable
expected_value (float) – Center
variance (float) – Variance (not FWHM)
amplitude (float, optional) – Amplitude (value at maximum relative to the baseline). None normalize as probability, defaults to None
zero (int) – Baseline, defaults to 0
- Returns
Gaussian curve values
- Return type
-
physicslab.curves.
gaussian_curve_FWHM
(variance)[source]¶ Find FWHM from variance of a Gaussian curve.
-
physicslab.curves.
spontaneous_magnetization
(T, M0, TC, a, b, zero)[source]¶ An empirical interpolation of the low temperature and the critical temperature regimes.
- Parameters
- Returns
Magnetization
- Return type
-
physicslab.curves.
magnetic_hysteresis_branch
(H, saturation, remanence, coercivity, rising_branch=True)[source]¶ One branch of magnetic hysteresis loop.
- Parameters
H (numpy.ndarray) – external magnetic field strength.
saturation (float) – \(max(B)\)
remanence (float) – \(B(H=0)\)
coercivity (float) – \(H(B=0)\)
rising_branch (bool, optional) – Rising (True) or falling (False) branch, defaults to True
- Raises
ValueError – If saturation is negative or zero
ValueError – If remanence is negative
ValueError – If coercivity is negative
ValueError – If remanence is greater than saturation
- Returns
Resulting magnetic field induction \(B\)
- Return type
-
physicslab.curves.
magnetic_hysteresis_loop
(H, saturation, remanence, coercivity)[source]¶ Magnetic hysteresis loop.
If more control is needed, use
magnetic_hysteresis_branch()
. To check whether the data starts with rising or falling part, first and middle element are compared.- Parameters
H (numpy.ndarray) – external magnetic field strength. The array is split in half for individual branches.
saturation (float) – \(max(B)\)
remanence (float) – \(B(H=0)\)
coercivity (float) – \(H(B=0)\)
- Returns
Resulting magnetic field induction \(B\)
- Return type
-
class
physicslab.curves.
Line
(constant=0, slope=0)[source]¶ Represents a line function: \(y=a_0+a_1x\).
Call the instance to enumerate it at the given x. You can do arithmetic with
Line
, find zeros, etc.- Parameters
-
__call__
(x)[source]¶ Find function values of self.
- Parameters
x (numpy.ndarray) – Free variable
- Returns
Function value
- Return type
-
zero
()[source]¶ Find free variable (x) value which evaluates to zero.
- Raises
ValueError – If slope is zero.