# -*-Python-*-
# Created by bgrierson at 17 Feb 2017 15:51
# Make two shots
# One shot is near the target, then other shot is off a little in betan
# and a lot in torque, but close in q95
from pylab import random
betanTarget = 1.8
q95Target = 3.1
tinjTarget = 0.1
shot = np.array([np.repeat(1, 50), np.repeat(2, 50)]).flatten()
time = np.array([linspace(2000, 5000, 50), linspace(2000, 5000, 50)]).flatten()
q95 = np.array([3.1 + q95Target * 0.1 * random(50), 3.1 + q95Target * 0.1 * random(50)]).flatten()
betan = np.array([1.8 + betanTarget * 0.1 * random(50), 2.1 + betanTarget * 0.1 * random(50)]).flatten()
tinj = np.array([0.1 + tinjTarget * 0.1 * random(50), 0.25 + tinjTarget * 0.1 * random(50)]).flatten()
betan = 1.0 / np.abs(betan - betanTarget)
q95 = 1.0 / np.abs(q95 - q95Target)
tinj = 1.0 / np.abs(tinj - tinjTarget)
shotS = pandas.Series(shot, index=time, name='Shot')
timeS = pandas.Series(time, index=time, name='time')
betanS = pandas.Series(betan, index=time, name='betaN')
q95S = pandas.Series(q95, index=time, name='q95')
tinjS = pandas.Series(tinj, index=time, name='tinj')
df = pandas.DataFrame({'shot': shotS, 'betan': betanS, 'q95': q95S, 'tinj': tinjS})
fig, ax = plt.subplots()
pandas.plotting.radviz(df, 'shot', ax=ax)