Skip to content

Commit 97cea0d

Browse files
authored
Merge pull request #21 from CardiacModelling/docs
Added documentation, tests, and more
2 parents 562ed6a + 41b8d35 commit 97cea0d

16 files changed

Lines changed: 579 additions & 150 deletions

File tree

.flake8

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ ignore =
99
W504,
1010
# missing whitespace around arithmetic operator
1111
E226,
12-
# Import sorting
13-
I201
14-
I100
1512

1613
exclude=
1714
.git,
15+
.github,
16+
.venv,
1817
venv,
18+
tests/test_data,

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![codecov](https://codecov.io/gh/CardiacModelling/syncropatch_export/graph/badge.svg?token=HOL0FrpGqs)](https://codecov.io/gh/CardiacModelling/syncropatch_export)
33

44
This repository contains a python package and scripts for processing data outputted from Nanion SynroPatch 384.
5+
56
With this package you can export each sweep of each protocol for each well as individual files (.csv).
67
Meta-data describing the protocol, and variables such as membrance capacitance (Cm), Rseries and Rseal can be exported.
78

@@ -41,3 +42,39 @@ Then you can run the tests.
4142
```
4243
python3 -m unittest
4344
```
45+
46+
## Usage example
47+
48+
...TODO
49+
50+
51+
## Development
52+
53+
Commits should be merged in via pull requests.
54+
55+
Tests are written using the standard [unittest](https://docs.python.org/3.13/library/unittest.html) framework.
56+
57+
Online testing, style-checking, and coverage testing is set up using GitHub actions.
58+
Coverage testing is handled via [Codecov](https://about.codecov.io/).
59+
60+
Style testing is done with `flake8`. For example, to test with 4 subprocesses use
61+
```
62+
flake8 -j4
63+
```
64+
Import sorting can be checked with `isort`:
65+
```
66+
isort --verbose --check-only --diff syncropatch_export tests setup.py
67+
```
68+
69+
Documentation is implemented using [Sphinx](https://www.sphinx-doc.org/).
70+
To compile locally, first install the required dependencies
71+
```
72+
pip install -e .'[docs]'
73+
```
74+
and then use Make
75+
```
76+
cd docs
77+
make html
78+
```
79+
80+

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/*

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = syncropatch_export
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
set SPHINXPROJ=syncropatch_export
13+
14+
if "%1" == "" goto help
15+
16+
%SPHINXBUILD% >NUL 2>NUL
17+
if errorlevel 9009 (
18+
echo.
19+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20+
echo.installed, then set the SPHINXBUILD environment variable to point
21+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
22+
echo.may add the Sphinx directory to PATH.
23+
echo.
24+
echo.If you don't have Sphinx installed, grab it from
25+
echo.http://sphinx-doc.org/
26+
exit /b 1
27+
)
28+
29+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30+
goto end
31+
32+
:help
33+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34+
35+
:end
36+
popd

docs/source/_static/placeholder

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Images etc. can be placed here

docs/source/conf.py

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This file is execfile()d with the current directory set to its
4+
# containing dir.
5+
#
6+
# Note that not all possible configuration values are present in this
7+
# autogenerated file.
8+
#
9+
# All configuration values have a default; values that are commented out
10+
# serve to show the default.
11+
12+
# If extensions (or modules to document with autodoc) are in another directory,
13+
# add these directories to sys.path here. If the directory is relative to the
14+
# documentation root, use os.path.abspath to make it absolute, like shown here.
15+
#
16+
import syncropatch_export
17+
18+
19+
# -- General configuration ----------------------------------------------------
20+
21+
# If your documentation needs a minimal Sphinx version, state it here.
22+
# needs_sphinx = '1.0'
23+
24+
# Add any Sphinx extension module names here, as strings. They can be
25+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
26+
extensions = [
27+
'sphinx.ext.autodoc',
28+
'sphinx.ext.doctest',
29+
'sphinx.ext.mathjax',
30+
'sphinx.ext.napoleon',
31+
]
32+
33+
# Autodoc defaults
34+
autodoc_default_options = {
35+
'members': None,
36+
# 'inherited-members': None,
37+
}
38+
39+
# Add any paths that contain templates here, relative to this directory.
40+
templates_path = ['_templates']
41+
42+
# The suffix(es) of source filenames.
43+
# You can specify multiple suffix as a list of string:
44+
#
45+
# source_suffix = ['.rst', '.md']
46+
source_suffix = '.rst'
47+
48+
# The master toctree document.
49+
master_doc = 'index'
50+
51+
# General information about the project.
52+
project = u'Syncropatch export'
53+
# copyright = syncropatch_export.COPYRIGHT
54+
55+
# The version info for the project you're documenting, acts as replacement for
56+
# |version| and |release|, also used in various other places throughout the
57+
# built documents.
58+
#
59+
# The short X.Y version.
60+
version = syncropatch_export.__version__
61+
# The full version, including alpha/beta/rc tags.
62+
release = syncropatch_export.__version__
63+
64+
# The language for content autogenerated by Sphinx. Refer to documentation
65+
# for a list of supported languages.
66+
#
67+
# This is also used if you do content translation via gettext catalogs.
68+
# Usually you set "language" from the command line for these cases.
69+
language = 'en'
70+
71+
# List of patterns, relative to source directory, that match files and
72+
# directories to ignore when looking for source files.
73+
# This patterns also effect to html_static_path and html_extra_path
74+
exclude_patterns = []
75+
76+
# The name of the Pygments (syntax highlighting) style to use.
77+
pygments_style = 'default'
78+
79+
# If true, `todo` and `todoList` produce output, else they produce nothing.
80+
todo_include_todos = False
81+
82+
83+
# -- Options for HTML output ----------------------------------------------
84+
85+
# The theme to use for HTML and HTML Help pages. See the documentation for
86+
# a list of builtin themes.
87+
html_theme = 'alabaster'
88+
89+
# Theme options are theme-specific and customize the look and feel of a theme
90+
# further. For a list of options available for each theme, see the
91+
# documentation.
92+
# html_theme_options = {}
93+
94+
# Add any paths that contain custom static files (such as style sheets) here,
95+
# relative to this directory. They are copied after the builtin static files,
96+
# so a file named "default.css" will overwrite the builtin "default.css".
97+
html_static_path = ['_static']
98+
99+
# Add any paths that contain custom themes here, relative to this directory.
100+
html_theme_path = ['_templates']
101+
102+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
103+
html_show_sphinx = False
104+
105+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
106+
html_show_copyright = False
107+
108+
109+
# -- Options for HTMLHelp output ------------------------------------------
110+
111+
# Output file base name for HTML help builder.
112+
htmlhelp_basename = 'SyncropatchExpertDoc'
113+
114+
115+
# -- Options for LaTeX output ---------------------------------------------
116+
117+
latex_elements = {
118+
# The paper size ('letterpaper' or 'a4paper').
119+
#
120+
# 'papersize': 'letterpaper',
121+
122+
# The font size ('10pt', '11pt' or '12pt').
123+
#
124+
# 'pointsize': '10pt',
125+
126+
# Additional stuff for the LaTeX preamble.
127+
#
128+
# 'preamble': '',
129+
130+
# Latex figure (float) alignment
131+
#
132+
# 'figure_align': 'htbp',
133+
}
134+
135+
# Grouping the document tree into LaTeX files. List of tuples
136+
# (source start file, target name, title, author, documentclass[howto/manual]).
137+
latex_documents = [(
138+
'index', 'syncropatch_export.tex', u'Syncropatch Export Documentation',
139+
u'Mixed', 'manual'
140+
)]
141+
142+
143+
# -- Options for manual page output ---------------------------------------
144+
145+
# One entry per manual page. List of tuples
146+
# (source start file, name, description, authors, manual section).
147+
man_pages = [(
148+
'index', 'syncropatch_export', u'Syncropatch Export Documentation',
149+
[u'Syncropatch Export Team'], 1
150+
)]
151+
152+
# -- Options for Texinfo output -------------------------------------------
153+
154+
# Grouping the document tree into Texinfo files. List of tuples
155+
# (source start file, target name, title, author,
156+
# dir menu entry, description, category)
157+
texinfo_documents = [
158+
(master_doc, 'syncropatch_export', u'Syncropatch Export Documentation',
159+
'Syncropatch Export Team', 'Syncropatch Export',
160+
'Exports Nanion Syncropatch data to CSV.',
161+
'Miscellaneous'),
162+
]
163+

docs/source/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*****************
2+
Table of contents
3+
*****************
4+
5+
.. module:: syncropatch_export
6+
7+
This module contains methods to export data from the Nanion SynroPatch 384.
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
12+
self
13+
trace
14+
voltage_protocols
15+

docs/source/trace.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. currentmodule:: syncropatch_export.trace
2+
3+
**************
4+
Accessing data
5+
**************
6+
7+
Data is accessed and exported via the :class:`Trace` class.
8+
9+
.. autoclass:: Trace
10+

docs/source/voltage_protocols.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. currentmodule:: syncropatch_export.voltage_protocols
2+
3+
***************************
4+
Accessing voltage protocols
5+
***************************
6+
7+
Voltage protocols can be parsed from the JSON data using the
8+
:class:`VoltageProtocol` class.
9+
10+
.. autoclass:: VoltageProtocol
11+

0 commit comments

Comments
 (0)