コード例 #1
0
ファイル: part4.py プロジェクト: jflatby/AST2000
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
ファイル: part4.py プロジェクト: jflatby/AST2000
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
ファイル: part5.py プロジェクト: Linueks/ast2000
from ast2000solarsystem_27_v4 import AST2000SolarSystem

star_system = AST2000SolarSystem(11466)

star_system.engine_settings(3.4021029823078977e-09, 3.15498195925e14,
                            63200999999999.992, 100000, 1120,
                            [4.18992917, -1.46374675], 11.3)
star_system.mass_needed_launch([4.18998484, -1.46357376], test=True)

star_system.send_satellite("instructions.txt")

# 53
# x: 0.69970958 y: 5.21180747
# Input x-position: 4.42711
# Input y-position: -0.435386
コード例 #4
0
ファイル: part1.py プロジェクト: Linueks/ast2000
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.patches as patches
import mpl_toolkits.mplot3d.art3d as art3d
import numpy as np
from ast2000solarsystem_27_v4 import AST2000SolarSystem

np.random.seed(1)
star_system_seed = 11466

H2_molar_mass = 2.01588  #[g/mol]
avogadros_const = 6.02214179e23
boltzmann_const = 1.380648e-23
particle_mass = H2_molar_mass / (avogadros_const * 1e3)  #[kg]
gravitational_constant = 6.67408e-11  # [m**3 * kg**-1 * s**-2]

star_system = AST2000SolarSystem(star_system_seed)

#hei = star_system.launch_T

planets_radii = star_system.radius  # [km]
planets_mass = star_system.mass  # [Solar Masses]
home_planet_mass = 1.98855e30 * planets_mass[0]  # [kg]
home_planet_radius = planets_radii[0] * 1000  # [m]
home_planet_initial_position = np.array([star_system.x0[0], star_system.y0[0]])
home_planet_initial_velocity = np.array(
    [star_system.vx0[0], star_system.vy0[0]])
home_planet_rotational_speed = (2 * np.pi * star_system.radius[0] * 1000 /
                                (star_system.period[0] * 24 * 60 * 60))
home_planet_rotational_angular_speed = (2 * np.pi * star_system.period[0] /
                                        (24 * 60 * 60))
コード例 #5
0
from ast2000solarsystem_27_v4 import AST2000SolarSystem

syst = AST2000SolarSystem(11466)

syst.get_ref_stars()