In [1]:
%load_ext autoreload
%autoreload 2

import pandas as pd
import numpy as np

import latools as la

from IPython.display import HTML

from comparison_tools import helpers, stats_1sample, plots_1sample

%matplotlib inline

Data Collection Parameters


In [2]:
HTML(filename="./Parameter_Tables/iolite_data.html")


Out[2]:
Parameter Value
Laser Instrument Photon M G2 System
Energy 1.48 J/cm3
Wavelength 193 nm
Pulse Length nanosecond
Repetition Rate 4 Hz
Spot Size 35x35 μm square
Interface Sample Cell Type 2 Volume Helex
Gas Flows 1 L min-1 He
8 ml min-1 N2
Transfer Devices Squid, particle filter
Mass Spec Type Thermo iCAP-Q Quadrupole ICPM-MS
11B 50 ms
24Mg 40 ms
25Mg 70 ms
27Al 30 ms
43Ca 80 ms
55Mn 30 ms
57Fe 20 ms
63Cu 20 ms
66Zn 20 ms
88Sr 50 ms
Cycle Time 410 ms

Import Data


In [3]:
# define data format description so it can be imported by latools
dataformat = {'genfromtext_args': {'delimiter': ',',
                                   'skip_header': 15},
              'column_id': {'name_row': 13,
                            'delimiter': ',',
                            'timecolumn': 0,
                            'pattern': '([0-9]{1,3}[A-z]{1,2})'},
              'meta_regex': {0: (['name', 'date'],
                                 '([A-z0-9-]+):([0-9/ :AMP]+);')}
             }

In [4]:
dat = la.analyse('raw_data/iolite_data', internal_standard='43Ca', srm_identifier='NIST610',
                 dataformat=dataformat, names='metadata_names')


Loading Data:   5%|▍         | 11/225 [00:00<00:01, 107.76it/s]
Starting analysis using "UCD-AGILENT" configuration:
Loading Data: 100%|██████████| 225/225 [00:00<00:00, 314.09it/s]
  225 Data Files Loaded: 15 standards, 210 samples
  Analytes: 11B 24Mg 25Mg 27Al 43Ca 55Mn 57Fe 63Cu 66Zn 88Sr
  Internal Standard: 43Ca


In [5]:
sample = '1308H1-1e'

In [6]:
dat.data[sample].tplot()  # view raw data


Out[6]:
(<Figure size 720x288 with 1 Axes>,
 <matplotlib.axes._axes.Axes at 0x7f7c41b67438>)

Data Processing


In [7]:
# despiking
dat.despike(noise_despiker=True, win=3)


Despiking: 100%|██████████| 225/225 [00:00<00:00, 1375.82it/s]

In [8]:
dat.data[sample].tplot()  # view despiked data


Out[8]:
(<Figure size 720x288 with 1 Axes>,
 <matplotlib.axes._axes.Axes at 0x7f7c416760b8>)

In [9]:
dat.autorange(on_mult=[3,.6], off_mult=[.5,3])


AutoRange: 100%|██████████| 225/225 [00:04<00:00, 58.09it/s]

*****************************************
                 WARNING
*****************************************
Autorange failed for some samples:
  1308H1-13c : 58.7
  1308H1-7a  : 59.5

*** THIS IS NOT NECESSARILY A PROBLEM ***
But please check the plots below to make
sure they look OK. Failures are marked by
dashed vertical red lines.

To examine an autorange failure in more
detail, use the `autorange_plot` method
of the failing data object, e.g.:
dat.data['Sample'].autorange_plot(params)
*****************************************


In [10]:
dat.data[sample].tplot(ranges=True)  # view autorange info


Out[10]:
(<Figure size 720x288 with 1 Axes>,
 <matplotlib.axes._axes.Axes at 0x7f7c403101d0>)

In [11]:
dat.bkg_calc_weightedmean(weight_fwhm=1000, bkg_filter=True)

In [12]:
fig, ax = dat.bkg_plot()


Plotting backgrounds: 100%|██████████| 10/10 [00:15<00:00,  2.29s/it]