#from simParam import *
import math
from units import *

plot  = []

## Examples:
##http://matplotlib.github.com/api/pyplot_api.html#matplotlib.pyplot.plot
## HINT: newplot == False, can be used to generate multiple plots
## polynomial fit of the input data and plot additional points given in 'pnts'
#plot.append(dict(kind = 'polyfit',data=['inlet_ubb_outlet_expol/tracking/2D_line_velocity_in_p00000_t00000002.000E+00.res'],
#           row=[1,-1],col=[2,4],
#           convertPhy = True, xfac = 1.0, yfac = u_lp,
#           pnts = [0,height],newplot = False))

## Fast fourier transformation
#plot.append(dict(kind = 'FFT',data=['tracking_dnt/2D_probe_velocity_p00001.res'],
#           row=[1,-1],col=[1,3],
#           convertPhy = True, xfac = dt, yfac = u_lp))
#
### pressure difference between two points
#height =  0.41
#u_in_L = 0.05
#u_in_phy = 0.3
#nHeight = 50
#dx = getdxFromnL(height,nHeight)
#dt = getdt_acoustic(dx,u_in_L,u_in_phy)
#pr_lp = getpress_p(dx,dt,1.0)



#Level 7 Plot
#dx= 0.0080078125
#dt=1.541104234165e-05   
#print dx,dt
#print dx*dx/dt/dt
#H=2.*2.098297E-01
#x1=0.10087967E+01
##p1=1
### xy plot 
show_plot = True
#pressFac = fac
##p_ref = -uPhys*8*viscPhys/H/H*(x-x1) + p1
#plot.append(dict(kind = 'xy',data=['tracking/channel_RM_quadraticCompact_pressCutX_l7_p*_t*.res'],
#           row=[1,-1],col=[1,4], title = 'level 7',
#           convertPhy = True, xfac = 1.0, yfac = pressFac, newplot = True, ls='g.',label='quadratic'))
#plot.append(dict(kind = 'xy',data=['tracking/channel_RM_linear_pressCutX_l7_p*_t*.res'],
#           row=[1,-1],col=[1,4],  
#           convertPhy = True, xfac = 1.0, yfac = pressFac, newplot = False, ls='k.',label='linear'))
#plot.append(dict(kind = 'xy',data=['tracking/channel_singleLevel_pressCutX_l8_p*_t*.res'],
#           row=[1,-1],col=[1,4], 
#           convertPhy = True, xfac = 1.0, yfac = pressFac, figname = 'dp_l7', ls='r-.',label='reference',saveplot = True))
##
#dx = 0.00400390625 
#dt = 7.7055211708251e-06   
### Level 8 Plot
#plot.append(dict(kind = 'xy',data=['tracking/channel_RM_quadraticCompact_pressCutX_l8_p*_t*.res'],
#           row=[1,-1],col=[1,4],   title = 'level 8',
#           convertPhy = True, xfac = 1.0, yfac = fac, newplot = True, ls='g.',label='quadratic'))
#plot.append(dict(kind = 'xy',data=['tracking/channel_RM_linear_pressCutX_l8_p*_t*.res'],
#           row=[1,-1],col=[1,4],  
#           convertPhy = True, xfac = 1.0, yfac = fac, newplot = False, ls='k.',label='linear'))
#plot.append(dict(kind = 'xy',data=['tracking/channel_singleLevel_pressCutX_l9_p*_t*.res'],
#           row=[1,-1],col=[1,4],  
#           convertPhy = True, xfac = 1.0, yfac = fac, figname = 'dp_l8', ls='r-.',label='reference',saveplot = True))

# Level 8 Parameters
dx = 2.*0.00400390625   
dt = 2.*7.7055211708251e-06   
fac8 = dx*dx/dt/dt
# Level 9 Parameters
dx = 0.00400390625   
dt = 7.7055211708251e-06   
fac9 = dx*dx/dt/dt
# Level 10 Plot
dx = 0.002001953125  
dt = 3.8527605854125e-06   
fac10 = dx*dx/dt/dt

plot.append(dict(kind = 'xy',data=['tracking/channel_RM_quadraticCompact_pressCutX_l9_p*_t*.res'],
           row=[1,-1],col=[1,4],   title = 'level 9 om196',
           convertPhy = True, xfac = 1.0, yfac = fac9, newplot = True, ls='g.',label='quadratic'))
plot.append(dict(kind = 'xy',data=['tracking/channel_RM_linear_pressCutX_l9_p*_t*.res'],
           row=[1,-1],col=[1,4],  
#           convertPhy = True, xfac = 1.0, yfac = fac9, newplot = False, ls='k.',label='linear'))
           convertPhy = True, xfac = 1.0, yfac = fac9, figname = 'dp_l9_om196', ls='k.',label='linear',saveplot = True))
#plot.append(dict(kind = 'xy',data=['tracking/channel_singleLevel_pressCutX_l10_p*_t*.res'],
#           row=[1,-1],col=[1,4],  
#           convertPhy = True, xfac = 1.0, yfac = fac10, figname = 'dp_l9_om196', ls='r-.',label='reference',saveplot = True))

plot.append(dict(kind = 'xy',data=['tracking_plot/channel_RM_quadraticCompact_pressCutX_l9_p*_t*.res'],
           row=[1,-1],col=[1,4],   title = 'level 9 om186',
           convertPhy = True, xfac = 1.0, yfac = fac9, newplot = True, ls='g.',label='quadratic'))
plot.append(dict(kind = 'xy',data=['tracking_plot/channel_RM_linear_pressCutX_l9_p*_t*.res'],
           row=[1,-1],col=[1,4],  
           convertPhy = True, xfac = 1.0, yfac = fac9, newplot = False, ls='k.',label='linear'))
plot.append(dict(kind = 'xy',data=['tracking_plot/channel_singleLevel_pressCutX_l10_p*_t*.res'],
           row=[1,-1],col=[1,4],  
           convertPhy = True, xfac = 1.0, yfac = fac10, newplot = False, ls='b-',label='reference l10'))
plot.append(dict(kind = 'xy',data=['tracking_plot/channel_singleLevel_pressCutX_l9_p*_t*.res'],
           row=[1,-1],col=[1,4],  
           convertPhy = True, xfac = 1.0, yfac = fac9, figname = 'dp_l9_om186', ls='r-.',label='reference l9',saveplot = True))

