# Reproducibility Guide

This document provides detailed instructions for reproducing the results presented in the manuscript.

## Environment Setup

### Option 1: Local Python Environment

1. System Requirements:
   - Python 3.8 or higher
   - Git
   - 8GB RAM recommended
   - 20GB free disk space

2. Installation Steps:
```bash
# Create virtual environment
python -m venv panarch-env

# Activate environment
# On Unix/macOS:
source panarch-env/bin/activate
# On Windows:
panarch-env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Verify installation
python -m pytest tests/
```

### Option 2: Docker Environment

1. System Requirements:
   - Docker Desktop
   - 8GB RAM recommended
   - 20GB free disk space

2. Installation Steps:
```bash
# Build image
docker build -t panarch .

# Run tests
docker run panarch
```

## Reproducing Results

### 1. Network Analysis (PANARCH.py)

```bash
python PANARCH.py
```

Expected outputs:
- `results/figure_1_*.png`: 3D trajectory plot
- `results/figure_2_*.png`: Phase space plot
- `results/figure_3_*.png`: Transition network
- `results/metrics_*.csv`: Computed metrics

### 2. Agent-Based Simulations (ABM.py)

```bash
python ABM.py
```

Expected outputs:
- `results/abm_phase_*.png`: Simulation visualizations
- `results/abm_metrics_*.csv`: Simulation data

### 3. Sensitivity Analysis

```bash
python "Sensitivity Analysis.py"
```

Expected outputs:
- `results/sensitivity_*.png`: Analysis plots
- `results/statistical_test_results.json`: Test results

## Troubleshooting

### Common Issues

1. Memory Errors:
   - Increase available RAM
   - Reduce batch size in ABM simulations

2. Graphics Issues:
   - Set `MPLBACKEND=Agg` for headless environments
   - Use Docker with appropriate volume mounts

3. Data Loading Errors:
   - Verify .graphml files are in data/ directory
   - Check file permissions

### Validation

1. Run test suite:
```bash
python -m pytest tests/
```

2. Check computed metrics against manuscript values:
```bash
python tests/validate_results.py
```

## Support

For issues or questions:
1. Check existing GitHub issues
2. Create a new issue with:
   - Environment details
   - Error messages
   - Steps to reproduce

## Version Information

This guide applies to:
- PANARCH version 1.0.0
- Python 3.8+
- All dependencies as specified in requirements.txt