All checks were successful
Build and Deploy Documentation / build-and-deploy (push) Successful in 28s
Add a Python-based test script that runs musrfit -c on each example msr-file, extracts the maxLH or chisq value, and checks it against a reference value with a relative tolerance of 1e-4. Covers all 13 example msr-files (single histogram and asymmetry fits). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
1.7 KiB
CMake
36 lines
1.7 KiB
CMake
#--- maxLH_check test (Python) ------------------------------------------------
|
|
|
|
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
|
|
|
#--- helper macro -------------------------------------------------------------
|
|
macro(add_maxLH_test test_name msr_file expected_value)
|
|
add_test(
|
|
NAME ${test_name}
|
|
COMMAND Python3::Interpreter
|
|
${CMAKE_CURRENT_SOURCE_DIR}/maxLH_check.py
|
|
$<TARGET_FILE:musrfit>
|
|
${CMAKE_SOURCE_DIR}/doc/examples/${msr_file}
|
|
${expected_value}
|
|
1e-4
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/doc/examples
|
|
)
|
|
endmacro()
|
|
|
|
#--- register ctest(s) -------------------------------------------------------
|
|
|
|
# single histogram fits (maxLH)
|
|
add_maxLH_test(test-histo-MusrRoot test-histo-MusrRoot.msr 3971.7)
|
|
add_maxLH_test(test-histo-PSI-BIN test-histo-PSI-BIN.msr 663.89)
|
|
add_maxLH_test(test-histo-ROOT-NPP test-histo-ROOT-NPP.msr 249.12)
|
|
add_maxLH_test(test-histo-HAL9500 test-histo-HAL9500.msr 1286509.8)
|
|
add_maxLH_test(test-histo-HAL9500-RRF test-histo-HAL9500-RRF.msr 22187.4)
|
|
add_maxLH_test(test-histo-muMinus test-histo-muMinus.msr 238962.6)
|
|
add_maxLH_test(test-histo-NeXus test-histo-NeXus.msr 3273.57)
|
|
add_maxLH_test(test-histo-NeXus2 test-histo-NeXus2.msr 2582.50)
|
|
|
|
# asymmetry fits (chisq)
|
|
add_maxLH_test(test-asy-PSI-BIN test-asy-PSI-BIN.msr 566.76)
|
|
add_maxLH_test(test-asy-MUD test-asy-MUD.msr 133.96)
|
|
add_maxLH_test(test-asy-NeXus2 test-asy-NeXus2.msr 796.72)
|
|
add_maxLH_test(test-asy-HAL9500-RRF test-asy-HAL9500-RRF.msr 7402.28)
|
|
add_maxLH_test(test-asy-LF-BaB6 test-asy-LF-BaB6.msr 1911.88) |