From df373abdef57964ed038a0a0c318d613318b233d Mon Sep 17 00:00:00 2001 From: Matthew Townson Date: Thu, 29 Jun 2023 10:24:00 +0100 Subject: [PATCH 1/5] Unit typos in atmos_conversions.py Fix the errors in _r0_to_cn2_ and r0_to_seeing as described in #88 --- aotools/turbulence/atmos_conversions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aotools/turbulence/atmos_conversions.py b/aotools/turbulence/atmos_conversions.py index 17a127b..06a95b5 100644 --- a/aotools/turbulence/atmos_conversions.py +++ b/aotools/turbulence/atmos_conversions.py @@ -61,7 +61,7 @@ def r0_to_cn2(r0, lamda=500.E-9): Calculates integrated Cn2 value from r0 Parameters: - r0 (float): r0 in cm + r0 (float): r0 in m lamda : wavelength Returns: @@ -76,7 +76,7 @@ def r0_to_seeing(r0, lamda=500.E-9): Calculates the seeing angle from r0 Parameters: - r0 (float): Freid's parameter in cm + r0 (float): Freid's parameter in m lamda : wavelength Returns: From bad13fe9295ac12e23ca941c1d24410e3315033f Mon Sep 17 00:00:00 2001 From: Matthew Townson Date: Mon, 4 Sep 2023 11:34:59 +0100 Subject: [PATCH 2/5] add action to build docs with sphinx add master branch to building docs template --- .github/workflows/documentation.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..ef01ce3 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,24 @@ +name: Docs +on: [push, pull_request, workflow_dispatch] +permissions: + contents: write +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - name: Install dependencies + run: | + pip install sphinx sphinx_rtd_theme mock + - name: Sphinx build + run: | + sphinx-build doc/source _build + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main/master' }} + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: _build/ + force_orphan: true \ No newline at end of file From b7c4ac4e1c851365077d20b7be9ae4893db2792e Mon Sep 17 00:00:00 2001 From: Matthew Townson Date: Mon, 4 Sep 2023 11:53:54 +0100 Subject: [PATCH 3/5] testing removing criteria for deploy --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ef01ce3..ba90c0c 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: sphinx-build doc/source _build - name: Deploy uses: peaceiris/actions-gh-pages@v3 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main/master' }} + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main/master' }} with: publish_branch: gh-pages github_token: ${{ secrets.GITHUB_TOKEN }} From e3aa5a4d4b13ac7ef5f60c8a63d1ce0db3bc54e8 Mon Sep 17 00:00:00 2001 From: Matthew Townson Date: Mon, 4 Sep 2023 14:47:56 +0100 Subject: [PATCH 4/5] remove master branch from doc build action --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ba90c0c..ee89d54 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: sphinx-build doc/source _build - name: Deploy uses: peaceiris/actions-gh-pages@v3 - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main/master' }} + # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: publish_branch: gh-pages github_token: ${{ secrets.GITHUB_TOKEN }} From 0aef577a7fe8903ff0b011306832aa44327c524b Mon Sep 17 00:00:00 2001 From: matthewtownson Date: Tue, 17 Sep 2024 15:48:48 +0100 Subject: [PATCH 5/5] fix issue using numpy factorial and remove abandoned nose test. --- aotools/functions/zernike.py | 9 +++++---- test/test_centroiders.py | 11 +++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/aotools/functions/zernike.py b/aotools/functions/zernike.py index 0eba058..719fafa 100644 --- a/aotools/functions/zernike.py +++ b/aotools/functions/zernike.py @@ -1,4 +1,5 @@ import numpy +import math from . import circle def phaseFromZernikes(zCoeffs, size, norm="noll", rot=0): @@ -88,10 +89,10 @@ def zernikeRadialFunc(n, m, r): for i in range(0, int((n - m) / 2) + 1): R += numpy.array(r**(n - 2 * i) * (((-1)**(i)) * - numpy.math.factorial(n - i)) / - (numpy.math.factorial(i) * - numpy.math.factorial(int(0.5 * (n + m) - i)) * - numpy.math.factorial(int(0.5 * (n - m) - i))), + math.factorial(n - i)) / + (math.factorial(i) * + math.factorial(int(0.5 * (n + m) - i)) * + math.factorial(int(0.5 * (n - m) - i))), dtype='float') return R diff --git a/test/test_centroiders.py b/test/test_centroiders.py index 8b066f6..a8fb3ab 100644 --- a/test/test_centroiders.py +++ b/test/test_centroiders.py @@ -1,5 +1,6 @@ from aotools import image_processing import numpy +# from nose.tools import raises def test_centre_of_gravity_single(): @@ -66,3 +67,13 @@ def test_correlation_many(): com = image_processing.correlation_centroid(im, ref, 0.3) assert (com.shape[0] == 2) assert(com.shape[1] == 5) + + +# @raises(ValueError) +# def test_correlation_error(): +# im = numpy.random.random((10)) +# ref = numpy.random.random((10, 10)) +# com = image_processing.correlation_centroid(im, ref, threshold=0.3) + + +