diff --git a/ci-sdcc/dependencies.txt b/ci-sdcc/dependencies.txt deleted file mode 100644 index e0342ccd..00000000 --- a/ci-sdcc/dependencies.txt +++ /dev/null @@ -1,4 +0,0 @@ -Tkinter -matplotlib -IMAS-Python -PyYAML \ No newline at end of file diff --git a/ci-sdcc/st00-header.sh b/ci-sdcc/st00-header.sh index 72e2e8db..3deeaf10 100644 --- a/ci-sdcc/st00-header.sh +++ b/ci-sdcc/st00-header.sh @@ -1,145 +1,41 @@ #!/bin/bash source /etc/profile.d/modules.sh -source ./ci-sdcc/utils.sh -########################################################################################## -# Set environment based on toolchain # -########################################################################################## module use /work/imas/etc/modules/all - -# expand aliases shopt -s expand_aliases - -#print hostname -hostname -f - -IMAS_EXISTS=$(module -r -t list 2>&1 | grep -E "IMAS-Core" | head -n 1) -if [ -n "$IMAS_EXISTS" ]; then - echo "> Found already loaded IMAS Module : $IMAS_EXISTS" - ACCESS_LAYER_VERSION=$(echo "$AL_VERSION" | cut -d '.' -f 1) - TOOLCHAIN_VERSION=$(echo "$IMAS_EXISTS" | awk -F '-' '{print $(NF-1)"-"$NF}') -else - echo "> IMAS Module is not loaded" -fi - -if [ -n "$1" ] || [ -n "$2" ]; then - echo "> Compiling with $1 and Access Layer $2 with latest version of installed modules.Previously loaded modules will be purged.." - module purge - # If toolchain version is passed then purge all modules - if [ -n "$1" ]; then - TOOLCHAIN_VERSION="$1" - fi - - # Get AL version - if [ -n "$2" ]; then - ACCESS_LAYER_VERSION="$2" - else - ACCESS_LAYER_VERSION="5" - fi -fi - -if [ -z "$TOOLCHAIN_VERSION" ]; then - echo "> No toolchain found, Setting it to default : intel-2023b" - TOOLCHAIN_VERSION="intel-2023b" -fi - -if [ -z "$ACCESS_LAYER_VERSION" ]; then - ACCESS_LAYER_VERSION="5" -fi - -if [ -z "$DD_VERSION" ]; then - DD_VERSION="3" -else - DD_VERSION="$3" -fi - -echo "> Building for $TOOLCHAIN_VERSION and Access Layer $ACCESS_LAYER_VERSION" - -if [[ $TOOLCHAIN_VERSION == *"intel"* ]]; then - FCOMPILER="ifort" -fi -if [[ $TOOLCHAIN_VERSION == *"foss"* ]]; then - FCOMPILER="gfortran" -fi - - -CORE_MODULE_VERSION=$(getIMASCoreModuleName "$TOOLCHAIN_VERSION" "$ACCESS_LAYER_VERSION" "$DD_VERSION") -# load IMAS module first - -if [ -z "$IMAS_EXISTS" ]; then - echo "> IMAS is not loaded.. Loading Module $CORE_MODULE_VERSION" - module load "$CORE_MODULE_VERSION" -fi - -GCCcore_VERSION=$(getGCCcoreVersion) module purge -dependencies="./ci-sdcc/dependencies.txt" - -# Check if the file exists -if [ ! -f "$dependencies" ]; then - echo "File $dependencies not found." - return 1 -fi - -declare -a RUNMODULES=() -declare -a EBBRUNMODULES=() - -echo "-------------------------------------------------------" -echo "> dependency modules" -counter=0 -while IFS= read -r line || [[ -n $line ]]; do - line="${line// /}" - # for empty string continue - if [[ -z "$line" ]]; then - counter=$(("$counter" + 1)) - continue - fi - # fix module version - if [[ $line == *"/"* ]]; then - echo "using fix module $line" - RUNMODULES["$counter"]="$line" - EBBRUNMODULES["$counter"]="('$line', EXTERNAL_MODULE)," - counter=$(("$counter" + 1)) - continue - fi - # latest module version as it is not given - # if [[ $line == *"IMAS"* ]]; then - # echo " IMAS $CORE_MODULE_VERSION" - # RUNMODULES["$counter"]="$CORE_MODULE_VERSION" - # EBBRUNMODULES["$counter"]="('$CORE_MODULE_VERSION', EXTERNAL_MODULE)," - # else - module_version=$(getModuleName "$line" "$TOOLCHAIN_VERSION" "$GCCcore_VERSION") - echo " $line $module_version" - RUNMODULES["$counter"]="$module_version" - EBBRUNMODULES["$counter"]=$(getModuleNameAndVersion "$module_version") - - # fi - counter=$(("$counter" + 1)) -done <"$dependencies" -echo "-------------------------------------------------------" - -echo "> Details of environment" -echo " TOOLCHAIN_VERSION : $TOOLCHAIN_VERSION" -echo " GCCcore_VERSION : $GCCcore_VERSION" -echo " IMAS VERSION : $CORE_MODULE_VERSION" -echo " RUNMODULES : " "${RUNMODULES[@]}" -echo " EBRUNMODULES : " "${EBBRUNMODULES[@]}" -echo " Compiler : $FCOMPILER" -echo "-------------------------------------------------------" - - -echo "> Loading run time modules" -# Load build modules if they exist -for imodule in "${RUNMODULES[@]}"; do - IFS='/' read -r iname iversion <<< "$imodule" - MODULE_EXISTS=$(module -r -t list 2>&1 | grep -E "$iname/") - if [ -z "$MODULE_EXISTS" ]; then - echo " $iname not available, Loading $imodule" - module load "$imodule" - else - echo " $MODULE_EXISTS already loaded" - fi +# Check which modules env var is set +if [ -n "${INTEL_MODULES:-}" ]; then + MODULES_LIST="$INTEL_MODULES" + export ENVIRONEMNT_NAME="intel" +elif [ -n "${FOSS_MODULES:-}" ]; then + MODULES_LIST="$FOSS_MODULES" + export ENVIRONEMNT_NAME="foss" +else + echo "" + echo "ERROR: Neither INTEL_MODULES nor FOSS_MODULES is set" + echo "" + echo "Please set one of these environment variables and run the script." + echo "" + echo "Examples:" + echo "" + echo " For intel-2023b:" + echo " export INTEL_MODULES=\"IMAS-Core/5.7.1-intel-2023b Tkinter/3.11.5-GCCcore-13.2.0 IMAS-Python/2.3.0-intel-2023b PyYAML/6.0.1-GCCcore-13.2.0\"" + echo "" + echo " For intel-2025b:" + echo " export INTEL_MODULES=\"IMAS-Core/5.7.1-intel-2025b Tkinter/3.13.5-GCCcore-14.3.0 IMAS-Python/2.3.0-intel-2025b PyYAML/6.0.2-GCCcore-14.3.0\"" + echo "" + echo " For foss-2023b:" + echo " export FOSS_MODULES=\"IMAS-Core/5.7.1-foss-2023b Tkinter/3.11.5-GCCcore-13.2.0 IMAS-Python/2.3.0-foss-2023b PyYAML/6.0.1-GCCcore-13.2.0\"" + echo "" + echo " For foss-2025b:" + echo " export FOSS_MODULES=\"IMAS-Core/5.7.1-foss-2025b Tkinter/3.13.5-GCCcore-14.3.0 IMAS-Python/2.3.0-foss-2025b PyYAML/6.0.2-GCCcore-14.3.0\"" + echo "" + exit 1 +fi + +# Load all modules +for module in $MODULES_LIST; do + module load "$module" done -echo "> Done" -echo "-------------------------------------------------------" diff --git a/ci-sdcc/st01-create-distribution.sh b/ci-sdcc/st01-create-distribution.sh index 469c4502..58e86f5e 100755 --- a/ci-sdcc/st01-create-distribution.sh +++ b/ci-sdcc/st01-create-distribution.sh @@ -3,8 +3,7 @@ # Execute script from root directory # setup environment -# Get toolchain version -source ./ci-sdcc/st00-header.sh $1 $2 +source ./ci-sdcc/st00-header.sh if [[ "$(uname -n)" == *"bamboo"* ]]; then set -e -u -o pipefail diff --git a/ci-sdcc/st02-install.sh b/ci-sdcc/st02-install.sh index e6185b3e..78cf8769 100755 --- a/ci-sdcc/st02-install.sh +++ b/ci-sdcc/st02-install.sh @@ -2,7 +2,7 @@ # Bamboo CI script to build actor and run standalone program # Execute script from root directory -source ./ci-sdcc/st00-header.sh $1 $2 +source ./ci-sdcc/st00-header.sh # Note Disable set -e option when using on local as it will exit the shell on error if [[ "$(uname -n)" == *"bamboo"* ]]; then diff --git a/ci-sdcc/st03-test.sh b/ci-sdcc/st03-test.sh index 1700b168..e36db3e4 100755 --- a/ci-sdcc/st03-test.sh +++ b/ci-sdcc/st03-test.sh @@ -1,9 +1,7 @@ #!/bin/bash # Bamboo CI script to test IDS tools on different toolchains # Execute script from root directory -source ./ci-sdcc/st00-header.sh $1 $2 $3 - -ENVIRONEMNT_NAME=env"$TOOLCHAIN_VERSION"_"$ACCESS_LAYER_VERSION" +source ./ci-sdcc/st00-header.sh python -m venv "$ENVIRONEMNT_NAME" @@ -42,7 +40,7 @@ echo "=====================================================================" echo "" echo "" echo "=====================================================================" -echo "Testing analysis scripts with URI $CORE_MODULE_VERSION and $PYTHON_VERSION" +echo "Testing analysis scripts with $PYTHON_VERSION" echo "=====================================================================" source ./tests/st03_test_analysis_scripts_with_uri.sh "$LOG_DIR" "$DB_DIR" errstatus=$? @@ -54,7 +52,7 @@ fi echo "" echo "" echo "=====================================================================" -echo "Testing ids manipulation scripts with $CORE_MODULE_VERSION and $PYTHON_VERSION" +echo "Testing ids manipulation scripts with $PYTHON_VERSION" echo "=====================================================================" source ./tests/st01_test_ids_scripts_with_uri.sh "$LOG_DIR" "$DB_DIR" errstatus=$? @@ -67,7 +65,7 @@ fi echo "" echo "" echo "=====================================================================" -echo "Testing db scripts with $CORE_MODULE_VERSION and $PYTHON_VERSION" +echo "Testing db scripts with $PYTHON_VERSION" echo "=====================================================================" source ./tests/st02_test_db_scripts.sh "$LOG_DIR" "$DB_DIR" errstatus=$? @@ -80,7 +78,7 @@ fi echo "" echo "" echo "=====================================================================" -echo "Testing scenario scripts with $CORE_MODULE_VERSION and $PYTHON_VERSION" +echo "Testing scenario scripts with $PYTHON_VERSION" echo "=====================================================================" source ./tests/st04_test_scenario_scripts.sh "$LOG_DIR" "$DB_DIR" errstatus=$? @@ -92,7 +90,7 @@ fi echo "" echo "" echo "=====================================================================" -echo "Run pytest for functions testing with $CORE_MODULE_VERSION and $PYTHON_VERSION" +echo "Run pytest for functions testing with $PYTHON_VERSION" echo "=====================================================================" pip install pytest python -m pytest --junit-xml="$LOG_DIR"/test_report.xml idstools/test diff --git a/ci-sdcc/st04-create-easybuildinfo.sh b/ci-sdcc/st04-create-easybuildinfo.sh deleted file mode 100755 index d66f1654..00000000 --- a/ci-sdcc/st04-create-easybuildinfo.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Bamboo CI script to create build information for easybuild -# Execute script from root directory - -source ./ci-sdcc/st00-header.sh $1 $2 - -# if successuful create hash and store in actor directory -COMMITHASH=$(git rev-parse HEAD) -VERSION=$(git describe --tags --always) -rm -f ./ci-sdcc/versioninfo.txt -cat >>./ci-sdcc/versioninfo.txt </dev/null 2>&1 - -# show contents of artifact -tar -tzvf ci-sdcc.tar.gz - -echo "Done" diff --git a/ci-sdcc/st06-doc.sh b/ci-sdcc/st06-doc.sh index 8be75ff8..fc7d4379 100755 --- a/ci-sdcc/st06-doc.sh +++ b/ci-sdcc/st06-doc.sh @@ -3,7 +3,7 @@ # Execute script from root directory source /etc/profile.d/modules.sh module use /work/imas/etc/modules/all -source ./ci-sdcc/st00-header.sh $1 $2 $3 +source ./ci-sdcc/st00-header.sh # Note Disable set -e option when using on local as it will exit the shell on error if [[ "$(uname -n)" == *"bamboo"* ]]; then @@ -11,7 +11,6 @@ if [[ "$(uname -n)" == *"bamboo"* ]]; then fi # module unload Python-bundle-PyPI -ENVIRONEMNT_NAME=env"$TOOLCHAIN_VERSION"_"$ACCESS_LAYER_VERSION" # Create python virtual environment and install dependencies rm -rf "$ENVIRONEMNT_NAME" diff --git a/ci-sdcc/st07-codecov.sh b/ci-sdcc/st07-codecov.sh index 8ef3a6e1..136d97f4 100755 --- a/ci-sdcc/st07-codecov.sh +++ b/ci-sdcc/st07-codecov.sh @@ -1,7 +1,7 @@ #!/bin/bash # Bamboo CI script to test IDS tools on different toolchains # Execute script from root directory -source ./ci-sdcc/st00-header.sh $1 $2 +source ./ci-sdcc/st00-header.sh if [[ "$(uname -n)" == *"bamboo"* ]]; then set -e -u -o pipefail @@ -20,8 +20,13 @@ source "$VIRTUALENV_DIR"/bin/activate pip install --upgrade pip pip install . pip install coverage + +# create logs directory +LOG_DIR="$PWD"/logs +mkdir -p "$LOG_DIR" + # run tests -coverage run --source=idstools -m pytest idstools/test +coverage run --source=idstools -m pytest --junit-xml="$LOG_DIR"/test_report.xml idstools/test # report coverage report -i diff --git a/ci-sdcc/st08-staticanalysis.sh b/ci-sdcc/st08-staticanalysis.sh index 25c4d61f..037ad788 100755 --- a/ci-sdcc/st08-staticanalysis.sh +++ b/ci-sdcc/st08-staticanalysis.sh @@ -1,16 +1,13 @@ #!/bin/bash # Bamboo CI script to test IDS tools on different toolchains # Execute script from root directory -source ./ci-sdcc/st00-header.sh $1 $2 +source ./ci-sdcc/st00-header.sh # Note Disable set -e option when using on local as it will exit the shell on error if [[ "$(uname -n)" == *"bamboo"* ]]; then set -e -u -o pipefail fi -ENVIRONEMNT_NAME=env"$TOOLCHAIN_VERSION"_"$ACCESS_LAYER_VERSION" -module unload IDStools - python -m venv "$ENVIRONEMNT_NAME" . "$ENVIRONEMNT_NAME"/bin/activate diff --git a/idstools/compute/waves.py b/idstools/compute/waves.py index 2c0a1523..6adf9c35 100644 --- a/idstools/compute/waves.py +++ b/idstools/compute/waves.py @@ -369,7 +369,15 @@ def get_ec_launchers_info(self, time_slice: int, usepsi=False, verbose=False): for iwave in range(len(self.ids.coherent_wave)): if len(self.ids.coherent_wave[iwave].identifier.antenna_name) > 0: - single_ec_launcher_name[iwave] = self.ids.coherent_wave[iwave].identifier.antenna_name + # Convert to Python string to ensure matplotlib compatibility (prevents array-like interpretation) + antenna_name = self.ids.coherent_wave[iwave].identifier.antenna_name + # Use str() to convert numpy strings/arrays to Python str + if hasattr(antenna_name, "item"): + # If it has .item() method (numpy scalar), use it + single_ec_launcher_name[iwave] = str(antenna_name.item()) + else: + # Otherwise just convert to str + single_ec_launcher_name[iwave] = str(antenna_name) else: single_ec_launcher_name[iwave] = f"Launcher{iwave + 1}" if np.size(self.ids.coherent_wave[iwave].global_quantities) > 0: