utils Package

utils Package

Created on Feb 20, 2015

author: jakeret

hide.utils.arccos(x)[source]
hide.utils.parse_datetime(s)[source]
hide.utils.sin_cos(x)[source]

quaternion Module

class hide.utils.quaternion.Rotator(q)[source]

Bases: object

Quaternion based rotator implementation for theta, phi

class hide.utils.quaternion.VecRotator(q)[source]

Bases: object

Quaternion based rotator implementation for theta, phi

hide.utils.quaternion.inv(q)[source]

Inverse of quaternion array q

hide.utils.quaternion.mult(p, q)[source]

Multiply arrays of quaternions, ndarray objects with 4 columns defined as x y z w see: http://en.wikipedia.org/wiki/Quaternions#Quaternions_and_the_geometry_of_R3

hide.utils.quaternion.norm(q)[source]

Normalize quaternion array q to unit quaternions

hide.utils.quaternion.power(q, t)[source]

raise quaternion to the power of t

hide.utils.quaternion.rotate_vec(q, v)[source]

Rotate or array of vectors v by quaternion q

hide.utils.quaternion.rotate_vec_opt(q, v)[source]

Rotate or array of vectors v by quaternion q

hide.utils.quaternion.rotate_vec_slow(q, v)[source]

Rotate or array of vectors v by quaternion q

hide.utils.quaternion.slerp(q, r, t)[source]

spherical linear interpolation between q and r by t

hide.utils.quaternion.toAxisAngle(q)[source]
hide.utils.quaternion.vecquad(x, y, z, w)[source]

create a quaternion from a euler vector with angle

signal Module

Created on Nov 10, 2015

author: jakeret

hide.utils.signal.noisegen(beta=0, N=8192)[source]

Noise will be generated that has spectral densities that vary as powers of inverse frequency, more precisely, the power spectra P(f) is proportional to 1 / fbeta for beta >= 0. When beta is 0 the noise is referred to white noise, when it is 2 it is referred to as Brownian noise, and when it is 1 it normally referred to simply as 1/f noise which occurs very often in processes found in nature.

The basic method involves creating frequency components which have a magnitude that is generated from a Gaussian white process and scaled by the appropriate power of f. The phase is uniformly distributed on 0, 2pi.

from http://paulbourke.net/fractals/noise/

Parameters:
  • beta
  • N – number of samples (can also be shape of array)
Returns out:

the sampled noise

sphere Module

Created on Dec 22, 2014

author: jakeret

class hide.utils.sphere.ArcKDTree(theta, phi)[source]

Bases: object

Wraps the scipy.spatial.cKDTree such that the tree can be used with spherical coords

query(theta, phi, k=1, eps=0, p=2, distance_upper_bound=inf)[source]

Query the kd-tree for nearest neighbors using theta, phi :param theta: :param phi: :param k: :param eps: :param p: :param distance_upper_bound:

Returns d, i:The distances to the nearest neighbors, the locations of the neighbors in self.data.
query_ball_point(theta, phi, r, eps=0)[source]
hide.utils.sphere.altaz_to_ra_dec(date, az, alt, obs=None, ctx=None)[source]
hide.utils.sphere.dec2theta(dec)[source]
hide.utils.sphere.dir2vec(theta, phi)[source]

converts angle to vector

hide.utils.sphere.get_observer(ctx)[source]
hide.utils.sphere.phi2ra(phi)[source]
hide.utils.sphere.ra2phi(ra)[source]
hide.utils.sphere.radec_to_altaz(date, ra, dec, obs=None, ctx=None)[source]
hide.utils.sphere.rotate_map(Map, rotator, mask=None)[source]

Map is map in system A rotator is rotator from system B to A mask is a mask in system B returns new map in system B

hide.utils.sphere.separation(d1, a1, d2, a2)[source]

great circle distance http://en.wikipedia.org/wiki/Great-circle_distance#Computational_formulas

Parameters:
  • d1 – dec 1
  • a1 – ra 1
  • d2 – dec 2

:param a2:ra 2

hide.utils.sphere.theta2dec(theta)[source]
hide.utils.sphere.vec2dir(vec)[source]

converts vector to angles