HubbleXYZ

class grizli.utils.HubbleXYZ(spt_file='', param_dict={})[source]

Bases: object

Initialize the class instance.

Parameters
spt_filestr

Path to the spt file. If provided, the parameters will be parsed from the spt file.

param_dictdict

Dictionary containing the parameter values. If provided, the spt file will be ignored.

Attributes
param_dictdict

Dictionary containing the parameter values.

computeddict

Dictionary to store computed values.

Methods Summary

__call__(t_in, **kwargs)

Convert input time t_in to seconds since 1/1/85 and evaluate.

deltat(dt)

Convert a time t in seconds from 1/1/85 to an ISO time

evaluate(dt[, unit, as_table])

Evaluate equations to get positions

from_flt(flt_file, **kwargs)

Compute positions at expstart, expmid, expend.

parse_from_spt(spt_file)

Get orbital elements from SPT header

xyz_to_lonlat(self, x, y, z[, radians])

Compute sublon, sublat, alt from xyz coords with pyproj

Methods Documentation

__call__(t_in, **kwargs)[source]

Convert input time t_in to seconds since 1/1/85 and evaluate.

Parameters
t_inTime

Time(s) to convert to seconds since 1/1/85.

**kwargsdict, optional

Additional keyword arguments to pass to the evaluate method.

Returns
xyzdict

Dictionary containing the x, y, z, and r values.

deltat(dt)[source]

Convert a time t in seconds from 1/1/85 to an ISO time

Parameters
dtfloat

Time difference from the reference time in seconds.

Returns
iso_timestr

ISO formatted time string.

evaluate(dt, unit=None, as_table=False)[source]

Evaluate equations to get positions

Parameters
dtfloat or Time

Time difference(s) from the reference time in seconds.

unitstr, optional

Unit of the output coordinates. Default is None, which returns coordinates in kilometers.

as_tablebool, optional

If True, return the coordinates as an Table object. Default is False.

Returns
xfloat or Table

X-coordinate(s) in the specified unit.

yfloat or Table

Y-coordinate(s) in the specified unit.

zfloat or Table

Z-coordinate(s) in the specified unit.

rfloat or Table

Distance(s) from the origin in the specified unit.

from_flt(flt_file, **kwargs)[source]

Compute positions at expstart, expmid, expend.

Parameters
flt_filestr

Path to the FLT file.

**kwargsdict, optional

Additional keyword arguments to pass to the evaluate method.

Returns
xyzdict

Dictionary containing the x, y, z, and r values.

parse_from_spt(spt_file)[source]

Get orbital elements from SPT header

Parameters
spt_filestr

Path to the SPT file.

Returns
param_dictdict

Dictionary containing the orbital parameters parsed from the SPT header.

static xyz_to_lonlat(self, x, y, z, radians=False)[source]

Compute sublon, sublat, alt from xyz coords with pyproj

Parameters
xint

X-coordinate(s) in meters.

yint

Y-coordinate(s) in meters.

zint

Z-coordinate(s) in meters.

radiansbool, optional

If True, the output longitude and latitude will be in radians. If False, the output longitude and latitude will be in degrees. Default is False.

Returns
lonfloat or array-like

Longitude(s) in degrees or radians, depending on the value of radians.

latfloat or array-like

Latitude(s) in degrees or radians, depending on the value of radians.

altfloat or array-like

Altitude(s) in meters.