示例#1
0
def psidsp(ids=None, phi=-90):
    """ psi sine square vs d-spacing """
    import matplotlib.pyplot as plt
    fnlin = __sort__.main(mode='lin', i=ids)
    fn = None
    for i in range(len(fnlin)):
        p = float(fnlin[i].split('Phi')[1]\
                      .split('.')[0])
        if p==phi:
            fn = fnlin[i]
            break
    if fn==None: raise IOError, \
            '%Phi is not found'%phi

    d1, d2 = __reader__.main(fn = fn, mode='lin')
    sin2psi1 = d1.get('sin2psi')
    print 'sin2psi1', sin2psi1
    dspc1 = d1.get('dspacing')
    sin2psi2 = d2.get('sin2psi')
    dspc2 = d2.get('dspacing')

    ax = plt.gca()
    ax.plot(sin2psi1, dspc1, marker='x',
            label='detector1  %i at phi=%f'%(ids,phi))
    ax.plot(sin2psi2, dspc2, marker='+',
            label='detector2  %i at phi=%f'%(ids,phi))
    ax.legend(loc='best', fancybox=True).get_frame().set_alpha(0.5)
示例#2
0
def psidsp(ids=None, phi=-90):
    """ psi sine square vs d-spacing """
    import matplotlib.pyplot as plt
    fnlin = __sort__.main(mode='lin', i=ids)
    fn = None
    for i in xrange(len(fnlin)):
        p = float(fnlin[i].split('Phi')[1]\
                      .split('.')[0])
        if p == phi:
            fn = fnlin[i]
            break
    if fn==None: raise IOError, \
            '%Phi is not found'%phi

    d1, d2 = __reader__.main(fn=fn, mode='lin')
    sin2psi1 = d1.get('sin2psi')
    print 'sin2psi1', sin2psi1
    dspc1 = d1.get('dspacing')
    sin2psi2 = d2.get('sin2psi')
    dspc2 = d2.get('dspacing')

    ax = plt.gca()
    ax.plot(sin2psi1,
            dspc1,
            marker='x',
            label='detector1  %i at phi=%f' % (ids, phi))
    ax.plot(sin2psi2,
            dspc2,
            marker='+',
            label='detector2  %i at phi=%f' % (ids, phi))
    ax.legend(loc='best', fancybox=True).get_frame().set_alpha(0.5)
示例#3
0
def readstress(i1=0,i2=0,path='.'):
    """ stress and its error bar for the given
    (i1, i2) component """
    fntr, dummy_ids = __sort__.main(mode='tr',path=path)
    sig = []
    err = []
    for i in range(len(fntr)):
        cfn = fntr[i]
        s, er = __reader__.main(cfn, mode='tr')
        sig.append(s[i1,i2])
        err.append(er[i1,i2])
    return sig, err, fntr
示例#4
0
def readstress(i1=0, i2=0, path='.'):
    """ stress and its error bar for the given
    (i1, i2) component """
    fntr, dummy_ids = __sort__.main(mode='tr', path=path)
    sig = []
    err = []
    for i in xrange(len(fntr)):
        cfn = fntr[i]
        s, er = __reader__.main(cfn, mode='tr')
        sig.append(s[i1, i2])
        err.append(er[i1, i2])
    return sig, err, fntr