ssapy.utils

This module provides functions for coordinate transformations, vector operations, celestial mechanics, and mathematical utilities.

Functions

altitude_to_zenithangle(altitude[, deg])

Convert altitude angle to zenith angle.

cart2sph_deg(x, y, z)

Convert Cartesian coordinates to spherical coordinates in degrees.

cart_to_cyl(x, y, z)

Convert Cartesian coordinates to cylindrical coordinates.

catalog_to_apparent(ra, dec, t[, observer, ...])

Convert ra/dec of stars from catalog positions (J2000/ICRS) to apparent positions, correcting for proper motion, parallax, annual and diurnal aberration.

cluster_emcee_walkers(chain, lnprob, lnprior)

Down-select emcee walkers to those with the largest posterior mean.

continueClass(cls)

Re-open the decorated class, adding any new definitions into the original. For example: .. code-block:: python class Foo: pass @continueClass class Foo: def run(self): return None is equivalent to: .. code-block:: python class Foo: def run(self): return None .. warning:: Python's built-in super function does not behave properly in classes decorated with continueClass. Base class methods must be invoked directly using their explicit types instead.

dd_to_dms(degree_decimal)

Converts a Decimal Degree (DD) value to Degree-Minute-Second (DMS) format.

dd_to_hms(degree_decimal)

Converts Decimal Degrees (DD) to Hour-Minute-Second (HMS) format.

deg0to360(array_)

Normalize angles in degrees to the range [0, 360].

deg0to360array(array_)

Normalize an array of angles in degrees to the range [0, 360].

deg90to90(val_in)

Normalize angles to the range [-90, 90].

deg90to90array(array_)

Normalize an array of angles to the range [0, 90].

dms_to_dd(dms)

Converts coordinates from Degree-Minute-Second (DMS) format to Decimal Degrees (DD).

dms_to_deg(coords)

Convert coordinates from degrees, minutes, and seconds (DMS) format to decimal degrees.

dms_to_rad(coords)

Convert coordinates from degrees, minutes, and seconds (DMS) format to radians.

ecliptic_to_equatorial(lon, lat[, degrees])

Convert ecliptic coordinates (longitude, latitude) to equatorial right ascension (RA) and declination (DEC).

ecliptic_xyz_to_equatorial(xc, yc, zc[, xe, ...])

Convert ecliptic Cartesian coordinates (X, Y, Z) to equatorial right ascension (RA) and declination (DEC).

ecliptic_xyz_to_equatorial_xyz(xc, yc, zc)

Convert ecliptic rectangular coordinates (X, Y, Z) to equatorial rectangular coordinates.

einsum_norm(a[, indices])

Compute the norm of an array using Einstein summation notation with customizable indices.

equatorial_to_ecliptic(right_ascension, ...)

Convert equatorial coordinates (RA, DEC) to ecliptic longitude and latitude.

equatorial_to_horizontal(observer_latitude, ...)

Convert equatorial coordinates (declination and either right ascension or hour angle) to horizontal coordinates (azimuth and altitude) for a given observer's latitude.

equatorial_xyz_to_ecliptic_xyz(xq, yq, zq)

Convert equatorial rectangular coordinates (X, Y, Z) to ecliptic rectangular coordinates.

find_all_zeros(f, low, high[, n])

Attempt to find all zeros of a function between given bounds.

find_extrema_brackets(fs)

Find triplets bracketing extrema from an ordered set of function evaluations.

find_file(filename[, ext])

Find a file in the current directory or the ssapy datadir.

gcrf_to_teme(t)

Return the rotation matrix that converts GCRS cartesian coordinates to TEME cartesian coordinates.

get_angle(a, b, c)

Calculate the angle between two vectors where b is the vertex of the angle.

get_kernel_cov(kernel_mat, weights)

Get the covariance matrix of kernel_mat.

get_normed_weights(ln_weights)

Computes normalized weights from log-weights.

hms_to_dd(hms)

Converts Hour-Minute-Second (HMS) format to Decimal Degrees (DD).

horizontal_to_equatorial(observer_latitude, ...)

Convert horizontal coordinates (azimuth and altitude) to equatorial coordinates (hour angle and declination).

iers_interp(t)

Interpolate IERS values

inert2rot(x, y, xe, ye[, xs, ys])

Transform inertial coordinates to rotated coordinates relative to the Earth.

interpolate_points_between(r, m)

Interpolates points between the given points.

isAttributeSafeToTransfer(name, value)

