@@ -195,14 +195,15 @@ def load_movie(self,var='NOT_SET',time=None,local=False):
#print 'dat_type = ',dat_type
grid_pts = ney*nex
with open(fname,'r') as f:
for _,chose in enumerate(time):
for c,chose in enumerate(time):

f.seek(chose*grid_pts*dat_type.itemsize, 0)
byte_arr[_,:,:] = np.fromfile(f,
byte_arr[c,:,:] = np.fromfile(f,
dtype=dat_type,
count=grid_pts
).reshape(ney,nex)

byte_arr[_,:,:] = (1.0*byte_arr[_,:,:] + shft_cst)* \
byte_arr[c,:,:] = (1.0*byte_arr[c,:,:] + shft_cst)* \
(lmax[chose]-lmin[chose]) \
/(1.0*norm_cst) + lmin[chose]

@@ -56,8 +56,8 @@ def plot_2D(ax,CR,var,
ax.set_ylim(extent[2:])
ax.autoscale(False)

ax.set_xlabel(r'$X (d_i)$',size=8)
ax.set_ylabel(r'$Y (d_i)$',size=8)
ax.set_xlabel(r'$X\ (d_i)$',size=8)
ax.set_ylabel(r'$Y\ (d_i)$',size=8)
ax.set_title(title+': %1.3f, %1.3f'%(var.min(),var.max()),size=8)

lsz = 6
@@ -158,6 +158,8 @@ def plot_1D(ax,CR,var,
xmp = CR['yy'][abs(CR['bxav'][:,ip]).argmin()]
draw_line(ax,cut='x',offset=0.)
draw_line(ax,cut='y',offset=xmp)
# or just draw it at the new 0
#draw_line(ax,cut='y',offset=0.)

plt.sca(ax)
plt.minorticks_on()
@@ -269,6 +269,7 @@ def calc_psi(CR):
else:
bx = CR['bx']
by = CR['by']

psi = 0.0*bx
psi[0,1:] = np.cumsum(by[0,1:])*(CR['yy'][2] - CR['yy'][1])
psi[1:,:] = psi[0,:] - np.cumsum(bx[1:,:],axis=0)*(CR['xx'][2] - CR['xx'][1])
@@ -385,15 +386,30 @@ def roll_run(CR,sx=None):
""" Roll every variable in a simulation (CR)
in the x direction by length in indexspace (sx)
"""

klst = ['rho','jx','jy','jz','bx','by','bz',
'ex','ey','ez','ne','jex','jey','jez',
'pexx','peyy','pezz','pexy','peyz','pexz',
'ni','jix','jiy','jiz','vix','viy','viz',
'vex','vey','vez','dene','deni',
'pixx','piyy','pizz','pixy','piyz','pixz',
'tepar','teperp1','tipar','tiperp1']

kavlst = [k+'av' for k in klst]
if sx is None:
if CR['yy'][0] < 1.0:
print 'Gonna roll RIGHT!!!!!!!!!!!!'
sx = -1*np.size(CR['xx'])/4
else:
print 'Gonna roll LEFT!!!!!!!!!!!!'
sx = np.size(CR['xx'])/4

for key in CR.keys():
if key.rfind('av') == len(key)-2 and len(key) > 2:
# Old way not super smart
# if key.rfind('av') == len(key)-2 and len(key) > 2:
# print 'Rolling ',key
# CR[key] = np.roll(CR[key],sx,axis=1)
# New way a little bit smarter
if key in klst or key in kavlst:
print 'Rolling ',key
CR[key] = np.roll(CR[key],sx,axis=1)