Exemplo n.º 1
0
# Egen kode
'''
We are going on a trip in our favorite rocket ship
'''
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import scipy.interpolate as interpolate
import ast2000tools.constants as const
import ast2000tools.utils as utils
from ast2000tools.space_mission import SpaceMission
from ast2000tools.solar_system import SolarSystem
from ast2000tools.shortcuts import SpaceMissionShortcuts
from programkode_del4_klasse import did_you_just_assume_my_orientation, launching_sequence

seed = utils.get_seed('alinerb')
mission = SpaceMission(seed)
launch = launching_sequence(mission)
orient = did_you_just_assume_my_orientation(mission)
Ms = mission.system.star_mass
M_planet = mission.system.masses
G = const.G_sol

planet_positions = np.load('planet_positions.npy')
planet_velocities = np.load('planet_velocities.npy')
timesteps = np.load('times.npy')
plan_v_rocket = np.load('optimal_rakett_hastighet.npy')
plan_r_rocket = np.load('optimal_rakett_posisjon.npy')
plan_t_rocket = np.load('optimal_rakett_tid.npy')

pos_planet = interpolate.interp1d(timesteps,
Exemplo n.º 2
0
"""
<<<<<<<< Bruker egen kode >>>>>>>>
"""
from ast2000tools.solar_system import SolarSystem
from ast2000tools import utils
from ast2000tools import constants
from ast2000tools import space_mission
import numpy as np
import matplotlib.pyplot as plt
import math as math
""" Finding our special system"""
seed = utils.get_seed("mortetb")
system = SolarSystem(seed)  # 66755

# print(seed)  # 2 siste siffer er 55
"""Constants given by the task, and other info we need"""
lmda0 = 656.28  # nm
c = constants.c
star_name = [
    "star0_5.93.txt", "star1_1.74.txt", "star2_1.67.txt", "star3_1.72.txt",
    "star4_0.91.txt"
]
vel_list = np.array([0, 10, 18, 14,
                     34])  # se på indeks nr 3 og spør i gruppetimen
sunmass_list = np.array([5.93, 1.74, 1.67, 1.72, 0.91
                         ]) * constants.m_sun  # sunmass in kg
periods = np.array([math.nan, 4500, 5200, 4500, 5000
                    ]) * 24 * 3600  # List in days times dayconverter
# Note the periods might be inaccurate, because i kinda had to find them by looking at a graph
print(f"Sunmasses = {sunmass_list}")
"""Functions, in hindsight this should have been a class, buuut then i'd have to