-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from GNiendorf/static_types
Add static typing with Python type annotations
- Loading branch information
Showing
16 changed files
with
386 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
name: Python Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test: | ||
test-and-typecheck: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Miniconda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set up Miniconda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
shell: bash -l {0} | ||
run: | | ||
conda create -n tracepyci python=${{ matrix.python-version }} --yes | ||
conda activate tracepyci | ||
conda install --yes numpy scipy matplotlib scikit-learn pandas pytest pytest-cov | ||
pip install mypy types-PyYAML pandas-stubs | ||
pip install . | ||
- name: Install dependencies | ||
shell: bash -l {0} | ||
run: | | ||
conda create -n tracepyci python=${{ matrix.python-version }} --yes | ||
conda activate tracepyci | ||
conda install --yes numpy scipy matplotlib scikit-learn pandas pytest pytest-cov | ||
pip install . | ||
- name: Run tests | ||
shell: bash -l {0} | ||
run: | | ||
conda activate tracepyci | ||
pytest tests/ | ||
- name: Run tests | ||
shell: bash -l {0} | ||
run: | | ||
conda activate tracepyci | ||
pytest tests/ | ||
- name: Run type checking | ||
shell: bash -l {0} | ||
run: | | ||
conda activate tracepyci | ||
mypy tracepy/ --ignore-missing-imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Constants used by optimizer | ||
SURV_CONST = 100 # Weight of failed propagation. | ||
MAX_RMS = 999 # Maximum RMS penalty for trace error. | ||
|
||
# Constants used for ray objects | ||
MAX_INTERSECTION_ITERATIONS = 1e4 # Max iter before failed intersection search. | ||
MAX_REFRACTION_ITERATIONS = 1e5 # Max iter before failed refraction. | ||
INTERSECTION_CONVERGENCE_TOLERANCE = 1e-6 # Tolerance for intersection search. | ||
REFRACTION_CONVERGENCE_TOLERANCE = 1e-15 # Tolerance for refraction. | ||
|
||
# Constants used for plotting | ||
PLOT_ROUNDING_ACC = 14 # Rounding accuracy for spot diagrams and plots. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.