Orbitronomy Official Documentation
  • Welcome!
  • SimpleOrbit Class
  • datasetOrbit Class
  • RelativeOrbit Class
  • Plot Style
  • Examples Images
  • Example Codes and Images
Powered by GitBook
On this page
  • Example 1:
  • Example 2:
  • Example 3:

Was this helpful?

Example Codes and Images

Here are some fun examples

Example 1:


# Tests for the keppler_elements.py module
from orbitronomy import DatasetOrbit


test = DatasetOrbit(plot_title="Test", name="Earth")


#styling
test.orbitTransparency(1)
test.faceColor("black")
test.paneColor("black")
test.gridColor("#222831")
test.labelColor("white")
test.tickColor("white")


test.datasetPlotStyle(background_color="dark_background")


#name of the columns in the dataset in CSV format
test.columnSemiMajorAxis("semi_major_axis")
test.columnPerihelion("perihelion")
test.columnEccentricity("eccentricity")
test.columnInclination("inclination")
test.columnLongitudeOfAscendingNode("longitude_of_ascending_node")
test.columnArgumentOfPerihelion("argument_of_perihelion")
test.columnColor("color")
test.columnName("name")

#name of the dataset file
test.fileName("datasets/Planetary-Satellite-Data.csv")

test.inclinationPlot("white")


test.datasetCalculateOrbit(plot_steps=1000, n_orbits=12, color="yellow", 
                    random_color=True, trajectory=True, sun=True, delimiter=";",
                    inclinationObserver=True, 
                    display_name=True, fontsize=12, fontweight="normal", fontcolor="black")


#you can choose if you want to set boundaries for the plot
# test.xLim([20, 20])
# test.yLim([20, 20])
# test.zLim([0.1, 0.1])

test.xLabel("X-Axis")
test.yLabel("Y-Axis")
test.zLabel("Z-Axis")

test.datasetAnimateOrbit(dpi=250, save=False, export_zoom=3, font_size="xx-small")

Example 2:

# Tests for the keppler_elements.py module

from orbitronomy import RelativeOrbit


test = RelativeOrbit(plot_title="Test", name="Earth", fps=30)

#styling
test.faceColor("black")
test.paneColor("black")
test.gridColor("#222831")
test.labelColor("white")
test.tickColor("white")

#orbit transparency for object and orbit respectively
test.orbitTransparencyParentObject(0.5)
test.orbitTransparencyChildObject(0.5)

#parent object colors for object and orbit respectively
test.colorParentObjectOrbit(["blue", "green"])

#child object colors for object and orbit respectively
test.colorChildObjectOrbit(["red", "white"])

# plot style (has to be run after all styling is done)
test.plotStyle(background_color="dark_background")


# parent object keplerian elements
test.semiMajorAxisParentObject(1)
test.perihelionParentObject(0.983289891)
test.eccentricityParentObject(0.01671123)
test.inclinationParentObject(0)
test.longitudeOfAscendingNodeParentObject(0)
test.argumentOfPerihelionParentObject(0)

# child object keplerian elements
test.semiMajorAxisChildObject(0.4)
test.perihelionChildObject(0.45)
test.eccentricityChildObject(0.1)
test.inclinationChildObject(10)
test.longitudeOfAscendingNodeChildObject(0)
test.argumentOfPerihelionChildObject(0)


test.sunSize(100)

# parent object size
test.parentObjectSize(100)

# child object size
test.childObjectSize(100)

# calculateOrbit takes the following arguments + some other ones in documentation
test.calculateOrbit(plot_steps=1000, n_orbits_child=3,
                    # color="blue",
                    n_orbits_parent=1,
                    trajectory=True, sun=True, child_trajectory=True)


# you can choose if you want to set boundaries for the plot
# test.xLim([20, 20])
# test.yLim([20, 20])
# test.zLim([1, 1])

