Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed Dec 29, 2023
1 parent 4224e9a commit 121ea03
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 36 deletions.
3 changes: 1 addition & 2 deletions affogato_comparison.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import pytest

import mwatershed

Expand All @@ -22,4 +21,4 @@
components = compute_mws_segmentation_from_affinities(affinities, offsets, 0)
t4 = time.time()

print(f"AFFOGATO: {len(np.unique(components))} components in {t4-t3} seconds")
print(f"AFFOGATO: {len(np.unique(components))} components in {t4-t3} seconds")
64 changes: 31 additions & 33 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))

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

import mwatershed

Expand All @@ -32,24 +33,24 @@

# 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.viewcode']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u"""mwatershed"""
copyright = u"""2023, William Hunter Patton"""
author = u"""William Hunter Patton"""
project = """mwatershed"""
copyright = """2023, William Hunter Patton"""
author = """William Hunter Patton"""

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
Expand All @@ -70,10 +71,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -84,7 +85,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
Expand All @@ -95,13 +96,13 @@
# 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"]


# -- Options for HTMLHelp output ---------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'mwatersheddoc'
htmlhelp_basename = "mwatersheddoc"


# -- Options for LaTeX output ------------------------------------------
Expand All @@ -110,15 +111,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -128,21 +126,21 @@
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, """mwatershed.tex""",
u"""mwatershed Documentation""",
u"""William Hunter Patton""", 'manual'),
(
master_doc,
"""mwatershed.tex""",
"""mwatershed Documentation""",
"""William Hunter Patton""",
"manual",
),
]


# -- Options for manual page output ------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'mwatershed',
u'mwatershed Documentation',
[author], 1)
]
man_pages = [(master_doc, "mwatershed", "mwatershed Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------
Expand All @@ -151,13 +149,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'mwatershed',
u'mwatershed Documentation',
author,
'mwatershed',
'One line description of project.',
'Miscellaneous'),
(
master_doc,
"mwatershed",
"mwatershed Documentation",
author,
"mwatershed",
"One line description of project.",
"Miscellaneous",
),
]



26 changes: 26 additions & 0 deletions fun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import numpy as np
import matplotlib.pyplot as plt
import mwatershed

# Generate an empty ndarray of labels
labels = np.zeros((100, 100))

# Add circles with different labels
labels[25:40, 25:40] = 1
labels[60:75, 60:75] = 2
labels[50:70, 10:30] = 3

affs = np.zeros((2, 100, 100))
# affs[0] = labels > 0
# affs[1] = labels > 0
affs[0, 0, 0] = 1

result = mwatershed.agglom(affs - 0.5, [[0, 1], [1, 0]]).astype(np.uint32)
print(result.min(), result.max())

fig, ax = plt.subplots(1, 3, figsize=(10, 5))
# Plot the labels using imshow
ax[0].imshow(labels)
ax[1].imshow(affs[0])
ax[2].imshow(result)
plt.show()
1 change: 0 additions & 1 deletion tests/test_mwatershed.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import pytest

import mwatershed

Expand Down

0 comments on commit 121ea03

Please sign in to comment.