PAROS 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paros-0.1.0/.github/workflows/ci.yml +59 -0
- paros-0.1.0/.github/workflows/release.yml +79 -0
- paros-0.1.0/.github/workflows/test-release.yml +53 -0
- paros-0.1.0/.github/workflows/voici.yml +53 -0
- paros-0.1.0/.gitignore +165 -0
- paros-0.1.0/CONTRIBUTING.md +22 -0
- paros-0.1.0/LICENSE +21 -0
- paros-0.1.0/PAROS/__init__.py +10 -0
- paros-0.1.0/PAROS/data/__init__.py +70 -0
- paros-0.1.0/PAROS/data/calibration/Topcon/TRC_50DX.csv +10 -0
- paros-0.1.0/PAROS/data/calibration/Topcon/TRC_50IX.csv +11 -0
- paros-0.1.0/PAROS/data/calibration/__init__.py +1 -0
- paros-0.1.0/PAROS/data/lenses/__init__.py +1 -0
- paros-0.1.0/PAROS/data/lenses/phantom.csv +13 -0
- paros-0.1.0/PAROS/eyephantom.py +197 -0
- paros-0.1.0/PAROS/fundscale.py +667 -0
- paros-0.1.0/PKG-INFO +89 -0
- paros-0.1.0/README.md +49 -0
- paros-0.1.0/examples/calculate_ocular_magnification.ipynb +427 -0
- paros-0.1.0/examples/fundus_camera_calibration.ipynb +491 -0
- paros-0.1.0/pyproject.toml +61 -0
- paros-0.1.0/voici/README.md +32 -0
- paros-0.1.0/voici/build-environment.yml +11 -0
- paros-0.1.0/voici/environment.yml +16 -0
- paros-0.1.0/voici/simple_example.ipynb +3678 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: Continuous Integration
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
- push
|
|
5
|
+
- pull_request
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
python: ["3.9", "3.10", "3.11", "3.12"]
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python }}
|
|
19
|
+
cache: pip
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: |
|
|
22
|
+
python -m pip install --upgrade pip
|
|
23
|
+
pip install hatch
|
|
24
|
+
- name: Build PAROS
|
|
25
|
+
run: hatch build
|
|
26
|
+
|
|
27
|
+
format:
|
|
28
|
+
name: Format and lint
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- name: Set up Python
|
|
33
|
+
uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: ${{ matrix.python }}
|
|
36
|
+
cache: pip
|
|
37
|
+
- name: Install dependencies
|
|
38
|
+
run: |
|
|
39
|
+
python -m pip install --upgrade pip
|
|
40
|
+
pip install hatch
|
|
41
|
+
- name: Format and lint
|
|
42
|
+
run: hatch fmt --check
|
|
43
|
+
|
|
44
|
+
jupyter:
|
|
45
|
+
name: Test Jupyter notebooks
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- name: Set up Python
|
|
50
|
+
uses: actions/setup-python@v5
|
|
51
|
+
with:
|
|
52
|
+
python-version: ${{ matrix.python }}
|
|
53
|
+
cache: pip
|
|
54
|
+
- name: Install dependencies
|
|
55
|
+
run: |
|
|
56
|
+
python -m pip install --upgrade pip
|
|
57
|
+
pip install hatch
|
|
58
|
+
- name: Format and lint
|
|
59
|
+
run: hatch run jupyter:run-all
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [released]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip
|
|
26
|
+
pip install build
|
|
27
|
+
- name: Build package
|
|
28
|
+
run: python -m build
|
|
29
|
+
- name: Upload dist
|
|
30
|
+
uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: paros_dist
|
|
33
|
+
path: "dist/"
|
|
34
|
+
|
|
35
|
+
publish_to_pypi:
|
|
36
|
+
name: Publish to PyPI
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment: PyPI
|
|
39
|
+
needs: build
|
|
40
|
+
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download dist
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: paros_dist
|
|
49
|
+
path: dist
|
|
50
|
+
- name: Publish package
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@v1.8.11
|
|
52
|
+
|
|
53
|
+
upload_to_github:
|
|
54
|
+
name: Upload to GitHub
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
if: github.event_name == 'release'
|
|
57
|
+
needs: build
|
|
58
|
+
|
|
59
|
+
permissions:
|
|
60
|
+
contents: write
|
|
61
|
+
|
|
62
|
+
steps:
|
|
63
|
+
- name: Download dist
|
|
64
|
+
uses: actions/download-artifact@v4
|
|
65
|
+
with:
|
|
66
|
+
name: paros_dist
|
|
67
|
+
path: dist
|
|
68
|
+
- name: Upload wheels to GitHub release
|
|
69
|
+
uses: svenstaro/upload-release-action@2.7.0
|
|
70
|
+
with:
|
|
71
|
+
tag: ${{ github.ref }}
|
|
72
|
+
file: "dist/*.whl"
|
|
73
|
+
file_glob: true
|
|
74
|
+
- name: Upload dist to GitHub release
|
|
75
|
+
uses: svenstaro/upload-release-action@2.7.0
|
|
76
|
+
with:
|
|
77
|
+
tag: ${{ github.ref }}
|
|
78
|
+
file: "dist/*.tar.gz"
|
|
79
|
+
file_glob: true
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Publish to TestPyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# Manual trigger
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip
|
|
26
|
+
pip install build
|
|
27
|
+
- name: Build package
|
|
28
|
+
run: python -m build
|
|
29
|
+
- name: Upload dist
|
|
30
|
+
uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: paros_dist
|
|
33
|
+
path: "dist/"
|
|
34
|
+
|
|
35
|
+
publish_to_testpypi:
|
|
36
|
+
name: Publish to TestPyPI
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment: TestPyPI
|
|
39
|
+
needs: build
|
|
40
|
+
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download dist
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: paros_dist
|
|
49
|
+
path: dist
|
|
50
|
+
- name: Publish package
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@v1.8.11
|
|
52
|
+
with:
|
|
53
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Build and Deploy
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- '*'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.10"
|
|
22
|
+
|
|
23
|
+
- name: Install mamba
|
|
24
|
+
uses: mamba-org/setup-micromamba@v1
|
|
25
|
+
with:
|
|
26
|
+
micromamba-version: "1.5.6-0"
|
|
27
|
+
environment-file: "voici/build-environment.yml"
|
|
28
|
+
|
|
29
|
+
- name: Build the JupyterLite site
|
|
30
|
+
shell: bash -l {0}
|
|
31
|
+
run: cd voici && voici build --contents simple_example.ipynb --output-dir dist
|
|
32
|
+
|
|
33
|
+
- name: Upload artifact
|
|
34
|
+
uses: actions/upload-pages-artifact@v3
|
|
35
|
+
with:
|
|
36
|
+
path: ./voici/dist
|
|
37
|
+
|
|
38
|
+
deploy:
|
|
39
|
+
needs: build
|
|
40
|
+
if: github.ref == 'refs/heads/main'
|
|
41
|
+
permissions:
|
|
42
|
+
pages: write
|
|
43
|
+
id-token: write
|
|
44
|
+
|
|
45
|
+
environment:
|
|
46
|
+
name: github-pages
|
|
47
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
48
|
+
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- name: Deploy to GitHub Pages
|
|
52
|
+
id: deployment
|
|
53
|
+
uses: actions/deploy-pages@v4
|
paros-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# Voici
|
|
82
|
+
voici/_output/
|
|
83
|
+
.jupyterlite.doit.db
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# IPython
|
|
87
|
+
profile_default/
|
|
88
|
+
ipython_config.py
|
|
89
|
+
|
|
90
|
+
# pyenv
|
|
91
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
92
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
93
|
+
# .python-version
|
|
94
|
+
|
|
95
|
+
# pipenv
|
|
96
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
97
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
98
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
99
|
+
# install all needed dependencies.
|
|
100
|
+
#Pipfile.lock
|
|
101
|
+
|
|
102
|
+
# poetry
|
|
103
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
104
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
105
|
+
# commonly ignored for libraries.
|
|
106
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
107
|
+
#poetry.lock
|
|
108
|
+
|
|
109
|
+
# pdm
|
|
110
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
111
|
+
#pdm.lock
|
|
112
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
113
|
+
# in version control.
|
|
114
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
115
|
+
.pdm.toml
|
|
116
|
+
|
|
117
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
118
|
+
__pypackages__/
|
|
119
|
+
|
|
120
|
+
# Celery stuff
|
|
121
|
+
celerybeat-schedule
|
|
122
|
+
celerybeat.pid
|
|
123
|
+
|
|
124
|
+
# SageMath parsed files
|
|
125
|
+
*.sage.py
|
|
126
|
+
|
|
127
|
+
# Environments
|
|
128
|
+
.env
|
|
129
|
+
.venv
|
|
130
|
+
env/
|
|
131
|
+
venv/
|
|
132
|
+
ENV/
|
|
133
|
+
env.bak/
|
|
134
|
+
venv.bak/
|
|
135
|
+
|
|
136
|
+
# Spyder project settings
|
|
137
|
+
.spyderproject
|
|
138
|
+
.spyproject
|
|
139
|
+
|
|
140
|
+
# Rope project settings
|
|
141
|
+
.ropeproject
|
|
142
|
+
|
|
143
|
+
# mkdocs documentation
|
|
144
|
+
/site
|
|
145
|
+
|
|
146
|
+
# mypy
|
|
147
|
+
.mypy_cache/
|
|
148
|
+
.dmypy.json
|
|
149
|
+
dmypy.json
|
|
150
|
+
|
|
151
|
+
# Pyre type checker
|
|
152
|
+
.pyre/
|
|
153
|
+
|
|
154
|
+
# pytype static type analyzer
|
|
155
|
+
.pytype/
|
|
156
|
+
|
|
157
|
+
# Cython debug symbols
|
|
158
|
+
cython_debug/
|
|
159
|
+
|
|
160
|
+
# PyCharm
|
|
161
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
162
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
163
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
164
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
165
|
+
.idea/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Contributing to PAROS
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to PAROS! Before contributing, please read these guidelines, so we can process
|
|
4
|
+
your contribution as quickly as possible.
|
|
5
|
+
|
|
6
|
+
## Contribution ideas
|
|
7
|
+
|
|
8
|
+
We aim to make usage of the PAROS method as easy as possible by providing the code open-source in our Git repository. Any contributions serving this goal are welcome. For example, the addition of calibration experiments for other cameras than already provided could be added.
|
|
9
|
+
|
|
10
|
+
## Code style
|
|
11
|
+
|
|
12
|
+
- Please format your docstrings according to [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html).
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
### 1. Add your new feature
|
|
17
|
+
|
|
18
|
+
Add your contribution in a new feature branch.
|
|
19
|
+
|
|
20
|
+
### 2. Open a Pull Request
|
|
21
|
+
|
|
22
|
+
Open a Pull Request, wait for our suggestions, and get your contribution merged!
|
paros-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Lennart Pors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""PARaxial Optical fundus Scaling (PAROS)
|
|
2
|
+
|
|
3
|
+
Paros is a method to calculate the magnification of fundus images based on the optical characteristics of the patient's
|
|
4
|
+
eye. The full method and validation are described in (article reference to be added upon acceptance).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from PAROS import data, eyephantom, fundscale
|
|
8
|
+
|
|
9
|
+
__all__ = ("data", "eyephantom", "fundscale")
|
|
10
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Calibration and lens data files."""
|
|
2
|
+
|
|
3
|
+
import importlib.resources
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import cast
|
|
6
|
+
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
__all__ = ("get_camera_calibration_data", "get_lens_data")
|
|
10
|
+
|
|
11
|
+
calibration = importlib.resources.files("PAROS.data.calibration")
|
|
12
|
+
lenses = importlib.resources.files("PAROS.data.lenses")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _find_available_manufacturers():
|
|
16
|
+
return [i.name for i in calibration.iterdir() if i.is_dir()]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
_camera_manufacturers = _find_available_manufacturers()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_camera_calibration_data(manufacturer: str, camera: str) -> pd.DataFrame:
|
|
23
|
+
"""Get camera calibration data for a given manufacturer and camera.
|
|
24
|
+
|
|
25
|
+
Reads the data file at `PAROS/data/calibration/{manufacturer}/{camera}.csv` and
|
|
26
|
+
returns it as a pandas DataFrame.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
manufacturer : str
|
|
31
|
+
Camera manufacturer name.
|
|
32
|
+
camera : str
|
|
33
|
+
Camera model name.
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
-------
|
|
37
|
+
pandas.DataFrame
|
|
38
|
+
Dataframe containing the camera calibration data.
|
|
39
|
+
"""
|
|
40
|
+
if manufacturer not in _camera_manufacturers:
|
|
41
|
+
raise KeyError(f"Manufacturer {manufacturer} does not exist.")
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
camera_data_file = cast(Path, calibration.joinpath(manufacturer, camera + ".csv"))
|
|
45
|
+
|
|
46
|
+
return pd.read_csv(camera_data_file)
|
|
47
|
+
except FileNotFoundError as e:
|
|
48
|
+
raise KeyError(f"Camera {camera} does not exist for manufacturer {manufacturer}.") from e
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def get_lens_data(name: str) -> pd.DataFrame:
|
|
52
|
+
"""Get lens data.
|
|
53
|
+
|
|
54
|
+
Reads the data file at `PAROS/data/lenses/{name}.csv` and returns it as a pandas DataFrame.
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
name : str
|
|
59
|
+
Name of the lens data set.
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
pandas.DataFrame
|
|
64
|
+
Dataframe containing the lens data.
|
|
65
|
+
"""
|
|
66
|
+
try:
|
|
67
|
+
lens_data_file = cast(Path, lenses.joinpath(name + ".csv"))
|
|
68
|
+
return pd.read_csv(lens_data_file)
|
|
69
|
+
except FileNotFoundError as e:
|
|
70
|
+
raise KeyError(f"Lens data does not exist for name {name}.") from e
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
experiment_number,lens_1,lens_2,uncorrected_measurement,distance_camera_eye_mm,distance_camera_pinhole_mm,distance_pinhole_lens1_mm,distance_lens1_lens2_mm,distance_lens2_grid_mm,axial_length
|
|
2
|
+
0,LB_1471,LB_1945,6.966666667,5.5,49.61969784,2.880302163,3.027080745,29.69261709,40.71969784
|
|
3
|
+
1,LB_1471,LB_1945,6.726666667,5.5,49.61969784,2.880302163,3.027080745,31.69261709,42.71969784
|
|
4
|
+
2,LB_1471,LB_1945,6.6,5.5,49.61969784,2.880302163,3.027080745,33.69261709,44.71969784
|
|
5
|
+
3,LB_1471,LB_1945,6.37,5.5,49.61969784,2.880302163,3.027080745,35.69261709,46.71969784
|
|
6
|
+
4,LB_1471,LB_1945,6.25,5.5,49.61969784,2.880302163,3.027080745,37.69261709,48.71969784
|
|
7
|
+
5,LB_1471,LB_1945,6.086666667,5.5,49.61969784,2.880302163,3.027080745,39.69261709,50.71969784
|
|
8
|
+
6,LB_1471,LB_1945,5.973333333,5.5,49.61969784,2.880302163,3.027080745,41.69261709,52.71969784
|
|
9
|
+
7,LB_1471,LB_1945,5.746666667,5.5,49.61969784,2.880302163,3.027080745,43.69261709,54.71969784
|
|
10
|
+
8,LB_1471,LB_1945,5.613333333,5.5,49.61969784,2.880302163,3.027080745,45.39261709,56.41969784
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
lens_1,lens_2,axial_length,distance_camera_eye_mm,uncorrected_measurement,distance_camera_pinhole_mm,distance_pinhole_lens1_mm,distance_lens1_lens2_mm,distance_lens2_grid_mm,experiment_number
|
|
2
|
+
LE_1156,LB_1945,83.9874534,5.5,3.31,50.2374534,2.262546596,6.344836312,71.54261709,0
|
|
3
|
+
LE_1156,LB_1945,90.7374534,5.5,3.13,50.2374534,2.262546596,6.344836312,78.29261709,1
|
|
4
|
+
LE_1156,LB_1945,78.0374534,5.5,3.46,50.2374534,2.262546596,6.344836312,65.59261709,2
|
|
5
|
+
LE_1156,LB_1945,134.6374534,5.5,2.24,50.2374534,2.262546596,6.344836312,122.1926171,3
|
|
6
|
+
LE_1156,LB_1945,107.9374534,5.5,2.69,50.2374534,2.262546596,6.344836312,95.49261709,4
|
|
7
|
+
LE_1156,LB_1945,72.0374534,5.5,3.71,50.2374534,2.262546596,6.344836312,59.59261709,5
|
|
8
|
+
LE_1156,LB_1945,63.6374534,5.5,4.08,50.2374534,2.262546596,6.344836312,51.19261709,6
|
|
9
|
+
LE_1234,LB_1056,62.51915876,5,4.28,45.31915876,2.180841236,5.205295461,51.1138633,7
|
|
10
|
+
LE_1234,LB_1056,75.91915876,5,3.66,45.31915876,2.180841236,5.205295461,64.5138633,8
|
|
11
|
+
LE_1234,LB_1056,96.51915876,5,2.98,45.31915876,2.180841236,5.205295461,85.1138633,9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Camera calibration data files."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Lens data files."""
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name,lens_type,thickness_centre,thickness_edge,diameter,power,front_radius,back_radius,refractive_index,power_calculated
|
|
2
|
+
LB_1409,biconvex,2.2,2.0,25.6,1.0,1029.8,-1029.8,1.515,1.0001942124684402
|
|
3
|
+
LB_1869,biconvex,2.3,2.0,25.6,2.0,514.7,-514.7,1.515,2.001165727608315
|
|
4
|
+
LB_1056_1,biconvex,2.6,2.0,25.6,4.0,257.1,-257.1,1.515,4.006223259432127
|
|
5
|
+
LE_1234,convex-concave,3.6,2.0,25.6,10.0,-82.2,-32.1,1.515,9.77840689451304
|
|
6
|
+
LE_1156,convex-concave,3.3,2.0,25.6,8.0,-106.9,-40.6,1.515,7.867142534572616
|
|
7
|
+
LE_1104,convex-concave,3.1,2.0,25.6,6.7,-131.6,-49.1,1.515,6.575424510489725
|
|
8
|
+
LE_1202,convex-concave,2.8,2.0,25.6,5.0,-182.2,-66.2,1.515,4.952891978205283
|
|
9
|
+
LB_1945,biconvex,2.8,2.0,25.6,5.0,205.6,-205.6,1.515,5.009727626459142
|
|
10
|
+
LB_1056,biconvex,2.6,2.0,25.6,4.0,257.1,-257.1,1.515,4.006223259432127
|
|
11
|
+
LB_1779,biconvex,2.5,2.0,25.6,3.3,308.6,-308.6,1.515,3.3376539209332456
|
|
12
|
+
LB_1471,biconvex,5.2,2.0,25.6,20.0,50.6,-50.6,1.515,20.355731225296400
|
|
13
|
+
LB_1757,biconvex,7.7,2.0,25.6,33.3,29.5,-29.5,1.515,34.91525423728813
|