Skip to content

Commit

Permalink
added flake with 100 size
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedNasser8 committed Jun 5, 2024
1 parent 29a406a commit 9af85ce
Show file tree
Hide file tree
Showing 18 changed files with 222 additions and 121 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 100
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
/.venv
dist
23 changes: 18 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@ repos:
- id: end-of-file-fixer
- id: check-yaml

# - repo: https://github.com/pycqa/flake8
# rev: 6.0.0
# hooks:
# - id: flake8
# args: [ '--max-line-length=70' ]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [ '--max-line-length=100' ]


- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [--line-length=70]

- repo: https://github.com/PyCQA/docformatter
rev: v1.4
hooks:
- id: docformatter
args: [--in-place, --recursive, --blank, --force-wrap, --wrap-summaries=100,--wrap-descriptions=100]

- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.7
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive, --recursive, --max-line-length=100]
15 changes: 8 additions & 7 deletions docs/examples/aif/plot_aif_parker.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""
======================================
The Parker AIF - a play with variables
======================================
"""======================================
The Parker AIF - a play with variables ====================================== Simulating a Parker
AIF with different settings.
Simulating a Parker AIF with different settings.
"""

import matplotlib.pyplot as plt
Expand All @@ -17,7 +16,8 @@
# %%
# Generate synthetic AIF with default settings and plot the result.

# Define time points in units of seconds - in this case we use a time resolution of 0.5 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 0.5 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 0.5)

# Create an AIF with default settings
Expand All @@ -31,7 +31,8 @@
plt.show()

# %%
# The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s:
# The bolus arrival time (BAT) defaults to 0s. What happens if we
# change it? Let's try, by changing it in steps of 30s:

ca = osipi.aif_parker(t, BAT=0)
plt.plot(t, ca, "b-", label="BAT = 0s")
Expand Down
6 changes: 4 additions & 2 deletions docs/examples/aif/plot_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# %%
# Generate synthetic AIF with default settings and plot the result.

# Define time points in units of seconds - in this case we use a time resolution of 0.5 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 0.5 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 0.5)

# Create an AIF with default settings
Expand All @@ -31,7 +32,8 @@
plt.show()

# %%
# The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let's try, by changing it in steps of 30s:
# The bolus arrival time (BAT) defaults to 30s. What happens if we
# change it? Let's try, by changing it in steps of 30s:

ca = osipi.aif_parker(t, BAT=0)
plt.plot(t, ca, "b-", label="BAT = 0s")
Expand Down
9 changes: 6 additions & 3 deletions docs/examples/tissue/plot_extended_tofts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
# %%
# Generate Parker AIF with default settings.

# Define time points in units of seconds - in this case we use a time resolution of 1 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 1 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 1)

# Create an AIF with default settings
ca = osipi.aif_parker(t)

# %%
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6
# Plot the tissue concentrations for an extracellular volume fraction
# of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6
Ktrans = 0.2 # in units of 1/min
ve = 0.2 # volume fraction between 0 and 1
vp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1
Expand All @@ -40,7 +42,8 @@
plt.show()

# %%
# Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05
# Comparing different discretization methods for an extracellular
# volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05
ct = osipi.extended_tofts(
t, ca, Ktrans, ve, vp[0]
) # Defaults to Convolution
Expand Down
10 changes: 7 additions & 3 deletions docs/examples/tissue/plot_tofts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
# %%
# Generate Parker AIF with default settings.

# Define time points in units of seconds - in this case we use a time resolution of 1 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 1 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 1)

# Create an AIF with default settings
ca = osipi.aif_parker(t)

# %%
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different transfer rate constants of 0.05, 0.2 and 0.6 /min
# Plot the tissue concentrations for an extracellular volume fraction
# of 0.2 and 3 different transfer rate constants of 0.05, 0.2 and 0.6
# /min
Ktrans = [0.05, 0.2, 0.6] # in units of 1/min
ve = 0.2 # volume fraction between 0 and 1
ct = osipi.tofts(t, ca, Ktrans=Ktrans[0], ve=ve)
Expand All @@ -39,7 +42,8 @@
plt.show()

