Introduction

The main function of this module is to convert recored peak intensities to particle sizes and create a sizedistribution instance.

Imports


In [1]:
from atmPy.aerosols.instruments.POPS import peaks,calibration
import matplotlib.pylab as plt
from atmPy.tools import plt_tools
import numpy as np

In [2]:
%matplotlib inline
plt_tools.setRcParams(plt)

Reading a Peak file

Different file formats emerged during the development of POPS, which resulted in different functions with various optional parameters to read the files. Hopefully you will only need to use the following one which emerged in fall 2015.


In [3]:
import pathlib

In [4]:
filename = pathlib.Path('./data/POPS_Peak.bin')
type(filename)


Out[4]:
pathlib.PosixPath

In [5]:
measurement = peaks.read_binary(filename, version='labview', verbose=True)


fname is file
_read_PeakFile_Binary (version = labview)

In [6]:
measurement.data


Out[6]:
Ticks Amplitude Width Saturated Masked
Time_UTC
2015-10-09 19:57:41.591561317 38296026 130.0 40 0 1
2015-10-09 19:57:41.591561317 38335786 52.0 20 0 0
2015-10-09 19:57:41.591561317 38343924 25.0 6 0 1
2015-10-09 19:57:41.591561317 38344486 779.0 35 0 0
2015-10-09 19:57:41.591561317 38397876 103.0 28 0 0
... ... ... ... ... ...
2015-10-09 19:57:59.591883659 38276352 721.0 25 0 0
2015-10-09 19:57:59.591883659 38276821 43.0 11 0 1
2015-10-09 19:57:59.591883659 38280823 205.0 25 0 0
2015-10-09 19:57:59.591883659 38294008 893.0 16 0 0
2015-10-09 19:57:59.591883659 38294354 34.0 6 0 1

67386 rows × 5 columns

Sizing

To convert peak heights to particle sizes we first have to load a calibration file. Further information on calibration can be found here.


In [4]:
cal = calibration.read_csv('./data/POPS_calibration.csv')

Then we apply this calibration which adds an extra column to the data set containg the particle size.


In [5]:
measurement.apply_calibration(cal)


	 25905 from 67386 peaks (38 %) are outside the calibration range (amplitude = [53.703179637, 31622.7766017], diameter = [130, 2500])
		 25904 too small
		 1 too big

Convert to size distribution

Either use use the default bins or define your own.


In [6]:
bins = np.logspace(np.log10(120), np.log10(3000), 100)
sd = measurement.peak2sizedistribution(bins = bins)

In [7]:
sd.plot()


Out[7]:
(<matplotlib.figure.Figure at 0x112451160>,
 <matplotlib.axes._subplots.AxesSubplot at 0x112451a58>,
 <matplotlib.collections.QuadMesh at 0x1124da7f0>,
 <matplotlib.colorbar.Colorbar at 0x10851fa90>)

In [8]:
sd.particle_number_concentration_outside_range.plot()


Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x117149940>

normalize to flow rate

You probably want to normalize the particle rates to particle concentrations by dividing by the flow rate. It is important not to apply operations solely to the data container. Instead perform the opperation on the entire sizedistribution instance.


In [9]:
sd /= 3

In [10]:
sd.plot()


Out[10]:
(<matplotlib.figure.Figure at 0x117203978>,
 <matplotlib.axes._subplots.AxesSubplot at 0x11717eba8>,
 <matplotlib.collections.QuadMesh at 0x1172137b8>,
 <matplotlib.colorbar.Colorbar at 0x10d6680b8>)

In [11]:
sd.particle_number_concentration_outside_range


Out[11]:
                     # too big
2015-10-09 19:57:41   0.000000
2015-10-09 19:57:42   0.000000
2015-10-09 19:57:43   0.000000
2015-10-09 19:57:44   0.000000
2015-10-09 19:57:45   0.000000
2015-10-09 19:57:46   0.000000
2015-10-09 19:57:47   0.000000
2015-10-09 19:57:48   0.000000
2015-10-09 19:57:49   0.000000
2015-10-09 19:57:50   0.333333
2015-10-09 19:57:51   0.000000
2015-10-09 19:57:52   0.000000
2015-10-09 19:57:53   0.000000
2015-10-09 19:57:54   0.000000
2015-10-09 19:57:55   0.000000
2015-10-09 19:57:56   0.000000
2015-10-09 19:57:57   0.000000
2015-10-09 19:57:58   0.000000
2015-10-09 19:57:59   0.000000

Done! Now you can do what ever you can do with a sizedistribution instance (see here). E.g. save it, or plot it


In [9]:
sd.save_csv('./data/POPS_Peak.bin.dist')

In [ ]: