A Python library for converting DIII-D MDSplus data to IMAS (ITER Integrated Modelling & Analysis Suite) format.
IMAS Composer provides a clean, declarative API for mapping DIII-D diagnostic and analysis data (stored in MDSplus) to standardized IMAS v3.41.0 data structures (IDS - Interface Data Structures). It handles:
- Requirement identification: Determining what MDSplus data needs to be fetched
- Data transformation: Converting units, coordinate systems, and data layouts
- COCOS conversions: Handling magnetic coordinate conventions
- Composition: Assembling final IMAS-compliant data structures
mamba install -c conda-forge imas_composerFor development setup, see INSTALLATION.md.
from imas_composer.fetchers import simple_load
# Load IMAS data with automatic MDSplus fetching
shot = 200000
ids_paths = ['equilibrium.time', 'equilibrium.time_slice.profiles_1d.psi']
results = simple_load(ids_paths, shot, efit_tree='EFIT01')
# results = {'equilibrium.time': array(...), 'equilibrium.time_slice.profiles_1d.psi': array(...)}Clone IMAS_composer:
git clone git@github.com:GA-FDP/imas_composer.git
cd imas_composer
Create a new environment:
module load conda
mamba env create -f environment.yaml
conda activate imas_composer
pip install --no-deps --no-build-isolation -e .
add imas_python dependencies
pip install --no-deps --no-build-isolation imas_data_dictionaries xxhash imas_core
Checkout dev version of imas_python
cd ../
git clone git@github.com:AreWeDreaming/IMAS-Python.git
cd IMAS-Python
git switch awkward_array_support
Add imas_python to the environment
pip install --no-deps --no-build-isolation -e .
Patch _version.py missed by pip install
cat > imas/_version.py << 'EOF'
version="0.0.0"
version_tuple=[0,0,0]
EOF
Run the simple test:
cd ../imas_composer
python convert_to_ids.py
This project is designed to be extended with AI assistance.
At the start of each Claude Code session, tell Claude:
Read .claude/.claudecontext
This provides:
- Data privacy policy (NEVER execute code)
- Project architecture and three-stage requirement system
- OMAS integration patterns
- Links to detailed implementation and testing guides
Tell Claude which OMAS mapping to implement:
Implement equilibrium.time_slice.profiles_2d.psi from omas/machine_mappings/_efit.json
Claude will create the necessary mapper code, YAML configuration, and test files. See .claude/.claudecontext and .claude/IMPLEMENTING_FIELDS.md for details.
When contributing new fields or IDS mappers:
- Follow the three-stage requirement pattern (DIRECT → DERIVED → COMPUTED)
- Match OMAS transformations exactly
- Add field configurations to YAML files
- Include both requirement and composition tests
- Consider using Claude Code with .claude/ documentation for guidance
CRITICAL: Module-level imports only
- NEVER import modules at the function level (e.g.,
import awkward as akinside a function) - All imports must be at the module/file level at the top of the file
- This ensures consistent performance and avoids import overhead in tight loops
- Violation of this rule can cause significant performance degradation in tests and production code
- IMAS Documentation: https://www.iter.org/
- OMAS Repository: https://github.com/gafusion/omas
- DIII-D MDSplus Documentation: Internal DIII-D documentation https://nomos.gat.com/DIII-D/documentation/
- Claude Code Context: See
.claude/README.mdfor development guides
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For questions or contributions, please open an issue on the project repository.