diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml new file mode 100644 index 0000000..ab7e66e --- /dev/null +++ b/.github/workflows/build_docs.yml @@ -0,0 +1,52 @@ +name: Build docs + +on: + push: + branches: + - main + tags: + - '*' + pull_request: + branches: + - main + +jobs: + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y inkscape + sudo apt-get install -y ffmpeg + pip install --upgrade pip + pip install -q wheel numpy scipy Pillow==9.5.0 matplotlib opencv-python + pip install -q ipython Sphinx sphinx-gallery numpydoc sphinx-rtd-theme sphinx-bootstrap-theme + pip install -e . --no-build-isolation + python -c 'import moten; print(moten.__version__)' + + - name: Build documents + run: | + cd docs && make githubio-docs && cd .. + touch docs/build/html/.nojekyll + + - name: Publish to gh-pages if tagged + if: startsWith(github.ref, 'refs/tags') + uses: JamesIves/github-pages-deploy-action@v4.6.3 + with: + branch: gh-pages + folder: docs/build/html \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 5aea012..a85e9e3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -40,8 +40,7 @@ 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', 'sphinx_gallery.gen_gallery', - 'sphinx_rtd_theme', - ] + 'sphinx_rtd_theme' ] napoleon_use_ivar = True @@ -49,6 +48,7 @@ numpydoc_class_members_toctree = True numpydoc_show_class_members = True + # # Sphinx-gallery sphinx_gallery_conf = { # path to your examples scripts diff --git a/docs/source/sg_execution_times.rst b/docs/source/sg_execution_times.rst new file mode 100644 index 0000000..097d6c7 --- /dev/null +++ b/docs/source/sg_execution_times.rst @@ -0,0 +1,49 @@ + +:orphan: + +.. _sphx_glr_sg_execution_times: + + +Computation times +================= +**00:02.412** total execution time for 5 files **from all galleries**: + +.. container:: + + .. raw:: html + + + + + + + + .. list-table:: + :header-rows: 1 + :class: table table-striped sg-datatable + + * - Example + - Time + - Mem (MB) + * - :ref:`sphx_glr_auto_examples_introduction_demo_show_filters.py` (``../../examples/introduction/demo_show_filters.py``) + - 00:02.412 + - 0.0 + * - :ref:`sphx_glr_auto_examples_introduction_demo_batching.py` (``../../examples/introduction/demo_batching.py``) + - 00:00.000 + - 0.0 + * - :ref:`sphx_glr_auto_examples_introduction_demo_example.py` (``../../examples/introduction/demo_example.py``) + - 00:00.000 + - 0.0 + * - :ref:`sphx_glr_auto_examples_introduction_demo_gabor_filters.py` (``../../examples/introduction/demo_gabor_filters.py``) + - 00:00.000 + - 0.0 + * - :ref:`sphx_glr_auto_examples_introduction_demo_image_coordinates.py` (``../../examples/introduction/demo_image_coordinates.py``) + - 00:00.000 + - 0.0 diff --git a/examples/introduction/demo_show_filters.py b/examples/introduction/demo_show_filters.py index 2fb868d..b8ae855 100644 --- a/examples/introduction/demo_show_filters.py +++ b/examples/introduction/demo_show_filters.py @@ -28,7 +28,7 @@ # %% # (*Ignore this code block. It is needed to display the animation as a video on this website*) -output = '../../docs/build/html/_downloads/example_moten_filter.mp4' +output = '../../docs/build/html/_downloads/example_moten_filter.gif' fig = animation._fig title = 'Example filter:\ndirection of motion=180, spatial fq=16cpi, temporal fq=4Hz' fig.suptitle(title) diff --git a/moten/core.py b/moten/core.py index ffab0e6..c6b5f52 100644 --- a/moten/core.py +++ b/moten/core.py @@ -51,7 +51,7 @@ def raw_project_stimulus(stimulus, # checks for 2D stimuli assert stimulus.ndim == 2 # (nimages, pixels) assert isinstance(vhsize, tuple) and len(vhsize) == 2 # (hdim, vdim) - assert np.prod(vhsize) == stimulus.shape[1] # hdim*vdim == pixels + assert np.prod(vhsize) == stimulus.shape[1] # hdim*vdim == pixels # Compute responses nfilters = len(filters) @@ -103,7 +103,7 @@ def project_stimulus(stimulus, # checks for 2D stimuli assert stimulus.ndim == 2 # (nimages, pixels) assert isinstance(vhsize, tuple) and len(vhsize) == 2 # (hdim, vdim) - assert np.prod(vhsize) == stimulus.shape[1] # hdim*vdim == pixels + assert np.prod(vhsize) == stimulus.shape[1] # hdim*vdim == pixels # Compute responses nfilters = len(filters) diff --git a/moten/pyramids.py b/moten/pyramids.py index 5bd84c1..0e86984 100644 --- a/moten/pyramids.py +++ b/moten/pyramids.py @@ -26,8 +26,7 @@ __all__ = ['MotionEnergyPyramid', 'StimulusMotionEnergy', 'StimulusStaticGaborPyramid', - 'DefaultPyramids', - ] + 'DefaultPyramids'] ############################## # @@ -42,6 +41,7 @@ class MotionEnergyPyramid(object): are constructed and each is centered at different locations in the image in order to tile the stimulus. + Parameters ---------- stimulus_vhsize : tuple of ints