Return True if an attribute is safe to monkeypatch-transfer to another class.

lb_to_tan(lb, b[, mul, mub, lcen, bcen])

Convert lb-like coordinates & proper motions to orthographic tangent plane.

lb_to_tp(lb, b)

Convert lb-like coordinates to theta-phi like coordinates.

lb_to_unit(r, d)

Convert lb-like coordinates to unit vectors.

lonlat_distance(lat1, lat2, lon1, lon2)

Calculate the great-circle distance between two points on Earth's surface using the Haversine formula.

moonPos(t)

Compute GCRF position of the moon.

newton_raphson(guess, f[, fprime, eps, maxiter])

Find a root of a univariate function with known gradient using Newton-Raphson iterations.

norm(arr)

Compute the Euclidean norm of an array over the last axis while preserving leading axes.

normSq(arr)

Compute the squared norm of an array over the last axis while preserving leading axes.

normed(arr)

Normalize an array along the last axis to have unit length.

ntw_to_r(r, v, ntw[, relative])

Convert NTW coordinates to cartesian coordinates, using r, v to define NTW system.

num_wraps(ang)

Return number of times angle ang has wrapped around.

ra_dec([r, v, x, y, z, vx, vy, vz, r_earth, ...])

Calculate the Right Ascension (RA) and Declination (Dec) of an object relative to Earth's position.

rad0to2pi(angles)

Normalize angles in radians to the range [0, 2π].

regularize_default(particles, weights[, ...])

Perform particle regularization.

resample(particles, ln_weights[, obs_times, pod])

Resample particles to achieve more uniform weights.

rightascension_to_hourangle(right_ascension, ...)

Convert right ascension to hour angle.

rv_to_ntw(r, v, rcoord)

Convert coordinates to NTW coordinates, using r, v to define NTW system.

sample_points(x, C, npts[, sqrt])

Sample points around x according to covariance matrix.

sigma_points(f, x, C[, scale, fixed_dimensions])

Compute f(sigma points) for sigma points of C around x.

sim_lonlatrad(x, y, z, xe, ye, ze, xs, ys, zs)

Simulate longitude, latitude, and radius in a geocentric frame with the Sun at (0, 0).

subsample_high_lnprob(chain, lnprob, ...[, ...])

Select MCMC samples with probabilities above some relative threshold

sunPos(t[, fast])

Compute GCRF position of the sun.

sun_ra_dec(time_)

Calculate the Right Ascension (RA) and Declination (Dec) of the Sun at a given time.

tan_to_lb(xx, yy, lcen, bcen)

Convert orthographic tangent plane coordinates to lb coordinates.

teme_to_gcrf(t)

Return the rotation matrix that converts TEME cartesian coordinates to GCRS cartesian coordinates.

tp_to_lb(t, p)

Convert theta-phi-like coordinates to lb-like coordinates.

tp_to_unit(t, p)

Convert theta-phi-like coordinates to unit vectors.

unitAngle3(r1, r2)

Robustly compute angle between unit vectors r1 and r2.

unit_to_lb(unit)

Convert unit vectors to lb-like coordinates.

unit_to_tp(unit)

Convert unit vectors to theta-phi-like coordinates.

unit_vector(vector)

Returns the unit vector of the vector.

unscented_transform_mean_covar(f, x, C[, scale])

Compute mean and covariance matrix using unscented transform given a transformation f, a point x, and a covariance C.

xyz_to_ecliptic(xc, yc, zc[, xe, ye, ze, ...])

Convert rectangular coordinates (X, Y, Z) to ecliptic longitude and latitude.

xyz_to_equatorial(xq, yq, zq[, xe, ye, ze, ...])

Convert rectangular coordinates (X, Y, Z) to equatorial right ascension (RA) and declination (DEC).

xyz_to_lb(x, y, z)

Convert x, y, z vectors to lb-like coordinates.

xyz_to_tp(x, y, z)

Convert x, y, z vectors to theta-phi-like coordinates.

zenithangle_to_altitude(zenith_angle[, deg])

Convert zenith angle to altitude angle.

Classes

LRU_Cache(user_function[, maxsize])

Simplified Least Recently Used Cache.

Time(val[, val2, format, scale, precision, ...])

Represent and manipulate times and dates for astronomy.

lazy_property(fget)

meant to be used for lazy evaluation of an object attribute.

Class Inheritance Diagram

Inheritance diagram of ssapy.utils.LRU_Cache, ssapy.utils.lazy_property