# %%
# Comparing different discretization methods for an extracellular volume fraction of 0.2 and Ktrans of 0.2 /min
# Comparing different discretization methods for an extracellular
# volume fraction of 0.2 and Ktrans of 0.2 /min
ct = osipi.tofts(
t, ca, Ktrans=Ktrans[1], ve=ve
) # Defaults to Convolution
Expand Down
44 changes: 29 additions & 15 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import os

# -- Project information -----------------------------------------------------
# -- Project information ---------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import sys

Expand All @@ -14,24 +14,28 @@
author = "OSIPI"
release = "0.1.1"

# -- Path setup --------------------------------------------------------------
# -- Path setup ------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here
# documentation root, use os.path.abspath to make it absolute, like
# shown here

sys.path.insert(0, os.path.abspath("../../src"))

# -- General configuration ---------------------------------------------------
# -- General configuration -------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones
extensions = [
"sphinx.ext.napoleon", # parsing of NumPy and Google style docstrings
"sphinx.ext.autodoc", # sphinx autodocumentation generation
"sphinx.ext.autosummary", # generates function/method/attribute summary lists
# generates function/method/attribute summary lists
"sphinx.ext.autosummary",
"sphinx.ext.viewcode", # viewing source code
# generate links to the documentation of objects in external projects
# generate links to the documentation of objects in external
# projects
"sphinx.ext.intersphinx",
"autodocsumm",
"myst_parser", # parser for markdown language
Expand Down Expand Up @@ -61,19 +65,23 @@
"download_all_examples": False,
}

# This way a link to other methods, classes, or modules can be made with back ticks so that you don't have to use qualifiers like :class:, :func:, :meth: and the likes
# This way a link to other methods, classes, or modules can be made
# with back ticks so that you don't have to use qualifiers like
# :class:, :func:, :meth: and the likes
default_role = "obj"

# Add any paths that contain templates here, relative to this directory
# Add any paths that contain templates here, relative to this
# directory
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path
exclude_patterns = []

# -- Extension configuration -------------------------------------------------
# Map intersphinx to pre-exisiting documentation from other projects used in this project
# -- Extension configuration -----------------------------------------
# Map intersphinx to pre-exisiting documentation from other projects
# used in this project
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
Expand All @@ -86,16 +94,19 @@

autosummary_generate = True # enable autosummary extension

# Tell sphinx-autodoc-typehints to generate stub parameter annotations including types, even if the parameters aren't explicitly documented.
# Tell sphinx-autodoc-typehints to generate stub parameter annotations
# including types, even if the parameters aren't explicitly
# documented.
always_document_param_types = True

# Remove auto-generated API docs from sidebars.
remove_from_toctrees = ["_autosummary/*"]

# -- Options for HTML output -------------------------------------------------
# -- Options for HTML output -----------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# The theme to use for HTML and HTML Help pages. See the documentation for a list of builtin themes
# The theme to use for HTML and HTML Help pages. See the
# documentation for a list of builtin themes
html_theme = "pydata_sphinx_theme"

html_theme_options = {
Expand All @@ -111,7 +122,10 @@
"doc_path": "docs/source",
}

# 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"
# 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"]

# The suffix(es) of source filenames.
Expand Down
15 changes: 8 additions & 7 deletions docs/source/generated/examples/aif/plot_aif_parker.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""
======================================
The Parker AIF - a play with variables
======================================
"""======================================
The Parker AIF - a play with variables ====================================== Simulating a Parker
AIF with different settings.
Simulating a Parker AIF with different settings.
"""

import matplotlib.pyplot as plt
Expand All @@ -17,7 +16,8 @@
# %%
# Generate synthetic AIF with default settings and plot the result.

