ast2000tools.utils

Module containing various utility functions.

Functions

AU_pr_yr_to_m_pr_s(AU_pr_yr)

Converts a given speed from astronomical units per year to meters per second.

AU_to_km(AU)

Converts a given distance from astronomical units to kilometers.

AU_to_m(AU)

Converts a given distance from astronomical units to meters.

check_for_newer_version([verbose])

Informs about whether a newer version of ast2000tools than the one currently installed is available.

day_to_s(day)

Converts a given time from days to seconds.

day_to_yr(day)

Converts a given time from days to years.

deg_to_rad(deg)

Converts a given angle from degrees to radians.

get_seed(username)

Turns a username into a 5-digit seed.

kg_to_m(kg)

Converts a given mass from kilograms to meters.

km_to_AU(km)

Converts a given distance from kilometers to astronomical units.

m_pr_s_to_AU_pr_yr(m_pr_s)

Converts a given speed from meters per second to astronomical units per year.

m_to_AU(m)

Converts a given distance from meters to astronomical units.

m_to_kg(m)

Converts a given mass from meters to kilograms.

rad_to_deg(rad)

Converts a given angle from radians to degrees.

s_to_day(s)

Converts a given time from seconds to days.

s_to_yr(s)

Converts a given time from seconds to years.

yr_to_day(yr)

Converts a given time from years to days.

yr_to_s(yr)

Converts a given time from years to seconds.

ast2000tools.utils.check_for_newer_version(verbose=False)

Informs about whether a newer version of ast2000tools than the one currently installed is available.

Parameters

verbose (bool, optional) – Whether to print a confirmation message when the package is up to date. Default is False.

Raises

RuntimeError – When ast2000tools is not installed through pip.

ast2000tools.utils.get_seed(username)

Turns a username into a 5-digit seed.

Parameters

username (str) – Your username.

Returns

The 5-digit integer you should use as a seed.

Return type

int

ast2000tools.utils.yr_to_s(yr)

Converts a given time from years to seconds.

Parameters

yr (float or array_like) – A time in years.

Returns

The corresponding time in seconds.

Return type

float

ast2000tools.utils.s_to_yr(s)

Converts a given time from seconds to years.

Parameters

s (float or array_like) – A time in seconds.

Returns

The corresponding time in years.

Return type

float

ast2000tools.utils.day_to_s(day)

Converts a given time from days to seconds.

Parameters

day (float or array_like) – A time in days.

Returns

The corresponding time in seconds.

Return type

float

ast2000tools.utils.s_to_day(s)

Converts a given time from seconds to days.

Parameters

s (float or array_like) – A time in seconds.

Returns

The corresponding time in days.

Return type

float

ast2000tools.utils.day_to_yr(day)

Converts a given time from days to years.

Parameters

day (float or array_like) – A time in days.

Returns

The corresponding time in years.

Return type

float

ast2000tools.utils.yr_to_day(yr)

Converts a given time from years to days.

Parameters

s (float or array_like) – A time in years.

Returns

The corresponding time in days.

Return type

float

ast2000tools.utils.AU_to_m(AU)

Converts a given distance from astronomical units to meters.

Parameters

AU (float or array_like) – A distance in astronomical units.

Returns

The corresponding distance in meters.

Return type

float

ast2000tools.utils.m_to_AU(m)

Converts a given distance from meters to astronomical units.

Parameters

m (float or array_like) – A distance in meters.

Returns

The corresponding distance in astronomical units.

Return type

float

ast2000tools.utils.AU_to_km(AU)

Converts a given distance from astronomical units to kilometers.

Parameters

AU (float or array_like) – A distance in astronomical units.

Returns

The corresponding distance in kilometers.

Return type

float

ast2000tools.utils.km_to_AU(km)

Converts a given distance from kilometers to astronomical units.

Parameters

km (float or array_like) – A distance in kilometers.

Returns

The corresponding distance in astronomical units.

Return type

float

ast2000tools.utils.kg_to_m(kg)

Converts a given mass from kilograms to meters.

Parameters

kg (float or array_like) – A mass in kilograms.

Returns

The corresponding mass in meters.

Return type

float

ast2000tools.utils.m_to_kg(m)

Converts a given mass from meters to kilograms.

Parameters

m (float or array_like) – A mass in meters.

Returns

The corresponding mass in kilograms.

Return type

float

ast2000tools.utils.AU_pr_yr_to_m_pr_s(AU_pr_yr)

Converts a given speed from astronomical units per year to meters per second.

Parameters

AU_pr_yr (float or array_like) – A speed in astronomical units per year.

Returns

The corresponding speed in meters per second.

Return type

float

ast2000tools.utils.m_pr_s_to_AU_pr_yr(m_pr_s)

Converts a given speed from meters per second to astronomical units per year.

Parameters

m_pr_s (float or array_like) – A speed in meters per second.

Returns

The corresponding speed in astronomical units per year.

Return type

float

ast2000tools.utils.rad_to_deg(rad)

Converts a given angle from radians to degrees.

Parameters

rad (float or array_like) – An angle in radians.

Returns

The corresponding angle in degrees.

Return type

float

ast2000tools.utils.deg_to_rad(deg)

Converts a given angle from degrees to radians.

Parameters

deg (float or array_like) – An angle in degrees.

Returns

The corresponding angle in radians.

Return type

float