Skip to content

Instantly share code, notes, and snippets.

View jorgepiloto's full-sized avatar
🐺
Indomable

Jorge Martínez jorgepiloto

🐺
Indomable
View GitHub Profile
@jorgepiloto
jorgepiloto / bright_stars.py
Created October 12, 2022 18:02
Use Astropy to manipulate HYG database
from astropy.coordinates import SkyCoord, Angle, Distance
from astropy.table import Table
from astropy import units as u
def main():
# Read stars data into an astropy table
# https://www.astronexus.com/downloads/catalogs/hygdata_v3.csv.gz
stars_table = Table.read("hygdata_v3.csv")

CLA

This is just a test for a CLA.

@jorgepiloto
jorgepiloto / test_frames.py
Created April 15, 2021 11:58
Converts from custom MarsICRS to MarsFixed using Orekit API
""" Validate poliastro frames against Orekit ones """
from orekit.pyhelpers import setup_orekit_curdir
from org.hipparchus.geometry.euclidean.threed import Vector3D
from org.orekit.bodies import CelestialBodyFactory
from org.orekit.frames import FramesFactory, Transform, UpdatableFrame
from org.orekit.time import AbsoluteDate
from org.orekit.utils import PVCoordinatesProvider, TimeStampedPVCoordinates
import orekit
@jorgepiloto
jorgepiloto / ex_hohmann.txt
Last active January 23, 2021 18:54
gmat2020_hohmann.script
%----------------------------------------
%---------- Spacecraft
%----------------------------------------
% Create spacecraft and define its orbit
Create Spacecraft ss_0;
GMAT ss_0.DateFormat = TAIModJulian;
GMAT ss_0.Epoch = '21545';
GMAT ss_0.CoordinateSystem = EarthICRF;
GMAT ss_0.DisplayStateType = Cartesian;
GMAT ss_0.X = 7200;
""" Modeling Hohmann impulsive transfer with Orekit Python wrapper """
import numpy as np
# Setup the virtual machine and data location
import orekit
from orekit.pyhelpers import setup_orekit_curdir
vm = orekit.initVM()
@jorgepiloto
jorgepiloto / plot_sin.py
Created December 22, 2019 12:31
plot_sin.py
# -*- coding: utf-8 -*-
"""
Introductory example - Plotting sin
===================================
This is a general example demonstrating a Matplotlib plot output, embedded
rST, the use of math notation and cross-linking to other examples. It would be
useful to compare the :download:`source Python file <plot_0_sin.py>` with the
output below.
@jorgepiloto
jorgepiloto / atmosphere_tables.py
Created August 8, 2019 10:30
Creates atmospheric tables
from astropy.io import ascii
from astropy import units as u
from poliastro.atmosphere.models import COESA62
from prettytable import PrettyTable
import numpy as np
coesa62 = COESA62()
t = PrettyTable()
t.align='l'
@jorgepiloto
jorgepiloto / units_nu_to_M.py
Created August 8, 2019 10:14
poliastro issue #751
from astropy import units as u
from poliastro.twobody.angles import nu_to_M
from poliastro.core.angles import nu_to_M as nu_to_M_core
nu = 150 * u.deg
ecc = 0.08 * u.one
# If making use of radians in high-level function
M = nu_to_M(nu.to(u.rad), ecc)
print("\nHigh level function radian input results")
import matplotlib.pyplot as plt
from astropy import units as u
from astropy.time import Time
from poliastro.bodies import Earth, Mars
from poliastro.maneuver import Maneuver
from poliastro.plotting.static import StaticOrbitPlotter
from poliastro.twobody import Orbit
# Departure and time of flight for the mission
import matplotlib.pyplot as plt
from astropy import units as u
from astropy.time import Time
from poliastro.bodies import Earth
from poliastro.frames import GeocentricSolarEcliptic
from poliastro.plotting.static import StaticOrbitPlotter
from poliastro.twobody import Orbit
EPOCH = Time("2018-02-19")