hscmap.vec3 module

class hscmap.vec3.SkyCoord(ra, dec)[source]

Bases: object

This class represents a position on the celestial sphere. The position is represented by right ascension and declination.

Parameters:
ra: Angle
dec: Angle
as_vec3()[source]

Convert the position to a Vec3.

Return type:

Vec3

classmethod from_degree(ra, dec)[source]
Parameters:
  • ra (float) –

  • dec (float) –

Return type:

SkyCoord

classmethod from_radian(ra, dec)[source]
Parameters:
  • ra (float) –

  • dec (float) –

Return type:

SkyCoord

classmethod from_vec3(vec)[source]
Parameters:

vec (Vec3) –

Return type:

SkyCoord

class hscmap.vec3.Vec3(x, y, z)[source]

Bases: object

This class represents a 3D vector. Operator overloading is implemented for addition, subtraction, multiplication, division, negation, and absolute value.

a = Vec3(1, 2, 3)
b = Vec3(4, 5, 6)
c = a + b  # c = Vec3(5, 7, 9)
d = a - b  # d = Vec3(-3, -3, -3)
e = a * 2  # e = Vec3(2, 4, 6)
f = 2 * a  # f = Vec3(2, 4, 6)
g = a / 2  # g = Vec3(0.5, 1, 1.5)
h = -a  # h = Vec3(-1, -2, -3)
i = abs(a)  # i = 3.7416573867739413
Parameters:
  • x (float) –

  • y (float) –

  • z (float) –

x: float
y: float
z: float
normalize()[source]

Return a normalized vector.

Return type:

Vec3

dot(other)[source]

Return the dot product of this vector and other.

Parameters:

other (Vec3) –

Return type:

float

cross(other)[source]

Return the cross product of this vector and other.

Parameters:

other (Vec3) –

Return type:

Vec3

angle(other)[source]

Return the angle between this vector and other.

Parameters:

other (Vec3) –

Return type:

Angle

as_tuple()[source]
Return type:

Tuple[float, float, float]

as_list()[source]
Return type:

List[float]

hscmap.vec3.as_vec3(position)[source]

Convert position to a Vec3.

Parameters:

position (SkyCoord | Vec3) –

hscmap.vec3.as_sky_coord(position)[source]

Convert position to a SkyCoord.

Parameters:

position (SkyCoord | Vec3) –