Skip to content

Commit

Permalink
Merge pull request #17 from MerlinDumeur/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
MerlinDumeur committed Jul 6, 2023
2 parents 183c10e + 671d5a7 commit 1b8be02
Show file tree
Hide file tree
Showing 44 changed files with 6,388 additions and 751 deletions.
Binary file modified .coverage
Binary file not shown.
84 changes: 78 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
needs: linter-check
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.8"]
Expand All @@ -54,17 +54,89 @@ jobs:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('etc/example-environment.yml') }}
hashFiles('env.yml') }}
- name: Setup python ${{ matrix.python-version }} with conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: env.yml
environment-file: meta.yml
use-only-tar-bz2: true
- name: Testing
run: |
conda install -c conda-forge pytest pytest-xdist
pip uninstall pymultifracs
conda install -c conda-forge pytest pytest-xdist pytest-cov
pip install -e .
pytest -n auto -x
pytest -n auto -x --cov=./ --cov-report=xml
build-docs:
if: github.repository == 'neurospin/pymultifracs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
doc-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('meta.yml') }}
- name: Setup python with conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.11
environment-file: meta.yml
use-only-tar-bz2: true
- name: Build doc
run: |
conda install -c conda-forge sphinx numpydoc pydata-sphinx-theme
pip install -e .
cd doc
make html
upload-docs:
if: github.repository == 'neurospin/pymultifracs'
runs-on: ubuntu-latest
needs: [build-docs]
steps:
- name: Archive artifact
shell: sh
if: runner.os == 'Linux'
run: |
tar \
--dereference --hard-dereference \
--directory doc/_build/ \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
.
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: github-pages
path: ${{ runner.temp }}/artifact.tar
retention-days: 1
if-no-files-found: error

