SOLPSutils.py
def B2pl(cmds, wdir='.', debug=False):
    """
    runs B2plot with the commands used in the call and reads contents of the resulting
    b2plot.write file into two lists
    
    ** Make sure you've sourced the setup script first, or this won't work! **
    **  Make sure B2PLOT_DEV is set to 'ps'
    """

    if debug:
        cmdstr = 'echo "' + cmds + '" | b2plot'
        print(cmdstr)
    else:
        cmdstr = 'echo "' + cmds + '" | b2plot >&/dev/null'
    system(cmdstr)

    fname = path.join(wdir, 'b2pl.exe.dir', 'b2plot.write')
    x, y = [], []
    with open(fname) as f:
        lines = f.readlines()
    for line in lines:
        elements = line.split()
        if elements[0] == '#':
            pass
        else:
            x.append(float(elements[0]))
            y.append(float(elements[1]))
    x = x[0:(len(x) / 2)]  # used to be: x=x[0:(len(x)/2)-1], chopped final value
    y = y[0:(len(y) / 2)]

    return x, y

    runs B2plot with the commands used in the call and reads contents of the resulting
    b2plot.write file into two lists
    
    ** Make sure you've sourced the setup script first, or this won't work! **
    **  Make sure B2PLOT_DEV is set to 'ps'
    
runs B2plot with the commands used in the call and reads contents of the resulting
b2plot.write file into two lists

Make sure you've sourced the setup script first, or this won't work.
Make sure B2PLOT_DEV is set to 'ps'
runs B2plot with the commands used in the call and reads contents of the resulting b2plot . write file into two lists Make sure you ' ve sourced the setup script first or this won ' t work . Make sure B2PLOT_DEV is set to ' ps '
def B2pl(cmds, wdir='.', debug=False):
    if debug:
        cmdstr = 'echo "' + cmds + '" | b2plot'
        print(cmdstr)
    else:
        cmdstr = 'echo "' + cmds + '" | b2plot >&/dev/null'
    system(cmdstr)
    fname = path.join(wdir, 'b2pl.exe.dir', 'b2plot.write')
    x, y = [], []
    with open(fname) as f:
        lines = f.readlines()
    for line in lines:
        elements = line.split()
        if elements[0] == '#':
            pass
        else:
            x.append(float(elements[0]))
            y.append(float(elements[1]))
    x = x[0:(len(x) / 2)]  
    y = y[0:(len(y) / 2)]
    return x, y
def B2pl ( cmds , wdir = '.' , debug = False ) : if debug : cmdstr = 'echo "' + cmds + '" | b2plot' print ( cmdstr ) else : cmdstr = 'echo "' + cmds + '" | b2plot >&/dev/null' system ( cmdstr ) fname = path . join ( wdir , 'b2pl.exe.dir' , 'b2plot.write' ) x , y = [ ] , [ ] with open ( fname ) as f : lines = f . readlines ( ) for line in lines : elements = line . split ( ) if elements [ 0 ] == '#' : pass else : x . append ( float ( elements [ 0 ] ) ) y . append ( float ( elements [ 1 ] ) ) x = x [ 0 : ( len ( x ) / 2 ) ] y = y [ 0 : ( len ( y ) / 2 ) ] return x , y
runs B2plot with the commands used in the call and reads contents of the resulting
b2plot.write file into two lists
runs B2plot with the commands used in the call and reads contents of the resulting b2plot . write file into two lists
"""
    runs B2plot with the commands used in the call and reads contents of the resulting
    b2plot.write file into two lists
    
    ** Make sure you've sourced the setup script first, or this won't work! **
    **  Make sure B2PLOT_DEV is set to 'ps'
    """ # used to be: x=x[0:(len(x)/2)-1], chopped final value
cmds
wdir
debug