-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4376e83
commit 0c475c9
Showing
11 changed files
with
77 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
for PT in (:Particles, :StaticParticles) | ||
@eval begin | ||
function $PT(N, m::Measurements.Measurement{T})::$PT{T,N} where T | ||
$PT(N, Normal(Measurements.value(m),Measurements.uncertainty(m))) | ||
end | ||
end | ||
end | ||
|
||
function Particles(m::Measurements.Measurement{T}) where T | ||
Particles(DEFAULT_NUM_PARTICLES, m) | ||
end | ||
|
||
function StaticParticles(m::Measurements.Measurement{T}) where T | ||
StaticParticles(DEFAULT_STATIC_NUM_PARTICLES, m) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
@testset "Measurements" begin | ||
@info "Testing Measurements" | ||
import Measurements | ||
|
||
m = Measurements.measurement(1,2) | ||
@test Particles(m) isa Particles{Float64, MonteCarloMeasurements.DEFAULT_NUM_PARTICLES} | ||
@test StaticParticles(m) isa StaticParticles{Float64, MonteCarloMeasurements.DEFAULT_STATIC_NUM_PARTICLES} | ||
|
||
|
||
@test Particles(10, m) isa Particles{Float64, 10} | ||
@test StaticParticles(10, m) isa StaticParticles{Float64, 10} | ||
|
||
|
||
|
||
@test Particles.([m, m]) isa Vector{Particles{Float64, MonteCarloMeasurements.DEFAULT_NUM_PARTICLES}} | ||
@test StaticParticles.([m, m]) isa Vector{StaticParticles{Float64, MonteCarloMeasurements.DEFAULT_STATIC_NUM_PARTICLES}} | ||
|
||
@test Particles(m) ≈ 1 ± 2 | ||
@test std(Particles(m)) ≈ 2 atol=1e-3 | ||
@test mean(Particles(m)) ≈ 1 atol=1e-3 | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
using SLEEFPirates | ||
a = rand(500) | ||
@test map(exp, a) ≈ exp(Particles(a)).particles | ||
@test map(log, a) ≈ log(Particles(a)).particles | ||
@test map(cos, a) ≈ cos(Particles(a)).particles | ||
@testset "SLEEFPirates" begin | ||
@info "Testing SLEEFPirates" | ||
|
||
using SLEEFPirates | ||
a = rand(500) | ||
@test map(exp, a) ≈ exp(Particles(a)).particles | ||
@test map(log, a) ≈ log(Particles(a)).particles | ||
@test map(cos, a) ≈ cos(Particles(a)).particles | ||
|
||
a = rand(Float32, 500) | ||
@test map(exp, a) ≈ exp(Particles(a)).particles | ||
@test map(log, a) ≈ log(Particles(a)).particles | ||
@test map(cos, a) ≈ cos(Particles(a)).particles | ||
|
||
a = rand(Float32, 500) | ||
@test map(exp, a) ≈ exp(Particles(a)).particles | ||
@test map(log, a) ≈ log(Particles(a)).particles | ||
@test map(cos, a) ≈ cos(Particles(a)).particles | ||
|
||
end |