Exemplo n.º 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
Exemplo n.º 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)

    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)
Exemplo n.º 3
0
from __future__ import division, print_function
from scipy.constants import Boltzmann, Avogadro, speed_of_light, m_p, gravitational_constant
from ast2000solarsystem_27_v6 import AST2000SolarSystem
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style as style
style.use('ggplot')

seed = 11466
star_system = AST2000SolarSystem(seed)

# CONVERSIONS
solar_to_kg = 1.9884e30
km_to_m = 1000

k = Boltzmann
n_a = Avogadro
c = speed_of_light
m_p = m_p
G = gravitational_constant

gravity = G * star_system.mass[1] * solar_to_kg / (star_system.radius[1] *
                                                   km_to_m)**2
surface_temp = 271  #[K]
gamma = 1.4
rho_0 = star_system.rho0[1]
mu = 17.02
scale_height = Boltzmann * surface_temp / (2 * m_p * mu * gravity)
planet_mass = star_system.mass[1] * 1.989e30

print('star mass: ', 2.44 * solar_to_kg)
Exemplo n.º 4
0
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from ast2000solarsystem_27_v6 import AST2000SolarSystem
from PIL import Image
import scipy.interpolate as inter
plt.style.use("ggplot")
star_system = AST2000SolarSystem(11466)

ms_to_AUyr = 0.000210945021

in_file = open("planet_positions.npy", "rb")
planet_positions, times = np.load(in_file)
print "Positions loaded from file..."

positions_function = inter.interp1d(times, planet_positions)
print "Positions interpolated..."

with open('himmelkule.npy') as infile:
    himmelkulen = np.load(infile)


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)
Exemplo n.º 5
0
from __future__ import division, print_function
from ast2000solarsystem_27_v6 import AST2000SolarSystem
from scipy.constants import Boltzmann, m_p, gravitational_constant
import numpy as np

solmass_to_kg = 1.9891e30
mu = 17.03
temperature = 271

kg_to_earthmass = 1.673360107e-25

myss = AST2000SolarSystem(11466)
driddu_mass = myss.mass[1] * solmass_to_kg
driddu_radius = myss.radius[1] * 1000
gravity = gravitational_constant * driddu_mass / (driddu_radius)**2
print(gravity)
rho_0 = myss.rho0[1]
scale_height = Boltzmann * temperature / (m_p * mu * gravity)
gamma = 1.4

r_t0 = scale_height * gamma / (2 * (gamma - 1))

print(r_t0)
Exemplo n.º 6
0
from __future__ import division, print_function
from ast2000solarsystem_27_v6 import AST2000SolarSystem
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style as style

seed = 11466
driddu = 1

my_SS = AST2000SolarSystem(seed)
my_SS.part2C_5(number_of_light_signals=50)