Issue: Hardcoded Absolute File Paths Break Cross-Platform Execution
Description
Currently, several simulation scripts (for example, Model_I/sim_axion.py) contain hardcoded absolute file paths pointing to a specific user’s directory on a Linux cluster (e.g., /users/mtoomey/scratch/...). This causes the scripts to crash immediately on Windows, macOS, or any system other than the original author's.
This causes the scripts to crash immediately on Windows, macOS, or any system other than the original author’s environment.
Steps to Reproduce
- Clone the repository on a Windows or macOS machine.
- Attempt to run the script:
python Model_I/sim_axion.py
- The script fails with a
FileNotFoundError because the directory /users/mtoomey/... does not exist.### Expected Behavior
The scripts should use relative paths or a configurable base directory so that data is saved within the project folder regardless of the operating system.
Proposed Fix
Replace absolute path strings with os.path joins to the current working directory.
Python
import os
base_path = os.path.join(os.getcwd(), 'data', 'Model_I')
os.makedirs(base_path, exist_ok=True)
Issue: Hardcoded Absolute File Paths Break Cross-Platform Execution
Description
Currently, several simulation scripts (for example,
Model_I/sim_axion.py) contain hardcoded absolute file paths pointing to a specific user’s directory on a Linux cluster (e.g.,/users/mtoomey/scratch/...). This causes the scripts to crash immediately on Windows, macOS, or any system other than the original author's.This causes the scripts to crash immediately on Windows, macOS, or any system other than the original author’s environment.
Steps to Reproduce
FileNotFoundErrorbecause the directory/users/mtoomey/...does not exist.### Expected BehaviorThe scripts should use relative paths or a configurable base directory so that data is saved within the project folder regardless of the operating system.
Proposed Fix
Replace absolute path strings with
os.pathjoins to the current working directory.Python