currycarbon: A package for simple, fast radiocarbon calibration

[ archaeoinformatics, library, mit, program ] [ Propose Tags ]

Radiocarbon calibration with the intercept method optimised for fast calibration of many dates.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.1.0, 0.2.1.0, 0.2.1.1, 0.2.1.2, 0.3.0.0, 0.3.0.1
Change log CHANGELOG.md
Dependencies base (>=4.14 && <5), currycarbon, filepath (>=1.4 && <1.5), math-functions (>=0.3 && <0.4), optparse-applicative (>=0.16 && <0.17), parsec (>=3.1 && <3.2), vector (>=0.12 && <0.13) [details]
License MIT
Author Clemens Schmid
Maintainer clemens@nevrome.de
Category Archaeoinformatics
Home page https://github.com/nevrome/currycarbon
Source repo head: git clone https://github.com/nevrome/currycarbon.git
Uploaded by nevrome at 2022-07-08T15:06:24Z
Distributions LTSHaskell:0.3.0.1, NixOS:0.3.0.1, Stackage:0.3.0.1
Executables currycarbon
Downloads 340 total (22 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-07-08 [all 1 reports]

Readme for currycarbon-0.2.1.0

[back to package description]

GitHub Workflow Status GitHub release (latest by date including pre-releases) GitHub all releases

currycarbon

Radiocarbon calibration module written in and for Haskell. Comes with a small CLI app to run calibration on the command line.

Library

The Haskell library is available on Hackage here. This repository stores the dev version with up-to-date documentation available here.

CLI app

For stable release versions we automatically prepare statically built binaries that can be downloaded and run directly.

You can download them here: [ Linux 📥 | macOS 📥 | Windows 📥 ]. Older release versions are available here.

So in Linux you can run the following commands to get started:

# download the current stable release binary
wget https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-Linux
# make it executable
chmod +x currycarbon-Linux
# test it
./currycarbon-Linux "Sample1,4990,30"
currycarbon v0.2.1.0 (UTF-8)
Method: Bchron {distribution = StudentTDist {ndf = 100.0}}
Curve: IntCal20
Calibrating...
DATE: Sample1:4990±30BP
Calibrated: 3936BC >> 3794BC > 3757BC < 3662BC << 3654BC
1-sigma: 3794-3707BC, 3666-3662BC
2-sigma: 3936-3874BC, 3804-3697BC, 3684-3654BC
                                     ▁▁▁    ▁▁▁▁            
                                   ▁▁▒▒▒▁▁▁▁▒▒▒▒▁           
                                   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒       ▁   
                  ▁▁              ▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁     ▁▒   
                ▁▁▒▒▁             ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒    ▁▒▒▁  
           ▁▁▁▁▁▒▒▒▒▒▁          ▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▒▒▒▒▁ 
        ▁▁▁▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▁▁▁▁▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁
 -3950 ┄─────────┬───────────────┬────────────────┬─────────┄ -3640
           >                      >     ^               < < 
                                  ────────────────      ─   
           ───────────           ──────────────────  ────── 
Done.
Usage: currycarbon [--version] [DATE] [-i|--inputFile ARG] 
                   [--calibrationCurveFile ARG] [--method ARG] [--allowOutside] 
                   [--noInterpolation] [-q|--quiet] [--densityFile ARG] 
                   [--hdrFile ARG] [--calCurveSegmentFile ARG] 
                   [--calCurveMatrixFile ARG]
  Intercept calibration of radiocarbon dates

Available options:
  -h,--help                Show this help text
  --version                Show version
  DATE                     A string with one or multiple uncalibrated dates of
                           the form "<sample name>,<mean age BP>,<one sigma
                           standard deviation>" where <sample name> is optional
                           (e.g. "S1,4000,50"). Multiple dates can be listed
                           separated by ";" (e.g. "S1,4000,50; 3000,25;
                           S3,1000,20"). To sum or multiply the post calibration
                           probability distributions, dates can be combined with
                           "+" or "*" (e.g. "4000,50 + 4100,100"). These
                           expressions can be combined arbitrarily. Parentheses
                           can be added to specify the order of operations (e.g.
                           "(4000,50 + 4100,100) * 3800,50")
  -i,--inputFile ARG       A file with a list of calibration expressions.
                           Formated just as DATE, but with a new line for each
                           input date. DATE and --inputFile can be combined and
                           you can provide multiple instances of --inputFile
  --calibrationCurveFile ARG
                           Path to an calibration curve file in .14c format. The
                           calibration curve will be read and used for
                           calibration. If no file is provided, currycarbon will
                           use the intcal20 curve.
  --method ARG             The calibration algorithm that should be used:
                           "<Method>,<Distribution>,<NumberOfDegreesOfFreedom>".
                           The default setting is equivalent to
                           "Bchron,StudentT,100" which copies the algorithm
                           implemented in the Bchron R package. Alternatively we
                           implemented "MatrixMult", which comes without further
                           arguments. For the Bchron algorithm with a normal
                           distribution ("Bchron,Normal") the degrees of freedom
                           argument is not relevant
  --allowOutside           Allow calibrations to run outside the range of the
                           calibration curve
  --noInterpolation        Don't interpolate the calibration curve
  -q,--quiet               Suppress the printing of calibration results to the
                           command line
  --densityFile ARG        Path to an output file which stores output densities
                           per sample and calender year
  --hdrFile ARG            Path to an output file which stores the high
                           probability density regions for each sample
  --calCurveSegmentFile ARG
                           Path to an output file which stores the relevant,
                           interpolated calibration curve segment for the first
                           (!) input date in a long format. This option as well
                           as --calCurveMatrixFile are mostly meant for
                           debugging
  --calCurveMatrixFile ARG Path to an output file which stores the relevant,
                           interpolated calibration curve segment for the first
                           (!) input date in a wide matrix format

For developers who want to edit the code

To install the latest development version (!) you can follow these steps:

  1. Install the Haskell build tool Stack
  2. Clone the repository
  3. Execute stack install inside the repository to build the tool and automatically copy the executables to ~/.local/bin (which you may want to add to your path). This will install the compiler and all dependencies into folders that won't interfere with any installation you might already have.

Preparing a new stable release

The Github Actions script in .github/workflows/release.yml registers a new draft release and automatically builds and uploads currycarbon binaries when a new Git tag with the prefix v* is pushed.

# locally register a new tag (e.g. 0.3.1)
git tag -a v0.3.1 -m "see CHANGELOG.md"
# push tag
git push origin v0.3.1

In case of a failing build delete the tag and the release draft on Github and then delete the tag locally with

git tag -d v0.3.1

before rerunning the procedure above.

Profiling

stack build --profile
stack exec --profile -- currycarbon "1000,200;2000,200;3000,200;4000,200;5000,200;6000,200;7000,200;8000,200" -q --densityFile /dev/null +RTS -p
stack exec -- currycarbon "1000,200;2000,200;3000,200;4000,200;5000,200;6000,200;7000,200;8000,200" -q --densityFile /dev/null +RTS -s