Skip to content
Open
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
4 changes: 0 additions & 4 deletions ci-sdcc/dependencies.txt

This file was deleted.

170 changes: 33 additions & 137 deletions ci-sdcc/st00-header.sh
Original file line number Diff line number Diff line change
@@ -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 "-------------------------------------------------------"
3 changes: 1 addition & 2 deletions ci-sdcc/st01-create-distribution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ci-sdcc/st02-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions ci-sdcc/st03-test.sh
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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=$?
Expand All @@ -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=$?
Expand All @@ -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=$?
Expand All @@ -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=$?
Expand All @@ -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
Expand Down
29 changes: 0 additions & 29 deletions ci-sdcc/st04-create-easybuildinfo.sh

This file was deleted.

3 changes: 1 addition & 2 deletions ci-sdcc/st06-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
# 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
set -e -u -o pipefail
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"
Expand Down
9 changes: 7 additions & 2 deletions ci-sdcc/st07-codecov.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions ci-sdcc/st08-staticanalysis.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 9 additions & 1 deletion idstools/compute/waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

antenna_name is a string, this is not a proper way to check existence, and can you explain the reason for the addition below?

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:
Expand Down