Skip to content

Commit

Permalink
More ll and hiatus tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brenhinkeller committed May 28, 2024
1 parent 44748e7 commit ff7a0c8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
12 changes: 12 additions & 0 deletions test/testCoupled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ println("StratMetropolisDist:")
@test mdl.Age_975CI [66.1, 66.09, 66.09, 66.08, 66.08, 66.07, 66.06, 66.05, 66.03, 66.01, 65.97, 65.97, 65.96, 65.96, 65.95] atol=0.15
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(lldist) == (config.nsteps,)
@test !isnan(mean(lldist))

# Try adding systematic uncertainties too
smpl.Chronometer = (:UPb, :UPb, :ArAr, :UPb, :UPb)
Expand All @@ -67,6 +69,8 @@ println("StratMetropolisDist with systematic uncertainties:")
@test mdl.Age_975CI [66.1, 66.09, 66.09, 66.08, 66.08, 66.07, 66.06, 66.05, 66.03, 66.01, 65.97, 65.97, 65.96, 65.96, 65.95] atol=0.15
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(lldist) == (config.nsteps,)
@test !isnan(mean(lldist))

## --- As above, but with hiata

Expand All @@ -88,6 +92,10 @@ println("StratMetropolisDist with hiata:")
@test mdl.Age_975CI [66.11, 66.1, 66.1, 66.1, 66.1, 66.08, 66.08, 66.08, 66.08, 65.98, 65.96, 65.96, 65.96, 65.96, 65.95] atol=0.15
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(hiatusdist) == (nHiatuses, config.nsteps)
@test mean(hiatusdist, dims=2) [0.064; 0.061;;] atol=0.3
@test size(lldist) == (config.nsteps,)
@test !isnan(mean(lldist))

## --- As above, but treat everything as a gaussian/weighted mean

Expand All @@ -107,6 +115,8 @@ println("StratMetropolisDist with fitted Gaussians:")
@test mdl.Age_975CI [66.09, 66.09, 66.08, 66.08, 66.08, 66.07, 66.06, 66.05, 66.04, 66.02, 66.0, 65.99, 65.98, 65.97, 65.96] atol=0.15
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(lldist) == (config.nsteps,)
@test !isnan(mean(lldist))

## -- Test coupled with Isoplot.jl Pb-loss-aware eruption ages

Expand Down Expand Up @@ -154,3 +164,5 @@ println("StratMetropolisDist, Pb-loss-aware:")
@test mdl.Age_975CI [752.51, 752.47, 752.43, 752.37, 752.29, 752.2, 752.08, 751.85, 750.99] atol=0.7
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(lldist) == (config.nsteps,)
@test !isnan(mean(lldist))
2 changes: 2 additions & 0 deletions test/testDist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
tmindist, tmaxdist, lldist, acceptancedist = metropolis_minmax(2*10^5, MeltsVolcanicZirconDistribution, mu, sigma, burnin=10^5)
@test isapprox(nanmean(tmindist), 99.925, atol=0.015)
@test isapprox(nanmean(tmaxdist), 101.08, atol=0.015)
@test -Inf < mean(lldist) < 0
@test 0 < mean(acceptancedist) < 1

## -- Test distribution bootstrapping

Expand Down
10 changes: 8 additions & 2 deletions test/testRadiocarbon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ config.sieve = round(Int,npoints_approx) # Record one out of every nsieve steps
@test mdl.Age_975CI [8405.0, 8386.1, 8347.1, 8163.5, 8151.0, 8123.9, 8029.5, 8016.3, 8003.0, 7985.9, 7958.2, 7916.3] atol=35
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test -Inf < mean(lldist) < 0


# Data about hiatuses
Expand All @@ -84,7 +85,9 @@ hiatus.Duration_sigma = [ 30.5, 20.0 ]
@test mdl.Age_975CI [8408.06, 8394.94, 8231.34, 8159.62, 8147.76, 8123.97, 8054.25, 8039.57, 8025.91, 7918.86, 7907.9, 7889.46] atol=35
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])

@test size(hiatusdist) == (nHiatuses, config.nsteps)
@test mean(hiatusdist, dims=2) [108.4; 189.0;;] atol=20
@test -Inf < mean(lldist) < 0

## --- IntCal20

Expand Down Expand Up @@ -133,6 +136,7 @@ config.sieve = round(Int,npoints_approx) # Record one out of every nsieve steps
@test mdl.Age_975CI [8401.5, 8382.0, 8342.7, 8167.4, 8156.2, 8128.5, 8019.7, 8011.7, 8002.5, 7986.2, 7957.2, 7916.2] atol=40
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test -Inf < mean(lldist) < 0


# Data about hiatuses
Expand All @@ -153,4 +157,6 @@ hiatus.Duration_sigma = [ 30.5, 20.0 ]
@test mdl.Age_975CI [8405.89, 8391.62, 8225.61, 8163.41, 8151.31, 8123.92, 8030.35, 8023.65, 8016.86, 7916.1, 7905.95, 7886.48] atol=40
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(hiatusdist) == (nHiatuses, config.nsteps)
@test size(hiatusdist) == (nHiatuses, config.nsteps)
@test mean(hiatusdist, dims=2) [110.5; 187.3;;] atol=20
@test -Inf < mean(lldist) < 0
3 changes: 2 additions & 1 deletion test/testStratOnly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ config.sieve = round(Int,npoints_approx) # Record one out of every nsieve steps
@test mdl.Age_975CI [761.17, 757.98, 752.64, 733.57, 731.21, 728.07, 722.24, 720.59, 718.6, 716.11, 712.48, 704.28] atol=3
# Test that all age-depth models are in stratigraphic order
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test -Inf < mean(lldist) < 0

@test NamedTuple(mdl) isa NamedTuple

Expand All @@ -53,4 +54,4 @@ hiatus.Duration_sigma = [ 3.1, 2.0 ]
@test all([issorted(x, rev=true) for x in eachcol(agedist)])
@test size(hiatusdist) == (nHiatuses, config.nsteps)
@test mean(hiatusdist, dims=2) [10.580012942504894; 18.96167245288326;;] atol=2
@test mean(lldist) -6.149720449018242 atol=6
@test -Inf < mean(lldist) < 0

2 comments on commit ff7a0c8

@brenhinkeller
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:
Attempt to better handle hiata of poorly-known duration but known stratigraphic position

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/107908

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.0 -m "<description of version>" ff7a0c8100700fad0c19deae68733be03e9d72d8
git push origin v0.5.0

Please sign in to comment.