Skip to content

Commit

Permalink
MNT Added action for building docs and fixed deprecated methods (#34)
Browse files Browse the repository at this point in the history
* added action for updating doc and fixed deprecated methods

* fix pip

* bump up python version

* python version
  • Loading branch information
yuerout authored Aug 7, 2024
1 parent 1b5566e commit 5094a87
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 7 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
branch: gh-pages
folder: docs/build/html
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx_gallery.gen_gallery',
'sphinx_rtd_theme',
]
'sphinx_rtd_theme' ]


napoleon_use_ivar = True
autosummary_generate = True
numpydoc_class_members_toctree = True
numpydoc_show_class_members = True


# # Sphinx-gallery
sphinx_gallery_conf = {
# path to your examples scripts
Expand Down
49 changes: 49 additions & 0 deletions docs/source/sg_execution_times.rst
Original file line number Diff line number Diff line change
@@ -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

<style scoped>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
</style>
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<script type="text/javascript" class="init">
$(document).ready( function () {
$('table.sg-datatable').DataTable({order: [[1, 'desc']]});
} );
</script>

.. 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
2 changes: 1 addition & 1 deletion examples/introduction/demo_show_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions moten/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions moten/pyramids.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
__all__ = ['MotionEnergyPyramid',
'StimulusMotionEnergy',
'StimulusStaticGaborPyramid',
'DefaultPyramids',
]
'DefaultPyramids']

##############################
#
Expand All @@ -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
Expand Down

0 comments on commit 5094a87

Please sign in to comment.