Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sumpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
sumpy
Commits
9ee2d7d2
Commit
9ee2d7d2
authored
6 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Fix overindentation
parent
78a11d46
No related branches found
No related tags found
1 merge request
!111
CI: Stop targeting specific Py3 versions
Pipeline
#15496
passed with warnings
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sumpy/visualization.py
+26
-26
26 additions, 26 deletions
sumpy/visualization.py
with
26 additions
and
26 deletions
sumpy/visualization.py
+
26
−
26
View file @
9ee2d7d2
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment