Skip to content
Snippets Groups Projects
Commit 9ee2d7d2 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Fix overindentation

parent 78a11d46
No related branches found
No related tags found
1 merge request!111CI: Stop targeting specific Py3 versions
Pipeline #15496 passed with warnings
...@@ -64,35 +64,35 @@ def separate_by_real_and_imag(data, real_only): ...@@ -64,35 +64,35 @@ def separate_by_real_and_imag(data, real_only):
def make_field_plotter_from_bbox(bbox, h, extend_factor=0): def make_field_plotter_from_bbox(bbox, h, extend_factor=0):
""" """
:arg bbox: a tuple (low, high) of points represented as 1D numpy arrays :arg bbox: a tuple (low, high) of points represented as 1D numpy arrays
indicating the low and high ends of the extent of a bounding box. indicating the low and high ends of the extent of a bounding box.
:arg h: Either a number or a sequence of numbers indicating the desired :arg h: Either a number or a sequence of numbers indicating the desired
(approximate) grid spacing in all or each of the dimensions. If a (approximate) grid spacing in all or each of the dimensions. If a
sequence, the length must match the number of dimensions. sequence, the length must match the number of dimensions.
:arg extend_factor: A floating point number indicating by what percentage :arg extend_factor: A floating point number indicating by what percentage
the plot area should be grown compared to *bbox*. the plot area should be grown compared to *bbox*.
""" """
low, high = bbox low, high = bbox
extent = (high-low) * (1 + extend_factor) extent = (high-low) * (1 + extend_factor)
center = 0.5*(high+low) center = 0.5*(high+low)
dimensions = len(center) dimensions = len(center)
from numbers import Number from numbers import Number
if isinstance(h, Number): if isinstance(h, Number):
h = (h,)*dimensions h = (h,)*dimensions
else: else:
if len(h) != dimensions: if len(h) != dimensions:
raise ValueError("length of 'h' must match number of dimensions") raise ValueError("length of 'h' must match number of dimensions")
from math import ceil from math import ceil
npoints = tuple( npoints = tuple(
int(ceil(extent[i] / h[i])) int(ceil(extent[i] / h[i]))
for i in range(dimensions)) for i in range(dimensions))
return FieldPlotter(center, extent, npoints) return FieldPlotter(center, extent, npoints)
class FieldPlotter(object): class FieldPlotter(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment