Skip to content

Commit cd4fd53

Browse files
committed
IGNORE Reformatted code base with black
1 parent b34d8ec commit cd4fd53

File tree

79 files changed

+2999
-3032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2999
-3032
lines changed

docs/source/conf.py

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,15 @@
1515
#
1616
import os
1717
import sys
18-
sys.path.insert(0, os.path.abspath('../..'))
18+
19+
sys.path.insert(0, os.path.abspath("../.."))
1920

2021

2122
# -- Project information -----------------------------------------------------
2223

23-
project = 'pyglotaran'
24-
copyright = u"2018, Joern Weissenborn, " \
25-
u"Joris Snellenburg, " \
26-
u"Ivo van Stokkum"
27-
author = u"Joern Weissenborn, " \
28-
u"Joris Snellenburg, " \
29-
u"Ivo van Stokkum"
24+
project = "pyglotaran"
25+
copyright = "2018, Joern Weissenborn, " "Joris Snellenburg, " "Ivo van Stokkum"
26+
author = "Joern Weissenborn, " "Joris Snellenburg, " "Ivo van Stokkum"
3027

3128
# The version info for the project you're documenting, acts as replacement
3229
# for |version| and |release|, also used in various other places throughout
@@ -48,18 +45,18 @@
4845
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4946
# ones.
5047
extensions = [
51-
'sphinx.ext.autodoc',
52-
'sphinx.ext.autosummary',
53-
'sphinx.ext.doctest',
54-
'sphinx.ext.intersphinx',
55-
'sphinx.ext.extlinks',
56-
'sphinx.ext.imgmath',
57-
'sphinx.ext.viewcode',
58-
'sphinx.ext.napoleon',
59-
'numpydoc',
60-
'IPython.sphinxext.ipython_directive',
61-
'IPython.sphinxext.ipython_console_highlighting',
62-
'sphinx_copybutton',
48+
"sphinx.ext.autodoc",
49+
"sphinx.ext.autosummary",
50+
"sphinx.ext.doctest",
51+
"sphinx.ext.intersphinx",
52+
"sphinx.ext.extlinks",
53+
"sphinx.ext.imgmath",
54+
"sphinx.ext.viewcode",
55+
"sphinx.ext.napoleon",
56+
"numpydoc",
57+
"IPython.sphinxext.ipython_directive",
58+
"IPython.sphinxext.ipython_console_highlighting",
59+
"sphinx_copybutton",
6360
]
6461

6562
autoclass_content = "both"
@@ -72,18 +69,18 @@
7269
napoleon_use_ivar = True
7370

7471
# Add any paths that contain templates here, relative to this directory.
75-
templates_path = ['_templates']
72+
templates_path = ["_templates"]
7673

7774
# The suffix(es) of source filenames.
7875
# You can specify multiple suffix as a list of string:
7976
#
8077
# source_suffix = ['.rst', '.md']
81-
source_suffix = '.rst'
78+
source_suffix = ".rst"
8279

8380
# The master toctree document.
84-
master_doc = 'index'
81+
master_doc = "index"
8582

86-
imgmath_image_format = 'svg'
83+
imgmath_image_format = "svg"
8784

8885
# The language for content autogenerated by Sphinx. Refer to documentation
8986
# for a list of supported languages.
@@ -98,17 +95,17 @@
9895
exclude_patterns = []
9996

10097
# The name of the Pygments (syntax highlighting) style to use.
101-
pygments_style = 'sphinx'
98+
pygments_style = "sphinx"
10299

103100

104101
# -- Options for HTML output -------------------------------------------------
105102

106103
# The theme to use for HTML and HTML Help pages. See the documentation for
107104
# a list of builtin themes.
108105
#
109-
html_theme = 'sphinx_rtd_theme'
106+
html_theme = "sphinx_rtd_theme"
110107
html_theme_options = {
111-
'navigation_depth': -1,
108+
"navigation_depth": -1,
112109
}
113110
html_favicon = "images/glotaran_favicon.png"
114111
html_logo = "images/glotaran.png"
@@ -140,7 +137,7 @@
140137
# -- Options for HTMLHelp output ---------------------------------------------
141138

142139
# Output file base name for HTML help builder.
143-
htmlhelp_basename = 'pyglotarandoc'
140+
htmlhelp_basename = "pyglotarandoc"
144141

145142

146143
# -- Options for LaTeX output ------------------------------------------------
@@ -149,15 +146,12 @@
149146
# The paper size ('letterpaper' or 'a4paper').
150147
#
151148
# 'papersize': 'letterpaper',
152-
153149
# The font size ('10pt', '11pt' or '12pt').
154150
#
155151
# 'pointsize': '10pt',
156-
157152
# Additional stuff for the LaTeX preamble.
158153
#
159154
# 'preamble': '',
160-
161155
# Latex figure (float) alignment
162156
#
163157
# 'figure_align': 'htbp',
@@ -167,22 +161,21 @@
167161
# (source start file, target name, title,
168162
# author, documentclass [howto, manual, or own class]).
169163
latex_documents = [
170-
(master_doc, 'pyglotaran.tex', 'pyglotaran Documentation',
171-
u'Joris Snellenburg, '
172-
u'Joern Weissenborn, '
173-
u'Ivo van Stokkum',
174-
'manual'),
164+
(
165+
master_doc,
166+
"pyglotaran.tex",
167+
"pyglotaran Documentation",
168+
"Joris Snellenburg, " "Joern Weissenborn, " "Ivo van Stokkum",
169+
"manual",
170+
),
175171
]
176172