# you can choose if you want to set labels for the plot
test.xLabel("X-Axis")
test.yLabel("Y-Axis")
test.zLabel("Z-Axis")


test.animateOrbit(dpi=250, save=False, export_zoom=3, export_folder="results", font_size="xx-small", animation_interval=10)

Example 3:


# from orbitronomy import SimpleOrbit
from orbitronomy import SimpleOrbit

test = SimpleOrbit(plot_title="Test", name="Earth")


#styling
test.faceColor("black")
test.paneColor("black")
test.gridColor("#222831")
test.orbitTransparency(0.5)
test.labelColor("white")
test.tickColor("white")

test.plotStyle(background_color="dark_background")

# the form of the list should be as follows: "name", semi_major_axis, perihelion, eccentricity, inclination, longitude_of_ascending_node, argument_of_perihelion, color (optional)
data = [["object1", 1, 0.983289891, 0.01671123, 15, 0, 0, "green"], ["object2", 1.5, 0.483289891, 0.02671123, 6, 0, 0, "yellow"], ["object3", 1.3, 0.683289891, 0.01671123, 2, 0, 0, "red"]]

# cool shape
# data = [['electron1', 0.5, 0.45, 0.1, 10, 0, 0, 'blue'],
#  ['electron2', 1.0, 0.9, 0.1, 20, 0, 0, 'green'],
#  ['electron3', 1.5, 1.35, 0.1, 30, 0, 0, 'red'],
#  ['electron4', 2.0, 1.8, 0.1, 40, 0, 0, 'yellow'],
#  ['electron5', 2.5, 2.25, 0.1, 50, 0, 0, 'orange'],
#  ['electron6', 3.0, 2.7, 0.1, 60, 0, 0, 'purple']]

# cool atom shape
# data = [
#     ['electron1', 1.0, 0.8, 0.2, 0.0, 0, 0, 'red'],
#     ['electron2', 1.0, 0.8, 0.2, 30.0, 0, 0, 'red'],
#     ['electron3', 1.0, 0.8, 0.2, 60.0, 0, 0, 'red'],
#     ['electron4', 1.0, 0.8, 0.2, 90.0, 0, 0, 'red'],
#     ['electron5', 1.0, 0.8, 0.2, 120.0, 0, 0, 'red'],
#     ['electron6', 1.0, 0.8, 0.2, 150.0, 0, 0, 'red']]

# cool atom shape 2x less
# data = [
#     ['electron1', 1.0, 0.2, 0.6, 0.0, 0, 0, 'red'],
#     ['electron2', 1.0, 0.2, 0.6, 60.0, 0, 0, 'red'],
#     ['electron3', 1.0, 0.2, 0.6, 120.0, 0, 0, 'red'],
# ]



# you can also use the following instead of data if you want to plot a single object
# test.semiMajorAxis(1)
# test.perihelion(0.983289891)
# test.eccentricity(0.01671123)
# test.inclination(0)
# test.longitudeOfAscendingNode(0)
# test.argumentOfPerihelion(0)
# test.color("green")
# test.objectName("object1")


test.sunSize(1000)
test.planetSize(100)

test.inclinationPlot("white")

test.calculateOrbit(plot_steps=1000, n_orbits=4, data=data,
                    # color="blue",
                    trajectory=True, sun=True, 
                    inclinationObserver=True, 
                    display_name=True, fontsize=12, fontweight="normal")

# test.drawLineTwoPoints([0, 0, 0], [200, 200, 201])
# test.drawLineTwoPointsName("object1")

# you can choose if you want to set boundaries for the plot
# test.xLim([20, 20])
# test.yLim([20, 20])
# test.zLim([1, 1])

test.xLabel("X-Axis")
test.yLabel("Y-Axis")
test.zLabel("Z-Axis")


test.animateOrbit(dpi=250, save=False, export_zoom=3, font_size="xx-small", export_folder="results", animation_interval=10)

PreviousExamples Images

Last updated 1 month ago

Was this helpful?