A Python library that deals with different fields of science.
Project description
OrbitPy
OrbitPy is an opensource science library developed for python developers that deals with classical mechanics, celestial mechanics, physics, thermodynamics, and astronomy
OrbitPy Terms
This is an open-source software that is constantly evolving as it is upgraded by its creators as well as the community. If you have questions about it, please email lunastrohelp@gmail.com. Please view the liscense provided or visit https://opensource.org/license/mit/ for legal permissions.
Usage Examples
OrbitPy is a versatile and developing library. Here is a simple usage case:
from OrbitPy import *
latitude = 47.6 # Bellevue WA latitude
sunData = getSunData(latitude)
print(f"The sun's current declination is: {sunData.dec}")
This code (On Sun Mar 19 2:08 PM) would have outputted -1.3112534178591464
A more advanced usage case:
from OrbitPy import *
latitude = 47.6
longitude = -122.2
siderealtime = localSiderealTime(longitude)
now = datetime.datetime.now()
if siderealtime.hour == now.hour and siderealtime.minute == now.minute and siderealtime.second == now.second:
print("Sidereal time matches with regular time")
else:
print("Sidereal time does not match with regular time")
Methods & Tools
OrbitPy has an extensive array of methods that are updated constantly. The current methods include:
Astronomy
getMoonPosition(lat, long)
that takes in two parameters that represent latitude and longitude of the user's location respectively. The function then returns an object that contains attributes 'azimuth', 'altitude', 'distance', 'parallacticAngle', and 'phase'.astronomicalRefraction(alt)
that takes in one parameter that represents altitude. It returns refractionsunRA()
that returns the right ascension of the sun.solarHourAngle()
that returns the current solar hour angleazimuth(lat, long)
that returns the azimuth of the sun for the given latitude and longitudealtitude(lat, long)
that returns the altitude of the sun for the given latitude and longitudelocalSiderealTime(long)
that returns the local sidereal time of the given longitudegetSunData(lat)
that returns an object that contains attributes "dec" for declination, "hour_angle" for hr angle, "ra" for right ascension, "long_omega" for the longitude of the sun's ascending node, "true_solar_anomaly" for the true solar anomaly, "true_solar_longitude" for the true solar longitude, "geo_anomaly" for the geometric mean anomaly, "geo_long" for the geometric mean longitude, "dist" for distance to the sun.planetMeanAnomaly(planet)
that returns the mean anomaly of the planet based on an str input that contains the name of the planetplanetEquationOfCenter(planet)
that returns the equation of center of the planet based on an str input that contains the name of the planetplanetTrueAnomaly(planet)
that returns the planet's true anomalygetLunarPhase(date)
that takes an optional parameter of date (if no date provided, current date is used) and calculates lunar phaseget_lunar_age(date)
that takes an optional parameter of date (if no date provided, current date is used) and calculates lunar ageget_lunar_age_percent(date)
that takes an optional parameter of date (if no date provided, current date is used) and calculates the percentage of the lunar age
Time
localSiderealTime(long)
that returns the local sidereal time of the given longitudedaysSinceJ2000()
that returns the days since J2000 epochjuliandate(now)
that takes the parameter ofdatetime.datetime.now()
and returns the julian date.astroNorthernSeasonDates(year)
that takes the parameter of the current year and returns the season start dates for the N. HemisphereastroSouthernSeasonDates(year)
that takes the parameter of the current year and returns the season start dates for the S. Hemisphere
Thermodynamics
-
enthalpy(cp, m, delta_t)
: Calculates enthalpy of a substance.
- param cp: specific heat capacity of the substance
- param m: mass of the substance
- param delta_t: change in temperature of the substance
- return: enthalpy of the substance -
specificHeat(cp, m)
: Calculates specific heat of a substance.
- param cp: specific heat capacity of the substance
- param m: mass of the substance
- return: specific heat of the substance -
entropy(q, t)
: Calculates entropy of a substance.
- param q: heat added or removed from the substance
- param t: temperature of the substance
- return: entropy of the substance -
internalEnergy(cv, m, delta_t)
: Calculates internal energy of a substance.
- param cv: specific heat capacity at constant volume of the substance
- param m: mass of the substance
- param delta_t: change in temperature of the substance
- return: internal energy of the substance -
gibbs_free_energy(h, t, s)
: Calculates Gibbs free energy of a substance.
- param h: enthalpy of the substance
- param t: temperature of the substance
- param s: entropy of the substance
- return: Gibbs free energy of the substance -
ideal_gas_law(p, v, n, r=8.314)
: Calculates the ideal gas law for a gas.
- param p: pressure of the gas
- param v: volume of the gas
- param n: number of moles of the gas
- param r: universal gas constant (default is 8.314 J/(mol*K))
- return: temperature of the gas -
peng_robinson_eos(p, v, n, tc, pc, omega)
: Calculates the Peng-Robinson equation of state for a gas.
- param p: pressure of the gas
- param v: volume of the gas
- param n: number of moles of the gas
- param tc: critical temperature of the gas
- param pc: critical pressure of the gas
- param omega: acentric factor of the gas
- return: temperature of the gas -
heat_flux(delta_T, k, thickness)
: Calculates the heat flux through a material. - param delta_T: temperature difference across the material (in K) - param k: thermal conductivity of the material (in W/m.K) - param thickness: thickness of the material (in m) - return: heat flux through the material (in W/m^2) -
thermal_conductivity(diffusivity, specific_heat, density)
: Calculates the thermal conductivity of a substance. - param diffusivity: thermal diffusivity of the material (in m^2/s) - param specific_heat: specific heat capacity of the material (in J/kg K) - param density: density of the material (in kg/m^3) - return: thermal conductivity of the material (in W/m K) -
calculate_diffusivity(k, rho, cp)
: Calculates the diffusivity of a material in m^2/s given its thermal conductivity (k), density (rho), and specific heat capacity (cp).
Physics
Initialize thestar
class
from OrbitPy import *
star = Star(mass, age, distance)
Setup and get information:
calculate_luminosity() # setup the luminosity
calculate_surface_temperature() # setup the surface temperature
calculate_radius() # setup the radius
calculate_core_temperature() # setup the core temp
calculate_apparent_brightness() # setup the apparent brightness
calculate_absolute_brightness() # setup the absolute brightness
After setting the information, you can get the attribute of the object.
You can get the attribute by calling 'name'.insert_attribute_name_here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file OrbitPy-0.0.0.tar.gz
.
File metadata
- Download URL: OrbitPy-0.0.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f7cef7ad1044497b042da159f1f1b3f343a2eeb7ae6ccc1487a0c700034877f |
|
MD5 | 526c9ff57d69d6fd818ebb3619e808c9 |
|
BLAKE2b-256 | 9f16e4d24c997dc87b788cd086ef672a0bba840c303d23a3bc5ebb9fcc15c296 |
File details
Details for the file OrbitPy-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: OrbitPy-0.0.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b0c6c5c45cf7d103444a0740c46135dfaf4cb36447d748b3c8fc84faf06d3e0 |
|
MD5 | 06cafa4829a8ac3f0a5b0c7320ab5b1b |
|
BLAKE2b-256 | 9647b0a4154e154a55e1b0d10218a5bb42aec66f865dfd10758144cbd5f79853 |