Commit 0c0c68d8 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Merge branch 'f71tocsv-normlized' into 'master'

F71togapi normalized

See merge request !126
parents 689d327b f120570b
Pipeline #163607 passed with stages
in 21 minutes and 8 seconds
...@@ -108,12 +108,38 @@ linux_gcc_testing: ...@@ -108,12 +108,38 @@ linux_gcc_testing:
-Dradix_ENABLE_TESTS=ON -Dradix_ENABLE_TESTS=ON
-DENABLE_PYTHON_WRAPPERS=ON -DENABLE_PYTHON_WRAPPERS=ON
-Dradix_ENABLE_SECONDARY_TESTED_CODE=ON -Dradix_ENABLE_SECONDARY_TESTED_CODE=ON
-Dradix_ENABLE_TESTS=ON -DTPL_ENABLE_VTK=ON -DTPL_ENABLE_VTK=ON
-Dradix_ENABLE_radixplot=OFF -Dradix_ENABLE_radixplot=OFF
-Dradix_ENABLE_radixwidgets=OFF .. -Dradix_ENABLE_radixwidgets=OFF ..
- cmake --build . - cmake --build .
- ctest --output-junit ctest-results.xml - ctest --output-junit ctest-results.xml
linux_deployment:
tags:
- linux
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}-linux-deployment
paths:
- bin/
script:
- which git
- git --version
- mkdir build
- cd build
- module load cmake/3.21.0
- which cmake
- cmake
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Release
-Dradix_ENABLE_TESTS=OFF
-DENABLE_PYTHON_WRAPPERS=OFF
-Dradix_ENABLE_ALL_PACKAGES=OFF
-Dradix_ENABLE_radixplot=OFF
-Dradix_ENABLE_radixwidgets=OFF
-Dradix_ENABLE_radixio=ON
-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR} ..
- cmake --build . --target bundle_install
linux_analysis: linux_analysis:
stage: analysis stage: analysis
tags: tags:
...@@ -184,6 +210,15 @@ windows_msvc_testing: ...@@ -184,6 +210,15 @@ windows_msvc_testing:
- nsmwin10 - nsmwin10
script: script:
- ci\windows_msvc_testing.bat - ci\windows_msvc_testing.bat
windows_msvc_deployment:
tags:
- nsmwin10
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}-windows-deployment
paths:
- bin/
script:
- ci\windows_msvc_deployment.bat
windows_intel_shared_testing: windows_intel_shared_testing:
tags: tags:
......
...@@ -71,7 +71,11 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE) ...@@ -71,7 +71,11 @@ IF (NOT TRIBITS_PROCESSING_PACKAGE)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cmake_runtime_output" CACHE STRING "") SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cmake_runtime_output" CACHE STRING "")
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Bundle/CMakeLists.txt")
ADD_SUBDIRECTORY(cmake/Bundle)
ELSE()
MESSAGE(STATUS "Bundling not supported.")
ENDIF()
TRIBITS_PROJECT_ENABLE_ALL() TRIBITS_PROJECT_ENABLE_ALL()
ELSE() ELSE()
# This CMakeLists.txt file is being processed as the TriBITS package file. # This CMakeLists.txt file is being processed as the TriBITS package file.
......
set PATH=c:\Qt\5.9.1\msvc2013_64\bin;%PATH%;c:\Program Files (x86)\NSIS\Bin
call "c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/vcvarsall.bat" amd64
where git
git --version
where qmake
qmake -version
where cmake
cmake --version
mkdir build
cd build
SET radix_ENABLE_Fortran=OFF
cmake ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=RELEASE ^
-Dradix_ENABLE_TESTS=OFF ^
-Dradix_ENABLE_ALL_PACKAGES=OFF ^
-Dradix_ENABLE_radixplot=OFF ^
-Dradix_ENABLE_radixwidgets=OFF ^
-Dradix_ENABLE_radixglls=OFF ^
-Dradix_ENABLE_radixio=ON ^
-DCMAKE_INSTALL_PREFIX=%CI_PROJECT_DIR% ^
-G "NMake Makefiles" ..
cmake --build . --target bundle_install
\ No newline at end of file
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
SET(FIXUP_FILE_PATTERN "${CMAKE_INSTALL_PREFIX}/bin/*.exe")
ELSE()
SET(FIXUP_FILE_PATTERN "${CMAKE_INSTALL_PREFIX}/bin/*")
ENDIF()
#
#
SET(APP_PLUGINS_DIR "")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/fixup_script.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/fixup_script.cmake
@ONLY)
ADD_CUSTOM_TARGET(bundle_install
COMMAND ${CMAKE_MAKE_PROGRAM} install
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/fixup_script.cmake
WORKING_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}
COMMENT "Bundling the installation..."
VERBATIM
)
SET(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
IF("@CMAKE_SYSTEM_NAME@" STREQUAL "Windows")
ELSEIF("@CMAKE_SYSTEM_NAME@" STREQUAL "Darwin")
FUNCTION(gp_item_default_embedded_path_override item path)
# This is required to change the Mac Bundle standard to conform to a linux form
SET(${path} "@executable_path/../lib" PARENT_SCOPE)
ENDFUNCTION()
ELSE()
FUNCTION(gp_item_default_embedded_path_override item path)
SET(${path} "@executable_path/../lib/" PARENT_SCOPE)
ENDFUNCTION()
FUNCTION(gp_resolved_file_type_override item type_var)
GET_FILENAME_COMPONENT(item_dir "${item}" DIRECTORY)
STRING(REPLACE "bin/../lib" "lib/" item_dir "${item_dir}")
GET_FILENAME_COMPONENT(item_dir "${item_dir}" DIRECTORY)
IF("${item_dir}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
SET(${type_var} "local" PARENT_SCOPE)
ENDIF()
ENDFUNCTION ()
ENDIF()
#
# CMake code snippet for stand alone bundle
#
FILE(GLOB APPS @FIXUP_FILE_PATTERN@)
MESSAGE("FIXUP_BUNDLE for: '${APPS}'")
INCLUDE(BundleUtilities)
FOREACH(APP ${APPS})
# don't process a directory
IF(NOT IS_DIRECTORY ${APP})
# get the file extension
GET_FILENAME_COMPONENT(FILE_EXT ${APP} EXT)
# only check no extension files or 'exe' extension files
IF("${FILE_EXT}" STREQUAL "" OR "${FILE_EXT}" STREQUAL ".exe")
FIXUP_BUNDLE("${APP}" "" "")
ENDIF()
ENDIF()
ENDFOREACH()
...@@ -7,7 +7,7 @@ namespace radix ...@@ -7,7 +7,7 @@ namespace radix
{ {
void F71toGapi::to_gapi_json(const F71Case& fcase, float detector_height, void F71toGapi::to_gapi_json(const F71Case& fcase, float detector_height,
float detector_distance, float live_time, float detector_distance, float live_time,
DataObject& obj, float threshold) DataObject& obj, bool normalize, float threshold)
{ {
// //
// //
...@@ -65,6 +65,7 @@ void F71toGapi::to_gapi_json(const F71Case& fcase, float detector_height, ...@@ -65,6 +65,7 @@ void F71toGapi::to_gapi_json(const F71Case& fcase, float detector_height,
} }
DecayDb decaydb; DecayDb decaydb;
std::vector<std::pair<int, float>> isotope_activity; std::vector<std::pair<int, float>> isotope_activity;
float total_activity = 0.f;
for (const auto& it : master) for (const auto& it : master)
{ {
int zaid = it.first; int zaid = it.first;
...@@ -76,7 +77,20 @@ void F71toGapi::to_gapi_json(const F71Case& fcase, float detector_height, ...@@ -76,7 +77,20 @@ void F71toGapi::to_gapi_json(const F71Case& fcase, float detector_height,
radix_line("Calculated activity(" << activity << ") for " << zaid << "[" radix_line("Calculated activity(" << activity << ") for " << zaid << "["
<< light_abs << ", " << ac_abs << ", " << light_abs << ", " << ac_abs << ", "
<< fp_abs << "]"); << fp_abs << "]");
if (threshold < activity) isotope_activity.push_back({zaid, activity}); if (threshold < activity)
{
total_activity += activity;
isotope_activity.push_back({zaid, activity});
}
}
//
// Normalize by activity
if (normalize)
{
for (auto& isotope : isotope_activity)
{
isotope.second = isotope.second / total_activity;
}
} }
// //
// Begin DataObject creation // Begin DataObject creation
......
...@@ -19,11 +19,13 @@ class RADIX_PUBLIC F71toGapi ...@@ -19,11 +19,13 @@ class RADIX_PUBLIC F71toGapi
* @param detector_distance distance in cm to source * @param detector_distance distance in cm to source
* @param live_time measurement time in seconds * @param live_time measurement time in seconds
* @param obj DataObject to construct * @param obj DataObject to construct
* @param normalize by total activity
* @param threshold in curies * @param threshold in curies
*/ */
static void to_gapi_json(const F71Case& fcase, float detector_height, static void to_gapi_json(const F71Case& fcase, float detector_height,
float detector_distance, float live_time, float detector_distance, float live_time,
DataObject& obj, float threshold = 1e-6); DataObject& obj, bool normalize = false,
float threshold = 1e-6);
}; };
} // namespace radix } // namespace radix
......
...@@ -16,6 +16,7 @@ int main(int argc, char** argv) ...@@ -16,6 +16,7 @@ int main(int argc, char** argv)
commandline.addOption("d", "Detector distance (cm)", true); commandline.addOption("d", "Detector distance (cm)", true);
commandline.addOption("l", "Live time (seconds)", true); commandline.addOption("l", "Live time (seconds)", true);
commandline.addOption("i", "F71 case index. Defaults to 0"); commandline.addOption("i", "F71 case index. Defaults to 0");
commandline.addOption("n", "Normalize by total activity.");
{ {
std::vector<std::string> errors; std::vector<std::string> errors;
...@@ -35,6 +36,7 @@ int main(int argc, char** argv) ...@@ -35,6 +36,7 @@ int main(int argc, char** argv)
float detector_distance = commandline.get<float>("d"); float detector_distance = commandline.get<float>("d");
float live_time = commandline.get<float>("l"); float live_time = commandline.get<float>("l");
int index = commandline.get<int>("i", 0); int index = commandline.get<int>("i", 0);
bool normalize = commandline.get<bool>("n", false);
if (output_file.empty()) if (output_file.empty())
{ {
output_file = to_native_path(dirname(f71file) + "/" + output_file = to_native_path(dirname(f71file) + "/" +
...@@ -65,7 +67,7 @@ int main(int argc, char** argv) ...@@ -65,7 +67,7 @@ int main(int argc, char** argv)
if (result && findex == index) if (result && findex == index)
{ {
F71toGapi::to_gapi_json(single_case, detector_height, detector_distance, F71toGapi::to_gapi_json(single_case, detector_height, detector_distance,
live_time, obj); live_time, obj, normalize);
std::ofstream ofs(output_file); std::ofstream ofs(output_file);
obj.pack_json(ofs); obj.pack_json(ofs);
ofs.close(); ofs.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment