Skip to content

Commit 6255be2

Browse files
authored
Merge pull request #21 from nevrome/four
Preparations for a new major release
2 parents 6f6e4b7 + fa56cb8 commit 6255be2

34 files changed

+26051
-10691
lines changed

.github/workflows/release.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
name: Release ${{ github.ref_name }}
2222
draft: true
2323

24-
build_artifact:
24+
build_normal_artifacts:
2525
needs: [create_release]
2626
name: ${{ matrix.os }}/${{ github.ref }}
2727
runs-on: ${{ matrix.os }}
2828
strategy:
2929
matrix:
30-
os: [ubuntu-20.04, macOS-latest]
30+
os: [ubuntu-22.04, macOS-13, macOS-14, windows-latest]
3131

3232
steps:
3333
- name: Check out code
@@ -40,21 +40,34 @@ jobs:
4040
tagRegex: "v(.*)"
4141
tagRegexGroup: 1
4242

43+
- name: Install stack on macOS, where it is not present (https://github.com/freckle/stack-action/issues/80)
44+
if: ${{ runner.os == 'macOS' }}
45+
run: curl -sSL https://get.haskellstack.org/ | sh
46+
4347
- name: Build executable
4448
uses: freckle/stack-action@v5
4549
id: stack
4650
with:
47-
stack-arguments: --copy-bins
51+
test: false
52+
stack-build-arguments: --copy-bins --ghc-options="-O2"
4853

4954
- name: Set binary path name
5055
id: binarypath
5156
run: |
52-
currentEXE="${{ steps.stack.outputs.local-bin }}/currycarbon"
53-
newEXE="currycarbon-$RUNNER_OS"
54-
mv $currentEXE $newEXE
55-
echo "BINARY_PATH=$newEXE" >> $GITHUB_OUTPUT
57+
if [ "$RUNNER_OS" == "Windows" ]; then
58+
newEXE="currycarbon-$RUNNER_OS.exe"
59+
elif [ "$RUNNER_OS" == "macOS" ]; then
60+
newEXE="currycarbon-$RUNNER_OS-$RUNNER_ARCH"
61+
else
62+
newEXE="currycarbon-$RUNNER_OS"
63+
fi
64+
currentEXE="${{ steps.stack.outputs.local-bin }}/currycarbon"
65+
mv $currentEXE $newEXE
66+
echo "BINARY_PATH=$newEXE" >> $GITHUB_OUTPUT
67+
shell: bash
5668

5769
- name: Compress binary
70+
if: ${{ runner.os != 'macOS' }} # upx is crashing for macOS Ventura or above!
5871
uses: svenstaro/upx-action@v2
5972
with:
6073
files: ${{ steps.binarypath.outputs.BINARY_PATH }}

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
- V 0.4.0.0: Another major update:
2+
- Added more calibration curves next to `intcal20`: `shcal20` and `marine20`. Renamed the `Currycarbon.CalCurves.IntCal20` module to just `Currycarbon.CalCurves`. In the CLI, `--calCurveFile` is now just `--calCurve`, and it allows to either select the different packaged curves or read arbitrary .14c files.
3+
- Added a new CLI plot element to the output of individual dates. `renderCLIPlotCalCurve` plots a relevant section of the calibration curve.
4+
- Added the command line options `--noTrimCalCurve` and `--noTrimOutCalPDF` to allow control over the pre- and post-calibration trimming behaviour for radiocarbon dates.
5+
- Changed the way products between calibration expressions are computed in `evalCalExpr`. Input expressions in a multiplication are now calibrated for the entire length of the calibration curve. This allows to compute proper products and not fail in case of non-overlapping output.
6+
- Changed the way calibration curves are embedded in currycarbon. This now uses the brilliant `file-embed` library.
7+
- Changed the interface of the core calibration functions. `CalibrateDatesConf` no longer includes the `CalibrationMethod`, so `calibrateDates` and `evalNamedCalExpr` functions need it as an extra argument. `calibrateDateBchron` and `calibrateDateMatrixMult` now take `CalibrateDatesConf` and not its individual elements.
8+
- Moved from Float to Double for probability densities and all functions that interact with them.
9+
- Added a new output option `--basicFile` to the CLI to enable simple per-expression output: The minimum start and maximum end of the high probability density regions and the median age. In this context `writeCalC14` was split into `writeCalC14HDR` and `writeCalC14CalRangeSummary` in the library.
10+
- Added little axis labels (BC/AD) to the command line plot to improve readability.
11+
- Changed the release pipeline: Now again with a windows executable. currycarbon-macOS was replaced by currycarbon-macOS-X64 and currycarbon-macOS-ARM64.
12+
- Switched to a new GHC version (v9.6.6) and stackage resolver version (lts-22.43).
113
- V 0.3.0.1: The golden tests can not run on stackage as it stands, so I hid them behind an environment variable.
214
- V 0.3.0.0: Major update with multiple breaking changes and new features:
315
- Added a new mechanism to draw random age samples from a CalPDF (`sampleAgesFromCalPDF :: AgeSamplingConf -> CalPDF -> RandomAgeSample`). This is available from the command line with the options `samplesFile`, `--seed`, and `-n`/`--nrSamples`.

README.md

+45-19
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ The Haskell library is available on Hackage [here](https://hackage.haskell.org/p
1515

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

18-
You can download them here: [ [Linux 📥](https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-Linux) | [macOS 📥](https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-macOS) ]. Older release versions (some with Windows builds) are available [here](https://github.com/nevrome/currycarbon/releases).
18+
- [📥 Linux](https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-Linux)
19+
- [📥 macOS (ARM64)](https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-macOS-ARM64)
20+
- [📥 macOS (X64)](https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-macOS-X64)
21+
- [📥 Windows](https://github.com/nevrome/currycarbon/releases/latest/download/currycarbon-Windows.exe)
1922

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

@@ -29,33 +32,45 @@ chmod +x currycarbon-Linux
2932
```
3033

3134
```
32-
currycarbon v0.3.0.1 (UTF-8)
35+
currycarbon v0.4.0.0 (UTF-8)
3336
Method: Bchron {distribution = StudentTDist {ndf = 100.0}}
3437
Curve: IntCal20
3538
Calibrating...
3639
CalEXPR: [1] Sample1:4990±30BP
3740
Calibrated: 3936BC >> 3794BC > 3757BC < 3662BC << 3654BC
3841
1-sigma: 3794-3707BC, 3666-3662BC
3942
2-sigma: 3936-3874BC, 3804-3697BC, 3684-3654BC
40-
▁▁▁ ▁▁▁▁
41-
▁▁▒▒▒▁▁▁▁▒▒▒▒▁
42-
▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▁
43-
▁▁ ▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁ ▁▒
44-
▁▁▒▒▁ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▁▒▒▁
45-
▁▁▁▁▁▒▒▒▒▒▁ ▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▒▒▒▒▁
46-
▁▁▁▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▁▁▁▁▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁
43+
44+
BP
45+
5120 ┤ ┆
46+
│ ┆┆ ┆┆┆┆┆┆┆┆┆┆
47+
│ ┆┆┆┆┆┆┆ ┆ ┆┆
48+
│ ┄┄┄┄┄┄┄┄┄┄┆┆┆┄┄┄┄┄┄┄┄┄┄┄┄┄┆┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
49+
4990 ┤ ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┆┆┆┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
50+
│ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┆┆┆┆┆┆┆┆┆┄┄┄┄┄┄┄┆┄┄┄
51+
│ ┆┆ ┆┆┆ ┆
52+
│ ┆┆ ┆
53+
4870 ┤ ┆
54+
▁▁▁ ▁▁▁▁
55+
▁▁▒▒▒▁▁▁▁▒▒▒▒▁
56+
▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▁
57+
▁▁ ▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁ ▁▒
58+
▁▁▒▒▁ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▁▒▒▁
59+
▁▁▁▁▁▒▒▒▒▒▁ ▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▒▒▒▒▁
60+
▁▁▁▒▒▒▒▒▒▒▒▒▒▒▁▁▁▁▁▁▁▁▁▁▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▁
4761
-3950 ┄─────────┬───────────────┬────────────────┬─────────┄ -3640
48-
> > ^ < <
49-
──────────────── ─
50-
─────────── ────────────────── ──────
62+
BC > > ^ < < BC
63+
──────────────── ─
64+
─────────── ────────────────── ──────
5165
Done.
5266
```
5367

5468
```
5569
Usage: currycarbon [--version] [CalEXPRs] [-i|--inputFile FILE]
56-
[--calCurveFile FILE] [--method DSL] [--allowOutside]
57-
[--noInterpolation] [-q|--quiet] [--densityFile FILE]
58-
[--hdrFile FILE]
70+
[--calCurve IntCal20 | SHCal20 | Marine20 | FILE]
71+
[--method DSL] [--allowOutside] [--noInterpolation]
72+
[--noTrimCalCurve] [--noTrimOutCalPDF] [-q|--quiet]
73+
[--basicFile FILE] [--densityFile FILE] [--hdrFile FILE]
5974
[[--seed INT] (-n|--nrSamples INT) --samplesFile FILE]
6075
[--calCurveSegFile FILE] [--calCurveMatFile FILE]
6176
@@ -113,10 +128,11 @@ Available options:
113128
simple radiocarbon dates from a headless .csv file
114129
with one sample per row: <sample name>,<mean age
115130
BP>,<one sigma standard deviation>.
116-
--calCurveFile FILE Path to an calibration curve file in '.14c' format.
117-
The calibration curve will be read and used for
118-
calibration. If no file is provided, currycarbon will
119-
use the 'intcal20' curve.
131+
--calCurve IntCal20 | SHCal20 | Marine20 | FILE
132+
Either one of the included calibration curves, or a
133+
file path to an calibration curve file in '.14c'
134+
format. The calibration curve will be read and used
135+
for calibration. (default: IntCal20)
120136
--method DSL The calibration algorithm that should be used:
121137
'<Method>,<Distribution>,<NumberOfDegreesOfFreedom>'.
122138
The default setting is equivalent to
@@ -130,8 +146,18 @@ Available options:
130146
--allowOutside Allow calibrations to run outside the range of the
131147
calibration curve.
132148
--noInterpolation Do not interpolate the calibration curve.
149+
--noTrimCalCurve Do not trim the calibration curve before the
150+
calibration. If a probability distribution over the
151+
entire range of the calibration curve is needed. See
152+
also --noTrimOutCalPDF.
153+
--noTrimOutCalPDF Do not trim the output CalPDF. If an untrimmed
154+
probability distribution is needed. See also
155+
--noTrimCalCurve.
133156
-q,--quiet Suppress the printing of calibration results to the
134157
command line.
158+
--basicFile FILE Path to an output file to store basic, per-expression
159+
output: The minimum start and maximum end of the high
160+
probability density regions and the median age.
135161
--densityFile FILE Path to an output file to store output densities per
136162
CalEXPR and calender year.
137163
--hdrFile FILE Path to an output file to store the high probability

cabal.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
packages: ./*.cabal
2-
with-compiler: ghc-9.4.7
2+
with-compiler: ghc-9.6.6

currycarbon.cabal

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: currycarbon
2-
version: 0.3.0.1
2+
version: 0.4.0.0
33
synopsis: A package for simple, fast radiocarbon calibration
44
description: Radiocarbon calibration with the intercept method optimised for fast calibration of many dates.
55
homepage: https://github.com/nevrome/currycarbon
@@ -20,7 +20,7 @@ source-repository head
2020
library
2121
exposed-modules:
2222
Currycarbon
23-
Currycarbon.CalCurves.Intcal20
23+
Currycarbon.CalCurves
2424
Currycarbon.Calibration.Utils
2525
Currycarbon.Calibration.MatrixMult
2626
Currycarbon.Calibration.Bchron
@@ -33,14 +33,15 @@ library
3333
Currycarbon.Utils
3434
hs-source-dirs:
3535
src
36-
build-depends:
36+
build-depends:
3737
base >= 4.14 && < 5
38-
, filepath >= 1.4 && < 1.5
38+
, filepath >= 1.4 && < 1.6
3939
, parsec >= 3.1 && < 3.2
4040
, vector >= 0.12 && < 0.14
4141
, math-functions >= 0.3 && < 0.4
4242
, MonadRandom >= 0.6 && < 1
4343
, random > 1.2 && < 1.3
44+
, file-embed > 0.0.11.1 && < 0.1.0.0
4445
default-language:
4546
Haskell2010
4647

@@ -53,13 +54,13 @@ executable currycarbon
5354
currycarbon
5455
, base >= 4.14 && < 5
5556
, optparse-applicative >= 0.16 && < 0.19
56-
, filepath >= 1.4 && < 1.5
57+
, filepath >= 1.4 && < 1.6
5758
other-modules:
5859
Paths_currycarbon
5960
default-language:
6061
Haskell2010
6162
ghc-options:
62-
-threaded -with-rtsopts=-N -optP-Wno-nonportable-include-path
63+
-threaded -O2 -with-rtsopts=-N -optP-Wno-nonportable-include-path
6364

6465
test-suite spec
6566
hs-source-dirs:

data/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Calibration curves
2+
3+
- intcal20: Northern Hemisphere Atmospheric, Reimer et al. 2020, doi: [10.1017/RDC.2020.41](https://doi.org/10.1017/RDC.2020.41)
4+
- shcal20: Southern Hemisphere Atmospheric, Hogg et al. 2020, doi: [10.1017/RDC.2020.59](https://doi.org/10.1017/RDC.2020.59)
5+
- marine20: Marine, Heaton et al. 2020, doi: [10.1017/RDC.2020.68](https://doi.org/10.1017/RDC.2020.68)

0 commit comments

Comments
 (0)