import numpy as np
import matplotlib.pyplot as plt
import logging
logging.basicConfig()
from .trajectory import Trajectory
from . import observer
def main():
sc = observer.VirtualSpacecraft([1e6, 0, 0], [0., 10, 0])
snsr = observer.VirtualSensor([-1., 0, -0.1], 100.)
obsr = observer.VirtualObserver(sc, snsr)
traj = Trajectory(obsr)
tlist = np.arange(0, -30000, -1000)
coord = traj.get_coordinates(tlist)
fig = plt.figure()
ax = fig.add_subplot(221)
ax.plot(tlist, coord[0, :])
ax.plot(tlist, coord[1, :])
ax.plot(tlist, coord[2, :])
ax.set_xlabel('t')
ax.set_ylabel('x,y,z')
ax = fig.add_subplot(222)
ax.plot(tlist, coord[3, :])
ax.plot(tlist, coord[4, :])
ax.plot(tlist, coord[5, :])
ax.set_xlabel('t')
ax.set_ylabel('vx,vy,vz')
ax = fig.add_subplot(223)
ax.plot(coord[0, :], coord[1, :])
ax.plot([0], [0], 'ro')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_aspect('equal')
ax = fig.add_subplot(224)
ax.plot(coord[0, :], coord[2, :])
ax.plot([0], [0], 'ro')
ax.set_xlabel('x')
ax.set_ylabel('z')
ax.set_aspect('equal')
if __name__ == "__main__":
main()