In [1]:
#pylab mode
#remove the option inline to open plot windows using the selected gui backend. Induvidual graphs can stille be embedded using display(youfigure) 
%pylab inline 
#some imports for convenience
from __future__ import division
from lmfit import lmfit
from angular_distr import *
#some typesetting preferences
matplotlib.rcParams.update({'font.size': 14, 'font.family': 'serif'})


Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.

In [2]:
intensities = [1.8181650771537534e-12, -1.21367978055561e-10, -2.4496892707856074e-10, -4.6333798025784959e-10, -6.6702598957224955e-10,\
 -9.6617893690204617e-10, -1.2287767430760598e-09, -1.5218150811163994e-09, -1.2379226258147593e-09, -9.1848674608014203e-10,\
 -5.2666183628298662e-10, -2.8991781264242726e-10, -2.1511541145914503e-10, -2.1435088276325482e-10, -1.7135883298721443e-10,\
 -1.2938154635344409e-10, -1.0793197039570779e-10]
intensities = intensities
pos = arange(1,9,0.5)
print intensities, pos


[1.8181650771537534e-12, -1.21367978055561e-10, -2.4496892707856074e-10, -4.633379802578496e-10, -6.670259895722495e-10, -9.661789369020462e-10, -1.2287767430760598e-09, -1.5218150811163994e-09, -1.2379226258147593e-09, -9.18486746080142e-10, -5.266618362829866e-10, -2.8991781264242726e-10, -2.1511541145914503e-10, -2.1435088276325482e-10, -1.7135883298721443e-10, -1.293815463534441e-10, -1.079319703957078e-10] [ 1.   1.5  2.   2.5  3.   3.5  4.   4.5  5.   5.5  6.   6.5  7.   7.5  8.
  8.5]

In [3]:
from tof_analysis import SurfacePosMeas
surfpos = arange(30,33,0.2)
power = [0.3, 0.3, 0.285, 0.275, 0.255, 0.24, 0.23, 0.2, .179, .155, .129, .107, .082, .066, .047]
SPM1 = SurfacePosMeas(surfpos, power, IRPos=7)



In [4]:
intensities = [-1.8181650771586907e-12, 1.2136797805557116e-10, 3.1400260112554549e-10, 4.6333798025784809e-10, 6.6702598957224872e-10, 9.6617893690203231e-10, 
1.2287767430760787e-09, 1.5218150811163204e-09, 1.2379226258147202e-09, 9.1848674608014328e-10, 5.2666183628299624e-10, 
2.8991781264240627e-10, 2.1511541145913797e-10, 2.1435088276325966e-10, 1.7135883298721531e-10, 1.2938154635346852e-10, 1.079319703957058e-10]
pos = arange(1,9.5,0.5)
surfpos = arange(30,33,0.2)
power = [0.3, 0.3, 0.285, 0.275, 0.255, 0.24, 0.23, 0.2, .179, .155, .129, .107, .082, .066, .047]
SPM1 = SurfacePosMeas(surfpos, power, IRPos=7)
Setups = [REMPISetup(SPM1, {'REMPI': 0, 'Center ZRM': 5.1, 'ZRM': zrm, 'Surface Y': 35}) for zrm in pos]
AngDistr = AngularDistribution(Setups, intensities, exclude=[7])


/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/projections/polar.py:145: RuntimeWarning: invalid value encountered in divide
  theta = np.arccos(x / r)
angular_distr.py:41: RuntimeWarning: invalid value encountered in power
  return A * cos(radians(theta-theta0))**m

In [5]:
plot(AngDistr.Angles, AngDistr.Integrals, 'bo')
show()



In [6]:
AngDistr.fit(exclude=[7], verbose=False, plot=True)
AngDistr.plot()



In [7]:
AngDistr.fig.savefig('AngDistr.pdf')

In [8]:
rm -f 'AngDistr.pdf'

In [9]:
filenum = range(14,31,1)
#IntegrateScopeTrace('testdata/2305', filenum) # uncomment to start the scope trace integrator gui

In [9]: