#! /usr/bin/env python # # # Specific imports for the read-in of parameters and the calculate of the # trajectory. The calc_trajectory method will also output the range of the shot. # from ParticleMotionInput import read_parameters from ParticleMotion import calc_trajectory import pylab ######################## # Get params and run it ######################## # # Here we use a method to read-in parameters before we calculate one single # trajectory and plot it. # LAUNCHVELOCITY, LAUNCHANGLE, B2_MASS, DT = read_parameters() xs, ys = calc_trajectory(LAUNCHVELOCITY, LAUNCHANGLE, B2_MASS, DT) tname = "v=%2.2f m/s, theta=%2.2f deg, b2/m=%2.2e 1/m" % (LAUNCHVELOCITY, LAUNCHANGLE, B2_MASS) lname = "dt=%2.2f" % DT pylab.title('Projectile trajectory for '+tname) pylab.ylabel('Height / m') pylab.xlabel('Distance / m') plot = pylab.plot(xs,ys, linewidth=1.0) pylab.legend([plot],[lname],loc='upper left') pylab.grid(True, alpha=0.2) pylab.show()