# Define time points in units of seconds - in this case we use a time resolution of 0.5 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 0.5 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 0.5)

# Create an AIF with default settings
Expand All @@ -31,7 +31,8 @@
plt.show()

# %%
# The bolus arrival time (BAT) defaults to 0s. What happens if we change it? Let's try, by changing it in steps of 30s:
# The bolus arrival time (BAT) defaults to 0s. What happens if we
# change it? Let's try, by changing it in steps of 30s:

ca = osipi.aif_parker(t, BAT=0)
plt.plot(t, ca, "b-", label="BAT = 0s")
Expand Down
6 changes: 4 additions & 2 deletions docs/source/generated/examples/aif/plot_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# %%
# Generate synthetic AIF with default settings and plot the result.

# Define time points in units of seconds - in this case we use a time resolution of 0.5 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 0.5 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 0.5)

# Create an AIF with default settings
Expand All @@ -31,7 +32,8 @@
plt.show()

# %%
# The bolus arrival time (BAT) defaults to 30s. What happens if we change it? Let's try, by changing it in steps of 30s:
# The bolus arrival time (BAT) defaults to 30s. What happens if we
# change it? Let's try, by changing it in steps of 30s:

ca = osipi.aif_parker(t, BAT=0)
plt.plot(t, ca, "b-", label="BAT = 0s")
Expand Down
9 changes: 6 additions & 3 deletions docs/source/generated/examples/tissue/plot_extended_tofts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
# %%
# Generate Parker AIF with default settings.

# Define time points in units of seconds - in this case we use a time resolution of 1 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 1 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 1)

# Create an AIF with default settings
ca = osipi.aif_parker(t)

# %%
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6
# Plot the tissue concentrations for an extracellular volume fraction
# of 0.2 and 3 different plasma volumes of 0.05, 0.2 and 0.6
Ktrans = 0.2 # in units of 1/min
ve = 0.2 # volume fraction between 0 and 1
vp = [0.05, 0.2, 0.6] # volume fraction between 0 and 1
Expand All @@ -40,7 +42,8 @@
plt.show()

# %%
# Comparing different discretization methods for an extracellular volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05
# Comparing different discretization methods for an extracellular
# volume fraction of 0.2, Ktrans of 0.2 /min and vp of 0.05
ct = osipi.extended_tofts(
t, ca, Ktrans, ve, vp[0]
) # Defaults to Convolution
Expand Down
10 changes: 7 additions & 3 deletions docs/source/generated/examples/tissue/plot_tofts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
# %%
# Generate Parker AIF with default settings.

# Define time points in units of seconds - in this case we use a time resolution of 1 sec and a total duration of 6 minutes.
# Define time points in units of seconds - in this case we use a time
# resolution of 1 sec and a total duration of 6 minutes.
t = np.arange(0, 6 * 60, 1)

# Create an AIF with default settings
ca = osipi.aif_parker(t)

# %%
# Plot the tissue concentrations for an extracellular volume fraction of 0.2 and 3 different transfer rate constants of 0.05, 0.2 and 0.6 /min
# Plot the tissue concentrations for an extracellular volume fraction
# of 0.2 and 3 different transfer rate constants of 0.05, 0.2 and 0.6
# /min
Ktrans = [0.05, 0.2, 0.6] # in units of 1/min
ve = 0.2 # volume fraction between 0 and 1
ct = osipi.tofts(t, ca, Ktrans=Ktrans[0], ve=ve)
Expand All @@ -39,7 +42,8 @@
plt.show()

# %%
# Comparing different discretization methods for an extracellular volume fraction of 0.2 and Ktrans of 0.2 /min
# Comparing different discretization methods for an extracellular
# volume fraction of 0.2 and Ktrans of 0.2 /min
ct = osipi.tofts(
t, ca, Ktrans=Ktrans[1], ve=ve
) # Defaults to Convolution
Expand Down
Loading

0 comments on commit 9af85ce

Please sign in to comment.