A Python package for visualization and analysis of calorimeter data.
- Create a 1D calorimenter with active and passive layers
- Visualise shower development
- Monte Carlo generation to explore resolution
Clone the repository and install in development mode:
git clone https://github.com/yourusername/calorimeter.git
cd calorimeter
pip install -e .pip install -e ".[dev]"If you are staff or student at an Australian or New Zealand University, you can use binder on ARDC resources.
from calorimeter import Calorimeter, Simulation, Layer, Electron
import matplotlib.pyplot as plt
mycal = Calorimeter()
lead = Layer('lead', 2.0, 0.5, 0.0)
scintillator = Layer('Scin', 0.01, 0.5, 1.0)
for i in range(40):
mycal.add_layers([lead, scintillator])
sim = Simulation(mycal)
ionisations, cal_with_traces = sim.simulate_with_tracing(Electron(0.0, 100.0), deadcellfraction=0.0)
fig, ax = plt.subplots(figsize=(14, 6))
ax = cal_with_traces.draw(ax=ax, show_traces=True)
plt.tight_layout()
plt.show()Run the test suite using pytest:
pytestWith coverage report:
pytest --cov=calorimeter tests/The project uses several tools for code quality:
- pytest: Testing framework
- pytest-cov: Code coverage measurement
- black: Code formatting
- flake8: Linting
- mypy: Static type checking
# Format code
black calorimeter tests
# Run linting
flake8 calorimeter tests
# Type checking
mypy calorimeter
# Tests with coverage
pytest --cov=calorimeter tests/This project is licensed under the GPLv3 License - see the LICENSE file for details.
Contributions are welcome! Before submitting a PR:
- Install dev dependencies:
pip install -e ".[dev]" - Run the test suite:
pytest -q - Check linting and types:
flake8 calorimeter testsandmypy calorimeter
In a fresh clone, run:
pip install -e ".[dev]"
pytest -qThis repository includes a shared pre-commit configuration at .pre-commit-config.yaml.
It will:
- Strip outputs from
*.ipynbnotebooks (vianbstripout). - Apply basic hygiene checks (trailing whitespace, EOF fixer, YAML checks).
Set up locally:
pip install -e ".[dev]"
pre-commit install
pre-commit run --all-filesNote: pre-commit runs automatically on git commit after installation.
- For issues, or bug reports, please open an issue on GitHub.
- For questions and discussions, use the discussion forum.
