pomme.utils module¶
- pomme.utils.convert_angular_to_spatial(angle, distance)¶
Convert angles to distances assuming a certain distance.
- Parameters:
angle (astropy.units.Quantity) – Angle to convert.
distance (astropy.units.Quantity) – Distance to assume.
- Returns:
out – Distance corresponding to the angle at the given distance.
- Return type:
astropy.units.Quantity
- pomme.utils.get_molar_mass(compound: str, decimal_places=None) float¶
Compute the molar mass based on a chemical formula. Adapted from https://gist.github.com/elibroftw/22e3b4c1eb7fa0a6c83d099d24200f95
- Parameters:
compound (str) – Chemical formula to compute the molar mass of.
decimal_places (int) – Number of decimal places to round the molar mass to.
- Returns:
out – Molar mass of the compound.
- Return type:
float
- pomme.utils.interpolate(inp, size, mode='nearest')¶
Interpolate a tensor to a new size.
- Parameters:
inp (torch.Tensor) – Input tensor to interpolate.
size (tuple) – New size of the tensor.
mode (str) – Interpolation mode.
- Returns:
out – Interpolated tensor.
- Return type:
torch.Tensor
- pomme.utils.planck(temperature, frequency)¶
Planck function for thermal radiation.
- Parameters:
temperature (float) – Temperature at which to evaluate the intensity.
frequency (float) – Frequency at which to evaluate the intensity.
- Returns:
out – Planck function evaluated at the frequency for the given temperature.
- Return type:
float
- pomme.utils.print_var(name, var)¶
Print the min, mean, and max of a PyTorch tensor variable.
- Parameters:
name (str) – Name of the variable.
var (torch.Tensor) – Variable to print the min, mean, and max of.
- Returns:
out
- Return type:
None