diff --git a/Project.toml b/Project.toml index d77ccda..268c057 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Thermochron" uuid = "b9a8379e-ee1a-4388-b7ca-7852af1cef08" authors = ["C. Brenhin Keller and collaborators"] -version = "0.11.1" +version = "0.11.2" [deps] BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66" @@ -30,5 +30,5 @@ LsqFit = "0.15.0" NaNStatistics = "0.6" ProgressMeter = "1" Reexport = "1" -StatGeochemBase = "0.4.3, 0.5, 0.6" +StatGeochemBase = "0.6.11" julia = "1.11" diff --git a/src/inversion.jl b/src/inversion.jl index 3ae6a24..7ef5905 100644 --- a/src/inversion.jl +++ b/src/inversion.jl @@ -771,3 +771,36 @@ ) return ttresult, kineticresult end + + + """ + ```julia + image_from_paths(tT::TTResult; + xresolution::Int=1800, + yresolution::Int=1200, + xrange = nanextrema(tT.tpointdist), + yrange = nanextrema(tT.Tpointdist), + ) + ``` + Produce a 2d image (histogram) of path densities given a `TTResult` + + ```julia + julia> imgcounts, xq, yq = image_from_paths(tT; xrange=boundary.agepoints, yrange=boundary.T₀) + ``` + """ + function StatGeochemBase.image_from_paths(tT::TTResult; + xresolution::Int = 1800, + yresolution::Int = 1200, + xrange = nanextrema(tT.tpointdist), + yrange = nanextrema(tT.Tpointdist), + ) + image_from_paths(tT.tpointdist, tT.Tpointdist; xresolution, yresolution, xrange, yrange) + end + function StatGeochemBase.image_from_paths!(tT::TTResult; + xresolution::Int = 1800, + yresolution::Int = 1200, + xrange = nanextrema(tT.tpointdist), + yrange = nanextrema(tT.Tpointdist), + ) + image_from_paths!(tT.tpointdist, tT.Tpointdist; xresolution, yresolution, xrange, yrange) + end \ No newline at end of file diff --git a/test/testcomplete.jl b/test/testcomplete.jl index 84ea3c2..0973fe6 100644 --- a/test/testcomplete.jl +++ b/test/testcomplete.jl @@ -432,4 +432,22 @@ DN17Eamean = mean(kinetics.zdmdist .|> x-> x.DN17Ea) @info "Mean zircon DN17Ea: $DN17Eamean" rmr0mean = mean(kinetics.zdmdist .|> x-> x.rmr0) @test 0 < rmr0mean < 1 -@info "Mean zircon rmr0: $rmr0mean" \ No newline at end of file +@info "Mean zircon rmr0: $rmr0mean" + +## --- Test conversion of t-T images + +ttimage, xq, yq = image_from_paths(tT, xresolution=200, yresolution=100, yrange=boundary.T₀) +@test xq == 8.75:17.5:3491.25 +@test yq == 2.0:4.0:398.0 +@test ttimage isa Matrix +@test axes(ttimage, 1) == 1:100 +@test axes(ttimage, 2) == 1:200 + +ttimage2, xq2, yq2 = image_from_paths!(tT, xresolution=200, yresolution=100, yrange=boundary.T₀) +@test xq2 == 8.75:17.5:3491.25 +@test yq2 == 2.0:4.0:398.0 +@test ttimage2 isa Matrix +@test axes(ttimage2, 1) == 1:100 +@test axes(ttimage2, 2) == 1:200 + +@test ttimage == ttimage2 \ No newline at end of file