conversion

Useful conversion functions between various physical values or representations.

kete.conversion.bin_data(data, bin_size=2, method='mean')

Bin data, reducing the size of a matrix.

Parameters:
  • data – 2 dimensional array of data to be reduced.

  • bin_size – Binning size, binning of data is applied to both directions of the data. If the bin size is not a multiple of the shape of the data, the data is trimmed until it is.

  • method – Which function is used to produce a single final value from the bins. This includes ‘mean’, ‘median’, ‘min’, ‘max’. NANs are ignored.

kete.conversion.compute_airmass(zenith_angle)

Compute the approximate air-mass above the observer given the zenith angle.

Algorithm from: Andrew T. Young, “Air mass and refraction,” Appl. Opt. 33, 1108-1110 (1994)

Parameters:

zenith_angle (float) – True zenith angle in degrees.

Return type:

float

kete.conversion.compute_albedo(diameter, h_mag, c_hg=1329.0)

Compute the albedo of the object given the diameter in km and H magnitude.

Parameters:
  • diameter (ndarray[Any, dtype[_ScalarType_co]]) – The diameter of the object in Km.

  • h_mag (ndarray[Any, dtype[_ScalarType_co]]) – The H magnitude of the object.

Return type:

ndarray

kete.conversion.compute_aphelion(peri_dist, ecc)

Calculate aphelion, returning nan when it cannot be computed.

Parameters:
  • peri_dist (ndarray[Any, dtype[_ScalarType_co]]) – Perihelion distance in units of AU.

  • ecc (ndarray[Any, dtype[_ScalarType_co]]) – Eccentricity of the orbit.

Return type:

ndarray

kete.conversion.compute_diameter(albedo, h_mag, c_hg=1329.0)

Compute the diameter of the object in km given the albedo and H magnitude.

Parameters:
  • albedo (ndarray[Any, dtype[_ScalarType_co]]) – The albedo of the object.

  • h_mag (ndarray[Any, dtype[_ScalarType_co]]) – The H magnitude of the object.

Return type:

ndarray

kete.conversion.compute_earth_radius(geodetic_latitude)

Compute the effective Earth’s radii at the specified geodetic latitude assuming that the Earth is an oblate spheroid.

Returns the radii in units of AU.

Parameters:

geodetic_latitude (float) – The geodetic latitude in degrees.

Return type:

float

kete.conversion.compute_eccentric_anomaly(eccentricity, mean_anomaly, peri_dist)

Solve Kepler’s equation for the eccentric anomaly.

Parameters:
  • eccentricity (ndarray[Any, dtype[_ScalarType_co]]) – The eccentricity of the orbit, greater than or equal to 0.

  • mean_anomaly (ndarray[Any, dtype[_ScalarType_co]]) – The mean anomaly of the orbit in degrees.

  • peri_dist (ndarray[Any, dtype[_ScalarType_co]]) – The perihelion distance, only required for parabolic objects. (Units of AU).

Return type:

ndarray

kete.conversion.compute_h_mag(diameter, albedo, c_hg=1329.0)

Compute the H magnitude of the object given the diameter in km and the albedo.

Parameters:
  • diameter (ndarray[Any, dtype[_ScalarType_co]]) – The diameter of the object in Km.

  • albedo (ndarray[Any, dtype[_ScalarType_co]]) – The albedo of the object.

Return type:

ndarray

kete.conversion.compute_semi_major(peri_dist, ecc)

Calculate semi major axis, returning nan when it cannot be computed.

Parameters:
  • peri_dist (ndarray[Any, dtype[_ScalarType_co]]) – Perihelion distance in units of AU.

  • ecc (ndarray[Any, dtype[_ScalarType_co]]) – Eccentricity of the orbit.

Return type:

ndarray

kete.conversion.compute_tisserand(semi_major, ecc, inclination, perturbing_semi_major=5.2038)

Compute Tisserand’s Parameter, the default perturbing body is set to Jupiter.

See: https://en.wikipedia.org/wiki/Tisserand%27s_parameter

Note that if the inclination is not computed with respect to the perturbing body that this computation will not be correct. However, Jupiter only has an inclination of 1.3 degrees with respect to the Ecliptic plane, which will only introduce a very small error if the input inclination is w.r.t. the Ecliptic plane.

Parameters:
  • semi_major (float) – Semi Major axis of small body, in units of AU.

  • ecc (float) – Eccentricity of the small body.

  • inclination (float) – Inclination of the small body with respect to the perturbing body, in units of Degrees.

  • perturbing_semi_major (float) – Semi major axis of the parent body, in units of AU.

kete.conversion.dec_degrees_to_dms(dec)

Convert a declination in degrees to a “degrees arcminutes arcseconds” string.

Parameters:

dec (ndarray[Any, dtype[_ScalarType_co]]) – Declination in decimal degrees.

Return type:

str | list[str]

kete.conversion.dec_dms_to_degrees(dec)

Convert a declination from “degrees arcminutes arcseconds” string to degrees.

This must be formatted with a space between the terms.

Parameters:

dec (str) – Declination in degrees-arcminutes-arcseconds.

Return type:

float

kete.conversion.flux_to_mag(flux, zero_point=3631)

Convert flux in Jy to AB Magnitude, assuming it is a single frequency source. Note that this assumes that the band is infinitely narrow.

See: https://en.wikipedia.org/wiki/AB_magnitude

Parameters:
  • flux (float) – Flux in Jy.

  • zero_point – Flux in Jy where the magnitude is zero.

Return type:

float

kete.conversion.mag_to_flux(mag, zero_point=3631)

Convert AB Magnitude to flux in Jy, assuming it is a single frequency source. Note that this assumes that the band is infinitely narrow.

See: https://en.wikipedia.org/wiki/AB_magnitude

Parameters:
  • mag (float) – AB Magnitude.

  • zero_point – Flux in Jy where the magnitude is zero.

Return type:

float

kete.conversion.ra_degrees_to_hms(ra)

Convert a Right Ascension in decimal degrees to an “hours minutes seconds” string.

Parameters:

ra (ndarray[Any, dtype[_ScalarType_co]]) – Right Ascension in decimal degrees.

Return type:

str | list[str]

kete.conversion.ra_hms_to_degrees(ra)

Convert a right ascension from “hours minutes seconds” string to degrees.

This must be formatted with a space between the terms.

Parameters:

ra (str) – Right ascension in hours-minutes-seconds.

Return type:

float