Documentation

Usage

Installation, tests, example scripts, custom phase diagrams, output paths, and release publishing for the topological photonics simulation package.

Installation

Install from PyPI after publication:

pip install dynamics-of-topological-photonics

For local development:

git clone https://github.com/SidRichardsQuantum/Dynamics_of_Topological_Photonics.git
cd Dynamics_of_Topological_Photonics
pip install -e .

Run Tests

python -m unittest discover -s tests

Generate Example Figures

Generate the default NRSSH phase diagram:

python examples/nrssh_examples/nrssh_phases.py

Generate the default Diamond phase diagram:

python examples/diamond_examples/diamond_phases.py

The example folders also include scripts for eigenenergies, eigenvectors, first moments, and final-state moments.

Custom Phase Diagrams

from topological_photonics.phases.nrssh_phase_diagrams import plot_example_phase_diagram


if __name__ == "__main__":
    gamma1_arr, gamma2_arr, conv_times, conv_mask = plot_example_phase_diagram(
        v=0.3,
        u=0.2,
        r=0.9,
        S=1.0,
        points=20,
        verbose=True,
    )

Output Directories

Generated plots are written to outputs/ by default. The tracked images/ directory is reserved for curated figures referenced by the documentation.

TOPOPHOTONICS_OUTPUT_DIR=/tmp/topophotonics python examples/nrssh_examples/nrssh_phases.py

When calling plotting functions directly, pass output_dir="/path/to/output" to choose the destination directory.

Release Publishing

After PyPI trusted publishing is configured for .github/workflows/publish.yml, build, check, tag, and push the version tag:

rm -rf dist build *.egg-info
python -m build
python -m twine check dist/*
VERSION=$(python -c 'import tomllib, pathlib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])') && git tag "v$VERSION" && git push origin "v$VERSION"