Skip to main content

Package for Tychos model implementation in Python and Tychos model interface to the Skyfield package. https://github.com/mindaugl/tychos_skyfield

Project description

tychos_skyfield package

Tychos (Tychosium) model implementation in Python3 and integration with the Skyfield package.

This package enables users to run Tychos solar system model in Python and to import it into Skyfield package.

Tychos model

  from tychos_skyfield import baselib as T
    
  # Create solar system:
  system = T.TychosSystem()
  
  # Move system to particular time (2020-06-21 12:00:00):
  julian_day = 2459022.0
  system.move_system(julian_day)
  
  # Check list of observable objects:
  print("Observable objects:", system.get_observable_objects())
  
  # Check location of object, given in centi-AU (earth-sun distance is ~100):
  print("Jupiter location:", system['Jupiter'].location)
  
  # Get RA/Dec/Distance as calculated in Tychosium (in the frame associated with the Earth's orientation):
  ra, dec, dist = system['Jupiter'].radec_direct(system['Earth'], system['Polar_axis'], 'date')
  print("RA/Dec/Distance in the moving frame:", ra, ",", dec, ",", dist)
  
  # Get RA/Dec/Distance for the J2000 epoch (in the frame of Earth being on the date 2000-01-01):
  ra, dec, dist = system['Jupiter'].radec_direct(system['Earth'], None, 'j2000')
  print("RA/Dec/Distance in the j2000 frame: ", ra, ",", dec, ",", dist)

With result:

  Observable objects: ['sun', 'mercury', 'moon', 'venus', 'mars', 'phobos', 'deimos', 'jupiter', 'saturn', 'uranus', 'neptune', 'halleys', 'eros']
  Jupiter location: [177.79634343  -3.76073738 343.90806095]
  RA/Dec/Distance in the moving frame: 19h 49m 4.52s , -21deg 28' 57.8" , 4.210632538170995
  RA/Dec/Distance in the j2000 frame:  19h 47m 50.81s , -21deg 32' 11.8" , 4.210632538170995

Tychos integration with Skyfield

  from skyfield.api import load
  from tychos_skyfield import skyfieldlib as TS
  
  # Get Tychos observable objects:
  print("Tychos observable objects:", TS.TychosSkyfield.get_observable_objects())
  
  # Load skyfield planets data (~17 MB):
  skyfield_objs = load('de421.bsp')
  
  # Create Earth Skyfield object and reference object for Tychos:
  earth_s = skyfield_objs['Earth']
  earth_ref = TS.ReferencePlanet('Earth', skyfield_objs)
  
  # Tychos Jupiter object (with Earth as reference object) that complies with Skyfield infrastructure:
  jupiter_t = TS.TychosSkyfield("Jupiter", earth_ref)
  
  # Set time:
  ts = load.timescale()
  time = ts.tt(2020, 6, 21, 12, 0, 0)
  
  # Observe position and Ra/Dec/Dist in the ICRF/J2000 frame as observed from Earth:
  print("Jupiter instantaneous Position:", jupiter_t.at(time).position)
  print("Instantaneous Ra/Dec/Dist:       ", jupiter_t.at(time).radec())
  print("Observed Ra/Dec/Dist:            ", earth_s.at(time).observe(jupiter_t).radec())
  print("Observed Apparent Ra/Dec/Dist:   ", earth_s.at(time).observe(jupiter_t).apparent().radec())
  
  # Check that instantaneous Ra/Dec/Dist agree with native tychos calculation in the ICRF/J2000 frame:
  jupiter_t.move_system(time.tt)
  print("Instantaneous Ra/Dec/Dist native:", jupiter_t.native_object().radec_direct(jupiter_t.native_object("Earth")))

With result:

  Jupiter instantaneous Position: [ 1.77579358 -3.49095666 -1.54570538] au
  Instantaneous Ra/Dec/Dist:        (<Angle 19h 47m 50.81s>, <Angle -21deg 32' 11.8">, <Distance 4.21063 au>)
  Observed Ra/Dec/Dist:             (<Angle 19h 47m 50.19s>, <Angle -21deg 32' 13.2">, <Distance 4.21064 au>)
  Observed Apparent Ra/Dec/Dist:    (<Angle 19h 47m 51.48s>, <Angle -21deg 32' 09.8">, <Distance 4.21064 au>)
  Instantaneous Ra/Dec/Dist native: ('19h 47m 50.81s', '-21deg 32\' 11.8"', np.float64(4.210632538170995))

Installation

pip install tychos_skyfield

The dependencies are:

  • numpy
  • scipy
  • skyfield (only for tychos skyfield library)

The package was tested to work with python 3.12.3, numpy 2.2.1, scipy 1.15.1, skyfield 1.51.

References

Tychosium 3-D (source code): https://codepen.io/pholmq/full/XGPrPd

Tychos project: https://www.tychos.space/

Skyfield: https://rhodesmill.org/skyfield/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tychos_skyfield-1.0.8.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tychos_skyfield-1.0.8-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file tychos_skyfield-1.0.8.tar.gz.

File metadata

  • Download URL: tychos_skyfield-1.0.8.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for tychos_skyfield-1.0.8.tar.gz
Algorithm Hash digest
SHA256 6c9097209eae08efd555b1f3096da168ff1b3099c696e6362d7d37ef8d103a6c
MD5 b12a579256a64706dbf6d8b29f3ef17d
BLAKE2b-256 1025bc513f9506bb69d736bd6f1d72fa77010e242d197d46668f7d12f5483e07

See more details on using hashes here.

File details

Details for the file tychos_skyfield-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for tychos_skyfield-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 905315acdd1f29dda7734fc7e55abddb3cd519d0ee11d03140166f14313baff5
MD5 5432deb445d6e92d053dfcca5f655142
BLAKE2b-256 3d29e71ab50d33cb63b7e915e6fcf11f319f6dcfcfa9bbe7952b800eb1e8666e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page