currycarbon-0.3.0.1: A package for simple, fast radiocarbon calibration
Safe HaskellSafe-Inferred
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

renderCalDatePretty Source #

Arguments

:: Bool

Should the CLI plot be restricted to (boring) ASCII symbols?

-> (NamedCalExpr, CalPDF, CalC14) 
-> String 

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

CalEXPR: [Ex2] (S1:5000±30BP + S2:5100±100BP)
Calibrated: 4150BC >> 3941BC > 3814BC < 3660BC << 3651BC
1-sigma: 3941-3864BC, 3810-3707BC, 3667-3660BC
2-sigma: 4150-4148BC, 4048-3651BC
                                          ▁
                                          ▒▁ ▁▁
                                  ▁▁▁    ▁▒▒▁▒▒
                                ▁▁▒▒▒    ▒▒▒▒▒▒
                              ▁▁▒▒▒▒▒▁▁▁▁▒▒▒▒▒▒▁ ▁
                          ▁▁▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁▒▁
        ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▁▁▁▁
 -4330 ┄──┬─────┬─────┬─────┬──────┬─────┬─────┬─────┬─────┄ -3530
                   >            >       ^         <
                                ──────  ──────── ──
                   ─     ──────────────────────────

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

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

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

id  hdrSigmaLevel  hdrStartYearBCAD  hdrStopYearBCAD
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 .tsv file with the following structure:

id  yearBCAD  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
...

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

writeRandomAgeSamples :: FilePath -> [RandomAgeSample] -> IO () Source #

Write RandomAgeSampless to the file system. The output file is a long .tsv file with the following structure:

id  yearBCAD
...
Sample1  -1221
Sample1  -1211
Sample1  -1230
Sample1  -1225
...
Sample2  -3763
Sample2  -3788
Sample2  -3767
Sample2  -3774
...