xopto.materials.density.base module¶
- class Density(t=293, trange: Optional[Tuple[float, float]] = None)[source]¶
Bases:
object
Base class of material density.
- Parameters
t (float) – Default medium temperature.
trange (Tuple[float, float] or None) – Valid temperature range in K as (min, max).
- check_temperature(t: float)[source]¶
Checks if the temperature of medium is within the valid range.
- Parameters
temperature (float or np.ndarray) – Temperature(s) to check.
Note
Reports a warning if the temperature of the medium is not within the valid range. If the temperature input argument is a numpy array, the call reports a warning if any of the temperatures are not within the valid range.
- is_valid_temperature(temperature: float) → bool[source]¶
Checks if the temperature of the medium is within the valid range.
- Parameters
temperature (float or np.ndarray) – Temperature to check.
- Returns
valid – Returns True if the temperature is within the valid range. If the temperature input argument is a numpy array, the call returns True only if all the temperatures are within the valid range.
- Return type
bool
- plot(**kwargs)[source]¶
Plot the temperature dependence of the density.
- Parameters
kwargs (dict) – Keyword arguments passed to the __call__ method of the instance.
- property t: float¶
Default temperature of the material in K.
- property temperature: float¶
Default temperature of the material in K.
- property trange: Tuple[float, float]¶
Valid temperature range in K.