-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_EM_Data.sh
More file actions
executable file
·47 lines (38 loc) · 1.47 KB
/
process_EM_Data.sh
File metadata and controls
executable file
·47 lines (38 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Ensure Python can resolve the installed or local package
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PYTHONPATH="${SCRIPT_DIR}/src${PYTHONPATH:+:${PYTHONPATH}}"
PYTHON_BIN="${PYTHON:-python}"
# Set the base directories to search through
BASE_DIRS=(
"/Users/etay8828/Desktop/IDEX_Cal/Pre_Launch/2025_02_06_run2_split"
"/Users/etay8828/Desktop/IDEX_Cal/Pre_Launch/2025_02_06_run1_split"
)
# Log file for errors
LOG_FILE="error_log.txt"
# Clear the log file at the start
> "$LOG_FILE"
# Function to process folders
process_folder() {
local folder="$1"
# Check if the folder contains .trc files
if ls "$folder"/*.trc 1> /dev/null 2>&1; then
# Extract the folder name to use as the experiment name
experiment_name=$(basename "$folder")
echo "Processing folder: $folder with experiment name: $experiment_name"
# Run the script with the folder as the --trcdir argument
"$PYTHON_BIN" -m spectrumpy_flight.ImpactBook --trcdir "$folder" --experimentname "$experiment_name"
if [ $? -ne 0 ]; then
echo "Error processing $folder" >> "$LOG_FILE"
fi
fi
}
# Export the function for subshells
export -f process_folder
export LOG_FILE
# Loop through both base directories
for BASE_DIR in "${BASE_DIRS[@]}"; do
echo "Processing base directory: $BASE_DIR"
find "$BASE_DIR" -type d -exec bash -c 'process_folder "$0"' {} \;
done
echo "Processing complete. Check $LOG_FILE for errors."