Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to increase coverage #13

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions ext/LegendMakieRadiationDetectorSignalsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ using MakieCore
using RadiationDetectorSignals: RDWaveform, ArrayOfRDWaveforms


function LegendMakie.lplot(wf::RDWaveform)
# ...
end
# function LegendMakie.lplot!(wf::RDWaveform)
# # ...
# end

function LegendMakie.lplot(wf::ArrayOfRDWaveforms)
# ...
end
# function LegendMakie.lplot!(wf::ArrayOfRDWaveforms)
# # ...
# end


function LegendMakie.some_custom_waveform_plot(wf::RDWaveform)
# ...
end

end # module LegendMakieRadiationDetectorSignalsExt
8 changes: 3 additions & 5 deletions src/LegendMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ module LegendMakie

include("lplot.jl")

include("extdefs_rdsignals.jl")

include("register_extdeps.jl")

function __init__()
_register_extension_deps(
some_custom_waveform_plot => :RadiationDetectorSignals,
)
# _register_extension_deps(
# some_custom_waveform_plot => :RadiationDetectorSignals,
# )
end

end # module
9 changes: 0 additions & 9 deletions src/extdefs_rdsignals.jl

This file was deleted.

9 changes: 9 additions & 0 deletions test/test_lplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ using Test
@testset "FWHM energy calibration" begin
@test_nowarn lplot(report_fwhm, additional_pts=(peaks = [1000u"keV"], fwhm = [3.5u"keV"]), title = "Test")
end
@testset "Throw warning for wrong report types" begin
report_calib_faulty = NamedTuple{keys(report_calib)}((k == :type) ? (:faulty) : report_calib[k] for k in keys(report_calib))
report_fwhm_faulty = NamedTuple{keys(report_fwhm)}((k == :type) ? (:faulty) : report_fwhm[k] for k in keys(report_fwhm))
@test_logs (:warn,) lplot(report_calib_faulty, xerrscaling=10, yerrscaling=10, additional_pts=(μ = [100_000], peaks = [1000u"keV"]), title = "Test")
@test_logs (:warn,) lplot(report_fwhm_faulty, xerrscaling=10, yerrscaling=10, additional_pts=(μ = [100_000], peaks = [1000u"keV"]), title = "Test")
end
end

@testset "A/E correction" begin
Expand Down Expand Up @@ -125,6 +131,9 @@ using Test
chinfo = LegendDataManagement.channelinfo(l200, filekey, system = :geds)
pd = PropDicts.PropDict(Dict(Symbol.(det.name) => det.production.mass_in_g for det in dets))
@test_nowarn LegendMakie.lplot(chinfo, pd)
# delete the last entry to test handling missing detectors
delete!(pd, :V99000A)
@test_logs (:warn,) LegendMakie.lplot(chinfo, pd)
end
end
end