Calibrate a CRM and test

Code: / Data files: available from GitHub

Here we import one .dat file (generated by a VINDTA instrument) for a certified reference material (CRM) measurement and use it to calibrate the acid concentration. We then test the calibration by checking that it returns the certified alkalinity value.

We bgin by defining the CRM's certified properties:

import calkulate as calk

# Certified reference material (CRM) batch 144 values from:
pSal = 33.571
totalCarbonate = 2031.53e-6
totalPhosphate = 0.31e-6
totalSilicate = 2.5e-6
alkCert = 2238.60e-6

Next, we import and prepare the .dat file:

# Import a VINDTA-generated .dat file from a real CRM-144 analysis
volSample = 99.981 # ml
datFile = 'datfiles/CRM-144-0435-4.dat'
massAcid, emf, tempK, massSample, concTotals, eqConstants = \
    calk.datfile.prep(datFile, volSample, pSal, totalCarbonate, totalPhosphate,

Now we can calibrate the acid concentration, and check that it returns the certified alkalinity value when applied to the same sample:

# Calibrate the acid concentration based on this CRM measurement
concAcid = calk.calibrate.concAcid(massAcid, emf, tempK, massSample, alkCert,
    concTotals, eqConstants)['x'][0]

# Check that the calibrated acid concentration returns the correct alkalinity
alk = calk.solve.complete(massAcid, emf, tempK, massSample, concAcid,
    concTotals, eqConstants)['x'][0]
print('Certified alkalinity  = {:.2f} micromol/kg-sw'.format(alkCert*1e6))
print('Calibrated alkalinity = {:.2f} micromol/kg-sw'.format(alk*1e6))

Finally, Calkulate includes some plotting functions to help visualise the calculation steps, for example:

# Visualise "everything" about this titration
calk.plot.everything(datFile, volSample, pSal, totalCarbonate, totalPhosphate,
    totalSilicate, concAcid)