htrdrPy.helperFunctions module

htrdrPy.helperFunctions.cart2sphere(vec)[source]

Convert cartesian to spherical coordinates.

Parameters:

vec (numpy.ndarray) – Cartesian coordinate array (x [m], y [m], z [m]).

Returns:

Spherical coordinate array (altitude [m], latitude [°], longitude [°]).

Return type:

numpy.ndarray

htrdrPy.helperFunctions.combineEstimates(sumX, sumXsquare, numbers)[source]

Calculate the mean, the variance and the standard deviation of a set of estimates.

Parameters:
  • sumX (numpy.ndarray) – Array containing the sum of the Monte Carlo weights of a list of estimates.

  • sumXsquare (numpy.ndarray) – Array containing the sum of the square of the Monte Carlo weights of a list of estimates.

  • numbers (numpy.ndarray) – Array containing the number of realizations for each estimate.

Returns:

  • float – Mean of the combined estimates.

  • float – Variance of the combined estimates.

  • float – Standard deviation of the combined estimates.

htrdrPy.helperFunctions.dplanck_dT(T, wvl, r_d=False)[source]

Calculate the derivative of the planck emission regarding the temperature in W/m2/sr/m/K for a surface at temperature T and at wavelengths wvl.

Parameters:
  • T (float or numpy.ndarray) – Temperature or N-D array of temperatures [K] of the emiting surface.

  • wvl (float or numpy.ndarray) – Wavelength or 1-D array of wavelengths.

  • (optional (r_d) – Shape 2 array containing the source radius and distance, respectively. If not provided, returns the surface radiance, if given, returns the radiance received at that distance from the source.

  • (shape=(2) (1-D array) – Shape 2 array containing the source radius and distance, respectively. If not provided, returns the surface radiance, if given, returns the radiance received at that distance from the source.

  • [m])) (float) – Shape 2 array containing the source radius and distance, respectively. If not provided, returns the surface radiance, if given, returns the radiance received at that distance from the source.

Returns:

Radiance either at the surface of the source (if r_d not provided) or at the given distance from the source. The shape depends on the shape of the parameters provided. If both the T and wvl are floats, the result is a float. If T is a flaot and wvl an array, the result has the length of wvl. If T is an array and wvl is a float, the result has the shape of T. Finally, if both T and wvl are arrays (T has dimension N and wvl has dimension 1), the result has the N+1 dimensions (the N dimensions of T plus the dimension of wvl).

Return type:

float or M-D array (shape=(nWavelength), float [W/m2/sr/m]))

htrdrPy.helperFunctions.planck(T, wvl, r_d=False)[source]

Calculate planck emission in W/m2/sr/m for a surface at temperature T and at wavelengths wvl.

Parameters:
  • T (float or numpy.ndarray) – Temperature or N-D array of temperatures [K] of the emiting surface.

  • wvl (float or numpy.ndarray) – Wavelength or 1-D array of wavelengths.

  • (optional (r_d) – Shape 2 array containing the source radius and distance, respectively. If not provided, returns the surface radiance, if given, returns the radiance received at that distance from the source.

  • (shape=(2) (1-D array) – Shape 2 array containing the source radius and distance, respectively. If not provided, returns the surface radiance, if given, returns the radiance received at that distance from the source.

  • [m])) (float) – Shape 2 array containing the source radius and distance, respectively. If not provided, returns the surface radiance, if given, returns the radiance received at that distance from the source.

Returns:

Radiance either at the surface of the source (if r_d not provided) or at the given distance from the source. The shape depends on the shape of the parameters provided. If both the T and wvl are floats, the result is a float. If T is a flaot and wvl an array, the result has the length of wvl. If T is an array and wvl is a float, the result has the shape of T. Finally, if both T and wvl are arrays (T has dimension N and wvl has dimension 1), the result has the N+1 dimensions (the N dimensions of T plus the dimension of wvl).

Return type:

float or M-D array (shape=(nWavelength), float [W/m2/sr/m]))

htrdrPy.helperFunctions.sphere2cart(vec)[source]

Convert spherical to cartesian coordinates.

Parameters:

vec (numpy.ndarray) – Spherical coordinate array (altitude [m], latitude [°], longitude [°]).

Returns:

Cartesian coordinate array (x [m], y [m], z [m]).

Return type:

numpy.ndarray