177173

178174
# -- Options for manual page output ------------------------------------------
179175

180176
# One entry per manual page. List of tuples
181177
# (source start file, name, description, authors, manual section).
182-
man_pages = [
183-
(master_doc, 'pyglotaran', 'pyglotaran Documentation',
184-
[author], 1)
185-
]
178+
man_pages = [(master_doc, "pyglotaran", "pyglotaran Documentation", [author], 1)]
186179

187180

188181
# -- Options for Texinfo output ----------------------------------------------
@@ -191,10 +184,15 @@
191184
# (source start file, target name, title, author,
192185
# dir menu entry, description, category)
193186
texinfo_documents = [
194-
(master_doc, 'pyglotaran', 'pyglotaran Documentation',
195-
author, 'pyglotaran',
196-
'Global and target analysis software package based on Python',
197-
'Miscellaneous'),
187+
(
188+
master_doc,
189+
"pyglotaran",
190+
"pyglotaran Documentation",
191+
author,
192+
"pyglotaran",
193+
"Global and target analysis software package based on Python",
194+
"Miscellaneous",
195+
),
198196
]
199197

200198

@@ -213,24 +211,24 @@
213211
# epub_uid = ''
214212

215213
# A list of files that should not be packed into the epub file.
216-
epub_exclude_files = ['search.html']
214+
epub_exclude_files = ["search.html"]
217215

218216

219217
# -- Extension configuration -------------------------------------------------
220218

221219
# -- Options for intersphinx extension ---------------------------------------
222220

223221
intersphinx_mapping = {
224-
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
225-
'xarray': ('http://xarray.pydata.org/en/stable/', None),
226-
'https://docs.python.org/': None
222+
"numpy": ("http://docs.scipy.org/doc/numpy/", None),
223+
"xarray": ("http://xarray.pydata.org/en/stable/", None),
224+
"https://docs.python.org/": None,
227225
}
228226

229-
ipython_savefig_dir = 'images/plot'
227+
ipython_savefig_dir = "images/plot"
230228

231229
# -- Options for extlinks extension ---------------------------------------
232230
extlinks = {
233-
'numpydoc': ('https://docs.scipy.org/doc/numpy/reference/generated/numpy.%s.html', 'numpy.'),
234-
'scipydoc': ('https://docs.scipy.org/doc/scipy/reference/generated/scipy.%s.html', 'scipy.'),
235-
'xarraydoc': ('https://xarray.pydata.org/en/stable/generated/xarray.%s.html', 'xarray.'),
231+
"numpydoc": ("https://docs.scipy.org/doc/numpy/reference/generated/numpy.%s.html", "numpy."),
232+
"scipydoc": ("https://docs.scipy.org/doc/scipy/reference/generated/scipy.%s.html", "scipy."),
233+
"xarraydoc": ("https://xarray.pydata.org/en/stable/generated/xarray.%s.html", "xarray."),
236234
}

glotaran/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from . import model, parameter, io # noqa: F401
44

5-
__version__ = '0.1.0'
5+
__version__ = "0.1.0"
66

77
ParameterGroup = parameter.ParameterGroup
88

@@ -18,5 +18,5 @@
1818

1919
import pkg_resources # noqa: E402
2020

21-
for entry_point in pkg_resources.iter_entry_points('glotaran.plugins'):
21+
for entry_point in pkg_resources.iter_entry_points("glotaran.plugins"):
2222
entry_point.load()

glotaran/analysis/matrix_calculation.py

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import numpy as np
44

55

6-
LabelAndMatrix = collections.namedtuple('LabelAndMatrix', 'clp_label matrix')
7-
LabelAndMatrixAndData = collections.namedtuple('LabelAndMatrixAndData', 'label_matrix data')
6+
LabelAndMatrix = collections.namedtuple("LabelAndMatrix", "clp_label matrix")
7+
LabelAndMatrixAndData = collections.namedtuple("LabelAndMatrixAndData", "label_matrix data")
88

99

1010
def calculate_index_independend_ungrouped_matrices(scheme, parameter):
@@ -16,24 +16,22 @@ def calculate_index_independend_ungrouped_matrices(scheme, parameter):
1616
constraint_labels_and_matrices = {}
1717
model = scheme.model
1818

19-
descriptors = {label: descriptor.fill(model, parameter)
20-
for label, descriptor in scheme.model.dataset.items()}
19+
descriptors = {
20+
label: descriptor.fill(model, parameter)
21+
for label, descriptor in scheme.model.dataset.items()
22+
}
2123

