Exemplo n.º 1
0
 def __init__(self, screen):
     self.screen = screen
     self._quit = False
     self.clock = pygame.time.Clock()
     self.gravity = gravity.Gravity(UNI.GRAVITY)
     self.playerGroup = pygame.sprite.Group()
     self.lifter = lifter.Lifter(self.playerGroup)
Exemplo n.º 2
0
def shared_blockchain_instance():
    """ This method will initialize ``SharedInstance.instance`` and return it.
        The purpose of this method is to have offer single default
        gravity instance that can be reused by multiple classes.
    """
    if not SharedInstance.instance:
        clear_cache()
        SharedInstance.instance = grv.Gravity(**SharedInstance.config)
    return SharedInstance.instance
Exemplo n.º 3
0
def min_dist(sigma, v, t_max, dt):
    DGrav = gravity.Gravity(h=400000)
    DGrav.v = [
        0, v * math.sin(sigma), -10000 * (DGrav.r_0**-1),
        v * math.cos(sigma) * (DGrav.r_0**-1)
    ]
    tmax = 1500
    DGrav.dt = dt
    DGrav.integrate_until(tmax)
    return DGrav.d_min
Exemplo n.º 4
0
import gravity as g

filepath = '/Users/chrisbert/Documents/Git/GDPS/sample_data/AN03_F1007_20161130_iMAR_PrelimFinal_STD.txt'

traj_test = g.Gravity()
#traj_test.import_trajectory(filepath, interval=.1, interp=True)
traj_test.import_trajectory(filepath, interval=.1)

print traj_test.trajectory
Exemplo n.º 5
0
import gravity as g

gravity_path = '/Users/chrisbert/Documents/Git/GDPS/sample_data/DGS/dgs_test_data.dat'
trajectory_path = '/Users/chrisbert/Documents/Git/GDPS/sample_data/AN03_F1007_20161130_iMAR_PrelimFinal_STD.txt'

data = g.Gravity()
print 'Importing gravity data.'
data.import_DGS_format_data(gravity_path)

print data.gravity

print 'Importing trajectory data.'
data.import_trajectory(trajectory_path, interval=.1)

print data.trajectory

print 'Joining trajectory with gravity data.'
data.join_grav_traj()

print data.gravity
Exemplo n.º 6
0
import gravity as g

filepath = '/Users/chrisbert/Documents/Git/GDPS/sample_data/ZLS'

zls_data = g.Gravity()
zls_data.import_ZLS_format_data(filepath)

print zls_data.df
Exemplo n.º 7
0
import gravity
import matplotlib.pyplot as plt
import math


h = 5e5 # Altitude of reference trajectory
eq = gravity.Gravity([0,0,0,0],0.1,0,h) # Create gravity instance

# Perform the integration for the given initial conditions
# Integrate up to t=12000s and produeces 3 figues, z(t), phi(t) and z(phi)
# z0,v_z0,phi0,v_phi0: initial values for the functions
def run(scenario,z0,v_z0,phi0,v_phi0):
    # integration parameters
    t0 = 0
    dt = 0.1
    t_max = 12000
    dt_grf = 10
    eq.reset([z0,v_z0,phi0,v_phi0],dt,t0) 
    # Display initial condition on screen
    print("Scenario {}:".format(scenario))
    print("t={}  z={} dz/dt={} phi={} dphi/dt={} "\
        .format(eq.t,eq.V[0],eq.V[1],eq.V[2],eq.V[3],))
    # Integrate until t_max
    eq.iterate(t_max,dt_grf) 
    # Display position after integration
    print("t={}  z={} dz/dt={} phi={} dphi/dt={} "\
        .format(eq.t,eq.V[0],eq.V[1],eq.V[2],eq.V[3],))
    # Plot z(t)
    plt.xlabel('t',fontsize=20)
    plt.ylabel('z',fontsize=20)
    plt.subplots_adjust(left=0.15)
Exemplo n.º 8
0
import gravity as g
import numpy as np
import matplotlib.pyplot as plt

ms =  1.989 * (10**30)
mz =  5.9742 * (10**24)
vs = np.array((0,0))
rs = np.array((0,0))
vz = np.array((0,29783))
rz = np.array((1.486*(10**11),0))

p = g.Gravity()

#(m1,m2,r1,v1,r2,v2)
p.init(ms,mz,rs,vs,rz,vz)
p.interact(60*60*24*365.242)

plt.figure("Gravitacijska interakcija", figsize=(7,7))
ax = plt.axes()
ax.set_facecolor("black")
plt.plot(p.x1_list,p.y1_list, c = "yellow", label = "Sunce")
plt.plot(p.x2_list,p.y2_list, c = "blue", label = "Zemlja")
plt.xlabel("x")
plt.ylabel("y")
plt.legend()
plt.show()
Exemplo n.º 9
0
import pygame
import personnage
import controleur
import point
import gravity
from constantes import *
from plateform import *

gravity = gravity.Gravity()
contro = controleur.Controleur()
listePixelSolide = contro.getListePixel()
x = 20
y = 50
position = (x, y)

perso = personnage.Personnage(x, y)
perso.getposition()
print("salut")
perso.deplacer(GAUCHE, listePixelSolide, listePixelSolide, listePixelSolide)
perso.getposition()
print("fin du game")

pygame.init()

#Ouverture de la fenêtre Pygame
fenetre = pygame.display.set_mode((LARGEURFENETRE, HAUTEURFENETRE))

#Chargement et collage du fond
fond = pygame.image.load("background.jpg").convert()
fenetre.blit(fond, (0, 0))
Exemplo n.º 10
0
import gravity
import matplotlib.pyplot as plt
import math
import numpy as np

h = 4e5  # Altitude of reference trajectory
DGrav = gravity.Gravity(h)  # Create gravity instance
t0 = 0
dt = 0.1
t_max = 1500
v = 100
min_temp = []
min_d = [[0, 1e6]]


def min_dist(sigma, v, t_max, dt):
    DGrav = gravity.Gravity(h=400000)
    DGrav.v = [
        0, v * math.sin(sigma), -10000 * (DGrav.r_0**-1),
        v * math.cos(sigma) * (DGrav.r_0**-1)
    ]
    tmax = 1500
    DGrav.dt = dt
    DGrav.integrate_until(tmax)
    return DGrav.d_min


for sigma in np.linspace(-np.pi, np.pi, 100):
    min_temp = min_dist(sigma, 100, 1500, 0.1)
    if min_temp != []:
        if min_temp[0][1] < min_d[0][1]: