Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factorial fix #99

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -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' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
9 changes: 5 additions & 4 deletions aotools/functions/zernike.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy
import math
from . import circle

def phaseFromZernikes(zCoeffs, size, norm="noll", rot=0):
Expand Down Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions test/test_centroiders.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from aotools import image_processing
import numpy
# from nose.tools import raises


def test_centre_of_gravity_single():
Expand Down Expand Up @@ -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)



Loading