2224
for label, descriptor in descriptors.items():
2325
axis = scheme.data[label].coords[model.matrix_dimension].values
24-
clp_label, matrix = _calculate_matrix(
25-
model.matrix,
26-
descriptor,
27-
axis,
28-
{},
29-
)
26+
clp_label, matrix = _calculate_matrix(model.matrix, descriptor, axis, {},)
3027
clp_labels[label] = clp_label
3128
matrices[label] = matrix
3229

3330
if callable(model.has_matrix_constraints_function):
3431
if model.has_matrix_constraints_function():
35-
clp_label, matrix = \
36-
model.constrain_matrix_function(parameter, clp_label, matrix, None)
32+
clp_label, matrix = model.constrain_matrix_function(
33+
parameter, clp_label, matrix, None
34+
)
3735

3836
constraint_labels_and_matrices[label] = LabelAndMatrix(clp_label, matrix)
3937
return clp_labels, matrices, constraint_labels_and_matrices
@@ -42,12 +40,16 @@ def calculate_index_independend_ungrouped_matrices(scheme, parameter):
4240
def calculate_index_independend_grouped_matrices(scheme, groups, parameter):
4341

4442
# We just need to create groups from the ungrouped matrices
45-
clp_labels, matrices, constraint_labels_and_matrices = \
46-
calculate_index_independend_ungrouped_matrices(scheme, parameter)
43+
(
44+
clp_labels,
45+
matrices,
46+
constraint_labels_and_matrices,
47+
) = calculate_index_independend_ungrouped_matrices(scheme, parameter)
4748
for label, group in groups.items():
4849
if label not in matrices:
49-
constraint_labels_and_matrices[label] = \
50-
_combine_matrices([constraint_labels_and_matrices[label] for label in group])
50+
constraint_labels_and_matrices[label] = _combine_matrices(
51+
[constraint_labels_and_matrices[label] for label in group]
52+
)
5153

5254
return clp_labels, matrices, constraint_labels_and_matrices
5355

@@ -59,20 +61,18 @@ def create_index_dependend_ungrouped_matrix_jobs(scheme, bag, parameter):
5961
matrices = {}
6062
constraint_labels_and_matrices = {}
6163

62-
descriptors = {label: descriptor.fill(model, parameter)
63-
for label, descriptor in scheme.model.dataset.items()}
64+
descriptors = {
65+
label: descriptor.fill(model, parameter)
66+
for label, descriptor in scheme.model.dataset.items()
67+
}
6468
for label, problem in bag.items():
6569
descriptor = descriptors[label]
6670
clp_labels[label] = []
6771
matrices[label] = []
6872
constraint_labels_and_matrices[label] = []
6973
for index in problem.global_axis:
7074
clp, matrix = dask.delayed(_calculate_matrix, nout=2)(
71-
model.matrix,
72-
descriptor,
73-
problem.matrix_axis,
74-
{},
75-
index=index,
75+
model.matrix, descriptor, problem.matrix_axis, {}, index=index,
7676
)
7777
clp_labels[label].append(clp)
7878
matrices[label].append(matrix)
@@ -91,17 +91,18 @@ def create_index_dependend_grouped_matrix_jobs(scheme, bag, parameter):
9191

9292
model = scheme.model
9393

94-
descriptors = {label: descriptor.fill(model, parameter)
95-
for label, descriptor in scheme.model.dataset.items()}
94+
descriptors = {
95+
label: descriptor.fill(model, parameter)
96+
for label, descriptor in scheme.model.dataset.items()
97+
}
9698

9799
def calculate_group(group):
98-
results = [_calculate_matrix(
99-
model.matrix,
100-
descriptors[problem.dataset],
101-
problem.axis,
102-
{},
103-
index=problem.index
104-
) for problem in group.descriptor]
100+
results = [
101+
_calculate_matrix(
102+
model.matrix, descriptors[problem.dataset], problem.axis, {}, index=problem.index
103+
)
104+
for problem in group.descriptor
105+
]
105106
return results, group.descriptor[0].index
106107

107108
def get_clp(result):
@@ -127,13 +128,13 @@ def constrain_and_combine_matrices(result):
127128

128129
def _calculate_matrix(matrix_function, dataset_descriptor, axis, extra, index=None):
129130
args = {
130-
'dataset_descriptor': dataset_descriptor,
131-
'axis': axis,
131+
"dataset_descriptor": dataset_descriptor,
132+
"axis": axis,
132133
}
133134
for k, v in extra:
134135
args[k] = v
135136
if index is not None:
136-
args['index'] = index
137+
args["index"] = index
137138
clp_label, matrix = matrix_function(**args)
138139
if dataset_descriptor.scale is not None:
139140
matrix *= dataset_descriptor.scale

glotaran/analysis/nnls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
from scipy.optimize import nnls
77

88

9-
def residual_nnls(matrix: np.ndarray, data: np.ndarray) \
10-
-> typing.Tuple[typing.List[str], np.ndarray]:
9+
def residual_nnls(
10+
matrix: np.ndarray, data: np.ndarray
11+
) -> typing.Tuple[typing.List[str], np.ndarray]:
1112
"""Calculates the conditionaly linear parameters and residual with the non-negative
1213
least-squares method.
1314

0 commit comments

Comments
 (0)