예제 #1
0
def generate_projection(phi_midpoint):
    theta_midpoint = np.pi / 2
    x_pixels = 640
    y_pixels = 480
    field_of_view = 1.22173

    max_axis_value = 2 * np.sin(
        field_of_view / 2) / (1 + np.cos(field_of_view / 2))
    picture = np.zeros((y_pixels, x_pixels, 3), dtype=np.uint8)
    x_values = np.linspace(-max_axis_value, max_axis_value, x_pixels)
    y_values = np.linspace(-max_axis_value, max_axis_value, y_pixels)

    for xpix in xrange(x_pixels):
        for ypix in xrange(y_pixels):
            rho = np.linalg.norm([x_values[xpix], y_values[ypix]])
            c = 2 * np.arctan2(rho, 2)

            theta = np.pi / 2 - np.arcsin(
                np.cos(c) * np.cos(theta_midpoint) +
                (y_values[ypix] * np.sin(c) * np.sin(theta_midpoint)) / rho)
            phi = phi_midpoint + np.arctan2(
                x_values[xpix] * np.sin(c),
                rho * np.sin(theta_midpoint) * np.cos(c) -
                y_values[ypix] * np.cos(theta_midpoint) * np.sin(c))

            pixel_number = AST2000SolarSystem.ang2pix(theta, phi)
            rgb = [
                himmelkulen[pixel_number][2], himmelkulen[pixel_number][3],
                himmelkulen[pixel_number][4]
            ]

            picture[ypix, xpix, :] = rgb

    return picture
예제 #2
0
def compute_reference_sphere():
    x_pixels = 640
    y_pixels = 480
    field_of_view = 1.22173

    max_axis_value = 2 * np.sin(
        field_of_view / 2) / (1 + np.cos(field_of_view / 2))
    picture = np.zeros((y_pixels, x_pixels, 3), dtype=np.uint8)
    x = np.linspace(-max_axis_value, max_axis_value, x_pixels)
    y = np.linspace(-max_axis_value, max_axis_value, y_pixels)

    theta_0 = np.pi / 2.0
    pictures = np.zeros(shape=(360, int(y.shape[0]), int(x.shape[0]), 3),
                        dtype=np.uint8)
    xx, yy = np.meshgrid(x, y)
    rho = np.sqrt(xx**2 + yy**2)
    c = 2.0 * np.arctan(rho / 2.0)
    theta = theta_0 - np.arcsin(
        yy * np.sin(c) / rho)  #Is sin(theta_0) not simply zero??

    for phi_0 in range(0, 360):
        phi_in_rad = np.deg2rad(phi_0)
        phi = phi_in_rad + np.arctan(xx * np.sin(c) / (rho * np.cos(c)))
        for k in range(len(x)):
            for j in range(len(y)):
                pixnum = AST2000SolarSystem.ang2pix(theta[j, k], phi[j, k])
                temp = himmelkulen[pixnum]
                pictures[phi_0, j, k, :] = [temp[2], temp[3], temp[4]]
        print "Done with phi: ", phi_0
    np.save("Reference_sphere.npy", pictures)
예제 #3
0
파일: part8.py 프로젝트: Linueks/ast2000
from ast2000solarsystem_27_v5 import AST2000SolarSystem
import numpy as np
import matplotlib.pyplot as plt

star_system = AST2000SolarSystem(11466)

#star_system.part2B_4(1)

c = 1
L0 = 200
v0 = 0.99
g = 3.34e-10
gamma = np.sqrt(1 - v0**2)
deltaT = L0 / v0 - v0 / g

total_time = deltaT
number_of_time_steps = 1000
dt = total_time / number_of_time_steps

ty = np.linspace(0, L0 / v0 + deltaT, number_of_time_steps)
ty_ = np.zeros(number_of_time_steps)

v = v0

for t in xrange(number_of_time_steps):
    if t * dt < L0 / v0:
        ty_[t] = ty[t] / np.sqrt(1 - v0**2 / c**2)
        print ty[t], ty_[t]
    else:
        v = v + g * dt
        ty_[t] = -L0 * v + L0 / v + (t * dt - L0 / v)
예제 #4
0
from __future__ import division
from ast2000solarsystem_27_v5 import AST2000SolarSystem
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import mpl_toolkits.mplot3d.axes3d as p3
import random as random
from matplotlib import style

np.random.seed(1)

style.use('ggplot')
star_system_seed = 11466
star_system = AST2000SolarSystem(star_system_seed)
gravitational_constant = 6.67408e-11  # [m**3 * kg**-1 * s**-2]
hydrogen_gass_molar_mass = 2.01588  # [gr/mol]
boltzmann_constant = 1.380648e-23  # [m**2 * kg * s**-2 * K**-1]
avogadro_constant = 6.02214179e23  # [mol**-1]
particle_mass = hydrogen_gass_molar_mass / (avogadro_constant * 1e3)  # [kg]
number_of_particles = 100000
temperature = 10000  # [K]
initial_fuel_mass = 100000  # [kg]
satellite_mass = 1100  # [kg]
total_mass = initial_fuel_mass + satellite_mass  # [kg]
box_dim = 1e-6  # [m]

planets_radii = star_system.radius  # [km]
planets_mass = star_system.mass  # [Solar Masses]
planets_orbital_period = star_system.period * 24 * 60 * 60  # [s]

home_planet_mass = 1.98855e30 * planets_mass[0]  # [kg]