In [10]:
from atmPy.instruments.POPS import calibration
from atmPy.tools import plt_tools
%matplotlib inline
plt_tools.setRcParams(plt)

How to use it

Read and save Data

This section shows how to read and save calibration data. In the process the data will be fit and a calibration function is created. Data and function can be plotted using the plot function mentioned below.

read from string

create a string where each line consist of a diameter value (in nm) and an amplitude (in digitizer bin) seperated by space.
Note, in the example below the secend column is the $log_{10}(amplitude)$. The following cell does the convertion!


In [2]:
data = """130 1.73
140 1.85
150 1.99
173 2.28
200 2.53
233 2.77
270 2.96
315 3.04
365 3.165
420 3.213
490 3.355
570 3.56
660 3.72
770 3.795
890 3.86
1040 4.0
1200 4.05
1400 4.1
1600 4.18
1880 4.32
2180 4.44
2500 4.5"""

In [6]:
cal = calibration.read_str(data)


/Users/htelg/prog/atm-py/atmPy/instruments/POPS/calibration.py:140: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
  dataFrame = pd.read_csv(sb, sep = ' ', names = ('d','amp')).sort('d')

Save the calibration from above


In [7]:
fname = './data/POPS_calibration.csv'
cal.save_csv(fname)

read the file we just saved


In [8]:
out = calibration.read_csv(fname)

plot the created calibration function and data


In [11]:
f,a,df,gf = cal.plot_calibration()


Translate bins to diameters

This information is necessarey if data is provided prebinned e.g. when recorded through the serial interface.


In [17]:
out = calibration.get_interface_bins('/Users/htelg/data/POPS_calibrations/150529_MS1_DOS.csv', 16)


bin edges (digitizer bins)
--------------------------
25.1188643151
40.9732109814
66.8343917569
109.018449239
177.827941004
290.068119869
473.151258961
771.791515585
1258.92541179
2053.52502646
3349.65439158
5463.86549882
8912.50938134
14537.8438561
23713.7370566
38681.2054633
63095.734448

bin centers (digitizer bins)
----------------------------
33.0460376482
53.9038013691
87.9264204977
143.423195121
233.948030437
381.609689415
622.471387273
1015.35846369
1656.22521913
2701.58970902
4406.7599452
7188.18744008
11725.1766187
19125.7904563
31197.47126
50888.4699557

bin centers of logarithms (digitizer bins)
----------------------------
32.0811553282
52.3299114681
85.3591339291
139.23550682
227.117186728
370.467402211
604.296390238
985.711900901
1607.86654905
2622.70835647
4278.09081988
6978.3058486
11382.8234525
18567.3532463
30286.5636114
49402.6220766


bin edges (nm)
--------------
-13123.6305447
46.6840431939
142.571641329
159.767885528
180.088512944
203.671751733
231.442555915
278.203954665
365.079142428
503.584688239
594.171276073
766.230032055
1074.28311815
1688.60408594
2138.35179782
2864.23372769
5130.89339925

bin centers (nm)
----------------
-2561.44444891
134.554568952
151.969566777
170.665148909
193.010367613
218.190007849
253.014866483
324.659905185
460.571745708
551.637033828
666.96398972
940.939314753
1487.84671117
1932.77239747
2479.59889885
3719.97365794

bin centers of logarithms (nm)
----------------
-3309.42962297
133.362308214
150.931399559
169.42416447
191.575385102
216.53506681
250.309341542
319.830164546
453.185397003
546.293397888
657.293127812
926.222022082
1456.83312689
1906.16034672
2436.31185743
3592.45946861

In [ ]: