Skip to content

Commit

Permalink
Split plotting functionality from SkyScanResult (#28)
Browse files Browse the repository at this point in the history
* remove SkyScanResult attributes and methods

* <bot> update requirements-examples.txt

* <bot> update requirements-tests.txt

* <bot> update requirements.txt

* remove plotting stuff

* mypy partial compliance

* mypy compliance

* test compliance

* documentation

* add __all__ for flake8 compliance

* move logger

* logging no longer needed

* bump ci

* add `mypy` extra for ci

* add optional output dir

* <bot> update setup.cfg

* <bot> update .gitignore

* <bot> update dependencies*.log files(s)

---------

Co-authored-by: wipacdevbot <[email protected]>
Co-authored-by: Ric Evans <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2023
1 parent 0de5408 commit dcb25a0
Show file tree
Hide file tree
Showing 12 changed files with 326 additions and 1,378 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/wipac-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ env:

jobs:

py-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: versions
uses: WIPACrepo/[email protected]

flake8:
runs-on: ubuntu-latest
steps:
Expand All @@ -21,11 +30,18 @@ jobs:
- uses: WIPACrepo/[email protected]

mypy:
needs: [py-versions]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py3: ${{ fromJSON(needs.py-versions.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: WIPACrepo/[email protected]
with:
python-version: ${{ matrix.py3 }}
- uses: WIPACrepo/[email protected]

py-setup:
runs-on: ubuntu-latest
Expand All @@ -43,21 +59,12 @@ jobs:
github.actor != 'dependabot[bot]' &&
github.ref_type == 'branch'
name: wipac-dev-py-setup-action (only for non-dependabot non-default branches)
uses: WIPACrepo/wipac-dev-py-setup-action@v1.14
uses: WIPACrepo/wipac-dev-py-setup-action@v2.7
with:
base-keywords: IceCube
git_committer_name: ${{ env.BOT_NAME }}
git_committer_email: ${{ env.BOT_EMAIL }}
py-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: versions
uses: WIPACrepo/[email protected]

unit-tests:
needs: [py-versions]
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,7 @@ dmypy.json


*-token
*.token
*.token

# wipac-dev-py-setup-action
!dependencies*.log
16 changes: 9 additions & 7 deletions requirements-examples.txt → dependencies-examples.log
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=examples --output-file=requirements-examples.txt
# pip-compile --extra=examples --output-file=dependencies-examples.log
#
astropy==5.3.4
# via
Expand Down Expand Up @@ -36,7 +36,7 @@ matplotlib==3.8.0
# icecube-skyreader (setup.py)
meander==0.0.3
# via icecube-skyreader (setup.py)
numpy==1.26.0
numpy==1.26.1
# via
# astropy
# contourpy
Expand All @@ -52,14 +52,16 @@ packaging==23.2
# matplotlib
pandas==2.1.1
# via icecube-skyreader (setup.py)
pillow==10.0.1
pillow==10.1.0
# via matplotlib
pycparser==2.21
# via cffi
pyerfa==2.0.0.3
pyerfa==2.0.1.1
# via astropy
pyjwt[crypto]==2.8.0
# via wipac-rest-tools
# via
# pyjwt
# wipac-rest-tools
pyparsing==3.1.1
# via matplotlib
pypng==0.20220715.0
Expand Down Expand Up @@ -93,7 +95,7 @@ typing-extensions==4.8.0
# wipac-dev-tools
tzdata==2023.3
# via pandas
urllib3==2.0.6
urllib3==2.0.7
# via
# requests
# wipac-rest-tools
Expand Down
118 changes: 118 additions & 0 deletions dependencies-mypy.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=mypy --output-file=dependencies-mypy.log
#
astropy==5.3.4
# via
# healpy
# icecube-skyreader (setup.py)
cachetools==5.3.1
# via wipac-rest-tools
certifi==2023.7.22
# via requests
cffi==1.16.0
# via cryptography
charset-normalizer==3.3.0
# via requests
contourpy==1.1.1
# via matplotlib
cryptography==41.0.4
# via pyjwt
cycler==0.12.1
# via matplotlib
fonttools==4.43.1
# via matplotlib
healpy==1.16.6
# via icecube-skyreader (setup.py)
idna==3.4
# via requests
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.5
# via matplotlib
matplotlib==3.8.0
# via
# healpy
# icecube-skyreader (setup.py)
meander==0.0.3
# via icecube-skyreader (setup.py)
numpy==1.26.1
# via
# astropy
# contourpy
# healpy
# icecube-skyreader (setup.py)
# matplotlib
# pandas
# pyerfa
# scipy
packaging==23.2
# via
# astropy
# matplotlib
# pytest
pandas==2.1.1
# via icecube-skyreader (setup.py)
pillow==10.1.0
# via matplotlib
pluggy==1.3.0
# via pytest
pycparser==2.21
# via cffi
pyerfa==2.0.1.1
# via astropy
pyjwt[crypto]==2.8.0
# via
# pyjwt
# wipac-rest-tools
pyparsing==3.1.1
# via matplotlib
pypng==0.20220715.0
# via qrcode
pytest==7.4.2
# via
# icecube-skyreader (setup.py)
# pytest-mock
pytest-mock==3.12.0
# via icecube-skyreader (setup.py)
python-dateutil==2.8.2
# via
# matplotlib
# pandas
pytz==2023.3.post1
# via pandas
pyyaml==6.0.1
# via astropy
qrcode==7.4.2
# via wipac-rest-tools
requests==2.31.0
# via
# requests-futures
# wipac-dev-tools
# wipac-rest-tools
requests-futures==1.0.1
# via wipac-rest-tools
scipy==1.11.3
# via healpy
six==1.16.0
# via python-dateutil
tornado==6.3.3
# via wipac-rest-tools
typing-extensions==4.8.0
# via
# qrcode
# wipac-dev-tools
tzdata==2023.3
# via pandas
urllib3==2.0.7
# via
# requests
# wipac-rest-tools
wipac-dev-tools==1.7.0
# via
# icecube-skyreader (setup.py)
# wipac-rest-tools
wipac-rest-tools==1.6.0
# via icecube-skyreader (setup.py)
18 changes: 7 additions & 11 deletions requirements-tests.txt → dependencies-tests.log
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=tests --output-file=requirements-tests.txt
# pip-compile --extra=tests --output-file=dependencies-tests.log
#
astropy==5.3.4
# via
Expand All @@ -16,8 +16,6 @@ contourpy==1.1.1
# via matplotlib
cycler==0.12.1
# via matplotlib
exceptiongroup==1.1.3
# via pytest
fonttools==4.43.1
# via matplotlib
healpy==1.16.6
Expand All @@ -34,7 +32,7 @@ matplotlib==3.8.0
# icecube-skyreader (setup.py)
meander==0.0.3
# via icecube-skyreader (setup.py)
numpy==1.26.0
numpy==1.26.1
# via
# astropy
# contourpy
Expand All @@ -51,19 +49,19 @@ packaging==23.2
# pytest
pandas==2.1.1
# via icecube-skyreader (setup.py)
pillow==10.0.1
pillow==10.1.0
# via matplotlib
pluggy==1.3.0
# via pytest
pyerfa==2.0.0.3
pyerfa==2.0.1.1
# via astropy
pyparsing==3.1.1
# via matplotlib
pytest==7.4.2
# via
# icecube-skyreader (setup.py)
# pytest-mock
pytest-mock==3.11.1
pytest-mock==3.12.0
# via icecube-skyreader (setup.py)
python-dateutil==2.8.2
# via
Expand All @@ -79,13 +77,11 @@ scipy==1.11.3
# via healpy
six==1.16.0
# via python-dateutil
tomli==2.0.1
# via pytest
typing-extensions==4.8.0
# via wipac-dev-tools
tzdata==2023.3
# via pandas
urllib3==2.0.6
urllib3==2.0.7
# via requests
wipac-dev-tools==1.7.0
# via icecube-skyreader (setup.py)
12 changes: 6 additions & 6 deletions requirements.txt → dependencies.log
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements.txt
# pip-compile --output-file=dependencies.log
#
astropy==5.3.4
# via
Expand Down Expand Up @@ -30,7 +30,7 @@ matplotlib==3.8.0
# icecube-skyreader (setup.py)
meander==0.0.3
# via icecube-skyreader (setup.py)
numpy==1.26.0
numpy==1.26.1
# via
# astropy
# contourpy
Expand All @@ -46,9 +46,9 @@ packaging==23.2
# matplotlib
pandas==2.1.1
# via icecube-skyreader (setup.py)
pillow==10.0.1
pillow==10.1.0
# via matplotlib
pyerfa==2.0.0.3
pyerfa==2.0.1.1
# via astropy
pyparsing==3.1.1
# via matplotlib
Expand All @@ -70,7 +70,7 @@ typing-extensions==4.8.0
# via wipac-dev-tools
tzdata==2023.3
# via pandas
urllib3==2.0.6
urllib3==2.0.7
# via requests
wipac-dev-tools==1.7.0
# via icecube-skyreader (setup.py)
12 changes: 8 additions & 4 deletions examples/plot_skydriver_scan_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from rest_tools.client import RestClient, SavedDeviceGrantAuth
from skyreader import SkyScanResult
from skyreader.plot import SkyScanPlotter


def get_rest_client() -> RestClient:
Expand Down Expand Up @@ -36,11 +37,14 @@ def main() -> None:
args = parser.parse_args()

rc = get_rest_client()
serialzed = rc.request_seq("GET", f"/scan/{args.scan_id}/result")["skyscan_result"]
serialized = rc.request_seq("GET", f"/scan/{args.scan_id}/result")["skyscan_result"]

result = SkyScanResult.deserialize(serialzed)
result.create_plot()
result.create_plot_zoomed(plot_bounding_box=True)
plotter = SkyScanPlotter()

result = SkyScanResult.deserialize(serialized)

plotter.create_plot(result)
plotter.create_plot_zoomed(result, plot_bounding_box=True)


if __name__ == "__main__":
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ tests =
pytest-mock
examples =
wipac-rest-tools
mypy =
%(tests)s
%(examples)s

[options.package_data] # generated by wipac:cicd_setup_builder: '*'
* = py.typed
Expand Down
3 changes: 3 additions & 0 deletions skyreader/plot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .plot import SkyScanPlotter

__all__ = ["SkyScanPlotter"]
Loading

0 comments on commit dcb25a0

Please sign in to comment.