deploy-docs:
needs: upload-docs

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected] # or the latest "vX.X.X" version tag for this action

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Compiled python modules.
*.pyc
*.so
*.c
pymultifracs/*.html

# Setuptools distribution folder.
python_code/pymultifracs/dist/
Expand Down Expand Up @@ -42,3 +45,7 @@ pymultifracs/todo.txt
notebooks/Dev*.ipynb
coverage.xml
notebooks/figures

examples/*.html
data/
examples/*.mat
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. -*- mode: rst -*-
|Codecov|_ |Binder|_ |CircleCI|_
|Codecov|_ |Binder|_

.. |Codecov| image:: https://codecov.io/gh/neurospin/pymultifracs/branch/master/graph/badge.svg
.. _Codecov: https://codecov.io/gh/neurospin/pymultifracs
Expand Down
11 changes: 0 additions & 11 deletions doc/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,3 @@
.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

.. rubric:: Methods
.. autosummary::

{% for item in methods %}
{%- if item not in ["__init__"] and item[0] != '_'%}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

.. include:: {{fullname}}.examples
9 changes: 1 addition & 8 deletions doc/_templates/autosummary/function.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{{ fullname }}
{{ underline }}
{{ fullname | escape | underline }}

.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}

.. include:: {{ fullname }}.examples

.. raw:: html

<div style='clear:both'></div>
83 changes: 52 additions & 31 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,30 @@
# -- Project information -----------------------------------------------------

project = 'PyMultiFracs'
copyright = '2020-2021, M. Dumeur, P. Ciuciu, V. van Wassenhove, P. Abry'
copyright = '2020-2023, M. Dumeur, P. Ciuciu, V. van Wassenhove, P. Abry'
author = 'M. Dumeur, P. Ciuciu, V. van Wassenhove, P. Abry'

# The full version, including alpha/beta/rc tags
release = '1.0'
release = '0.2'


# -- General configuration ---------------------------------------------------

needs_sphinx = "2.0"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.intersphinx',
# 'sphinx.ext.linkcode',
'numpydoc',
'sphinx_autodoc_typehints',
# 'sphinx_autodoc_typehints',
# 'sphinx_gallery.notebook',
'sphinx_bootstrap_theme',
'nbsphinx',
# 'sphinx_bootstrap_theme',
# 'nbsphinx',
'sphinx.ext.mathjax']

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -60,32 +63,47 @@
#
# html_theme = 'alabaster'

html_theme = 'bootstrap'
html_theme = 'pydata_sphinx_theme'

html_theme_options = {
'navbar_title': 'PyMultiFracs', # we replace this with an image
'source_link_position': "nav", # default
'bootswatch_theme': "flatly", # yeti paper lumen
'navbar_sidebarrel': False, # Render the next/prev links in navbar?
'navbar_pagenav': False,
'navbar_class': "navbar",
'bootstrap_version': "3", # default
# 'navbar_site_name': '',
'navbar_links': [
# ("Install", "install"),
# ("Tutorials", "auto_tutorials/index"),
("Examples", "examples"),
# ("Glossary", "glossary"),
("API", "reference"),
("Theory", 'theory')
# ("Contribute", "install/contributing"),
"icon_links": [
dict(
name="GitHub",
url="https://github.com/neurospin/pymultifracs/",
icon="fa-brands fa-square-github",
),
],
"icon_links_label": "External Links", # for screen reader
"use_edit_page_button": False,
"navigation_with_keys": False,
"show_toc_level": 1,
"article_header_start": [], # disable breadcrumbs
# "navbar_end": ["theme-switcher", "navbar-icon-links"],
"footer_start": ["copyright"],
"secondary_sidebar_items": ["page-toc"],
}

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = "_static/.svg"

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = "_static/favicon.ico"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
# html_css_files = [
# "style.css",
# ]

# Custom sidebar templates, maps document names to template names.
# html_sidebars = {
# "index": ["sidebar-quicklinks.html"],
# }

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
Expand All @@ -95,22 +113,25 @@
html_show_sphinx = False


def setup(app):
app.add_stylesheet("style.css") # also can be a full URL
app.add_stylesheet("font-awesome.css")
app.add_stylesheet("font-source-code-pro.css")
app.add_stylesheet("font-source-sans-pro.css")
# def setup(app):
# app.add_stylesheet("style.css") # also can be a full URL
# app.add_stylesheet("font-awesome.css")
# app.add_stylesheet("font-source-code-pro.css")
# app.add_stylesheet("font-source-sans-pro.css")


intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/devdocs', None),
'scipy': ('https://scipy.github.io/devdocs', None),
'matplotlib': ('https://matplotlib.org', None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
"matplotlib": ("https://matplotlib.org/stable", None),
'sklearn': ('https://scikit-learn.org/stable', None),
'joblib': ('https://joblib.readthedocs.io/en/latest', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None),
'seaborn': ('https://seaborn.pydata.org/', None),
# "numba": ("https://numba.readthedocs.io/en/latest", None),
# "joblib": ("https://joblib.readthedocs.io/en/latest", None),
# "statsmodels": ("https://www.statsmodels.org/dev", None),
}

# numpydoc
Expand Down
17 changes: 17 additions & 0 deletions doc/docenv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pymultifracs-doc
channels:
- conda-forge
dependencies:
- python>=3.7
- numpy>=1.17.3
- scipy>=1.3.1
- pywavelets>=1.1.1
- seaborn>=0.9.0
- scikit-learn>=0.21.34
- statsmodels
- sphinx
- numpydoc
- pydata-sphinx-theme
- pip
- pip:
- recombinator
File renamed without changes.
1 change: 0 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ Contents

reference
theory

36 changes: 22 additions & 14 deletions doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ Multifractal Analysis
:toctree: _autosummary

mf_analysis
mf_analysis_full
minimal_mf_analysis

Classes gathering the output of multifractal analysis

.. autosummary::
:toctree: _autosummary
:template: namedtuple.rst

MFractalData
MFractalVar

Dataclasses
```````````
Expand All @@ -40,6 +29,13 @@ Used to compute and store intermediary results
structurefunction.StructureFunction
mfspectrum.MultifractalSpectrum

Storing the multifractal analysis output

.. autosummary::
:toctree: _autosummary

utils.MFractalVar

Wavelet Analysis
----------------

Expand All @@ -55,7 +51,6 @@ Wavelet Analysis

.. autosummary::
:toctree: _autosummary
:template: namedtuple.rst

WaveletTransform

Expand Down Expand Up @@ -90,6 +85,19 @@ Computing and Plotting PSDs

.. autosummary::
:toctree: _autosummary
:template: namedtuple.rst

PSD
PSD


Utility functions
-----------------

.. currentmodule:: pymultifracs.utils

:py:mod:`pymultifracs.utils`:

.. autosummary::
:toctree: _autosummary

scale2freq
freq2scale
Loading

0 comments on commit 1b8be02

Please sign in to comment.