currycarbon-0.1.1.0: A package for simple, fast radiocarbon calibration
Safe HaskellNone
LanguageHaskell2010

Currycarbon.Parsers

Synopsis

Parsing, rendering and writing functions

This module contains a number of functions to manage data input and output plumbing for different datatypes

renderCalDatesPretty :: [(UncalC14, CalPDF, CalC14)] -> String Source #

Combine UncalC14, CalPDF and CalC14 to render pretty command line output like this:

Sample: 1 ~> [5000±30BP]
1-sigma: 3894-3880BC, 3797-3709BC
2-sigma: 3941-3864BC, 3810-3700BC, 3680-3655BC
                                    ***                      
                                   *'''**   *****            
                  ***             *''''''***'''''*           
            ******'''*            ''''''''''''''''      **   
           *''''''''''**        **''''''''''''''''*   **''*  
        ***'''''''''''''********'''''''''''''''''''***'''''**
 -3960 <~~~~~~~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~|~~~~~~~~~~> -3640

writeCalC14s :: FilePath -> [CalC14] -> IO () Source #

Write CalC14s to the file system. The output file is a long .csv file with the following structure:

sample,hdrSigma,hdrStartBCAD,hdrStopBCAD
Sample1,1,-3797,-3709
Sample1,1,-3894,-3880
Sample1,2,-3680,-3655
Sample1,2,-3810,-3700
Sample1,2,-3941,-3864
Sample2,1,-1142,-1130
Sample2,1,-1173,-1161
Sample2,1,-1293,-1194
Sample2,1,-1368,-1356
Sample2,2,-1061,-1059
Sample2,2,-1323,-1112
Sample2,2,-1393,-1334

writeCalPDFs :: FilePath -> [CalPDF] -> IO () Source #

Write CalPDFs to the file system. The output file is a long .csv file with the following structure:

sample,calBCAD,density
...
Sample1,-1391,2.8917924e-4
Sample1,-1390,3.3285577e-4
Sample1,-1389,3.5674628e-4
Sample1,-1388,3.750703e-4
...
Sample2,-3678,1.8128564e-3
Sample2,-3677,1.9512239e-3
Sample2,-3676,2.0227064e-3
Sample2,-3675,2.095691e-3
...

readUncalC14FromFile :: FilePath -> IO [UncalC14] Source #

Read uncalibrated radiocarbon dates from a file. The file should feature one radiocarbon date per line in the form "<sample name>,<mean age BP>,<one sigma standard deviation>", where <sample name> is optional. A valid file could look like this:

Sample1,5000,30
6000,50
Sample3,4000,25

readCalCurveFromFile :: FilePath -> IO CalCurveBP Source #

Read a calibration curve file. The file must adhere to the current version of the .c14 file format (e.g. here). Look here for other calibration curves