''' Main script. From a single point, sweep angle, making image.
'''
import os
import sys
import time, datetime
from io import StringIO
import numpy as np
from argparse import ArgumentParser
from . import simulator
from . import observer
from pyana.util.future import OrderedDict
import pyana.util.datafile
from . import parameters as p
from . import f2j
from . import imager
def main(scpos, scvel, vena_sc, iophase, output=None, primary_axis=None, secondary_axis=None, resolution=101, maxangle=50, mass=16, sunsys3long_t0=0):
'''Main script, to compare with previous plot.
:param xyz: S/C pos in Rj. ``ndarray`` with (3,) shape.
:param vxyz: S/C vel in km/s. ``ndarray`` with (3,) shape.
:param vena: ENA speed in km/s. Scalar.
:param iophase: IO phase angle in degrees. Scalar.
:keyword output: Output file name. Usually *.dat or *.txt.
:keyword primary_axis: Primary axis vector.
:keyword secondary_axis: Secondary axis vector.
:keyword resolution: Resolution of image.
:keyword maxangle: Maximum angle in degrees.
:keyword mass: Mass in amu.
'''
singlepointimager = imager.SinglePointImager(scpos, scvel, vena_sc, iophase,
primary_axis=primary_axis, secondary_axis=secondary_axis,
mass=mass,
sunsys3long_t0=sunsys3long_t0)
xlist = np.linspace(-maxangle, maxangle, resolution)
ylist = np.linspace(-maxangle, maxangle, resolution)
singlepointimager.do_calculation(xlist, ylist, output=output)
def parse():
desc = "Imaging script."
parser = ArgumentParser(description=desc)
parser.add_argument('-x', '--position', dest='scpos', default=[0, 15., 0],
nargs=3, type=float, help='Spacecraft position vector in Rj',
metavar=('X', 'Y', 'Z')
)
parser.add_argument('-v', '--velocity', dest='scvel', default=[-1, 0, 0],
nargs=3, type=float, help='Spacecraft velocity vector in km/s',
metavar=('Vx', 'Vy', 'Vz'))
parser.add_argument('-s', '--ena-speed', dest='enaspeed', default=50.,
type=float, help='ENA velocity to be measured in km/s')
parser.add_argument('-i', '--io-phase', dest='iophase', default=0,
type=float, help="Io's phase in degrees at t=0")
parser.add_argument('-r', '--resolution', dest='resolution', default=101,
type=int, help="Resolution of calculation.")
parser.add_argument('--primary-axis', dest='pax', default=None,
nargs=3, type=float, help='Primary axis vector',
metavar=('Px', 'Py', 'Pz'))
parser.add_argument('--secondary-axis', dest='sax', default=None,
nargs=3, type=float, help='Secondary axis vector',
metavar=('Sx', 'Sy', 'Sz'))
parser.add_argument('-o', '--output', dest='output', default=None,
help='Output data file name (text)')
parser.add_argument('-l', '--max-angle', dest='maxangle', default=50,
type=float, help='Maximum angle calculated')
parser.add_argument('-m', '--mass', dest='mass', default=16,
type=float, help='Mass in AMU')
parser.add_argument('-p', '--sun-phase-system3', dest='sunsys3long', default=0.,
type=float, help='Sun system-3 longitude (deg)')
args = parser.parse_args()
return args
if __name__ == "__main__":
args = parse()
main(args.scpos, args.scvel, args.enaspeed, args.iophase, output=args.output, primary_axis=args.pax, secondary_axis=args.sax, resolution=args.resolution, maxangle=args.maxangle, mass=args.mass, sunsys3long_t0=args.sunsys3long)