Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
2cdcf1cf
Commit
2cdcf1cf
authored
4 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
plot_utils: units now as kwargs
parent
f82071fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Wrap/Python/plot_utils.py
+7
-5
7 additions, 5 deletions
Wrap/Python/plot_utils.py
with
7 additions
and
5 deletions
Wrap/Python/plot_utils.py
+
7
−
5
View file @
2cdcf1cf
...
...
@@ -142,7 +142,7 @@ def plot_histogram(hist, **kwargs):
plot_array
(
hist
.
array
(),
title
=
title
,
axes_limits
=
axes_limits
,
**
kwargs
)
def
plot_colormap
(
result
,
units
=
ba
.
Axes
.
DEFAULT
,
**
kwargs
):
def
plot_colormap
(
result
,
**
kwargs
):
"""
Plots intensity data as color map
:param result: SimulationResult from GISAS/OffSpecSimulation
...
...
@@ -150,6 +150,7 @@ def plot_colormap(result, units=ba.Axes.DEFAULT, **kwargs):
:param zmax: Max value on amplitude
'
s color bar
"""
units
=
kwargs
.
pop
(
'
units
'
,
ba
.
Axes
.
DEFAULT
)
axes_limits
=
get_axes_limits
(
result
,
units
)
axes_labels
=
get_axes_labels
(
result
,
units
)
...
...
@@ -161,7 +162,7 @@ def plot_colormap(result, units=ba.Axes.DEFAULT, **kwargs):
plot_array
(
result
.
array
(),
axes_limits
=
axes_limits
,
**
kwargs
)
def
plot_specular_simulation_result
(
result
,
units
=
ba
.
Axes
.
DEFAULT
,
**
kwargs
):
def
plot_specular_simulation_result
(
result
,
**
kwargs
):
"""
Plots intensity data for specular simulation result
:param result: SimulationResult from SpecularSimulation
...
...
@@ -170,6 +171,7 @@ def plot_specular_simulation_result(result, units=ba.Axes.DEFAULT, **kwargs):
:param units: units on the x-axis
"""
units
=
kwargs
.
pop
(
'
units
'
,
ba
.
Axes
.
DEFAULT
)
intensity
=
result
.
array
(
units
)
x_axis
=
result
.
axis
(
units
)
...
...
@@ -193,7 +195,7 @@ def plot_specular_simulation_result(result, units=ba.Axes.DEFAULT, **kwargs):
plt
.
title
(
title
)
def
plot_simulation_result
(
result
,
units
=
ba
.
Axes
.
DEFAULT
,
**
kwargs
):
def
plot_simulation_result
(
result
,
**
kwargs
):
"""
Draws simulation result and (optionally) shows the plot.
:param result_: SimulationResult object obtained from GISAS/OffSpec/SpecularSimulation
...
...
@@ -205,9 +207,9 @@ def plot_simulation_result(result, units=ba.Axes.DEFAULT, **kwargs):
postpone_show
=
kwargs
.
pop
(
'
postpone_show
'
,
False
)
if
len
(
result
.
array
().
shape
)
==
1
:
# 1D data, specular simulation assumed
plot_specular_simulation_result
(
result
,
units
,
**
kwargs
)
plot_specular_simulation_result
(
result
,
**
kwargs
)
else
:
plot_colormap
(
result
,
units
,
**
kwargs
)
plot_colormap
(
result
,
**
kwargs
)
plt
.
tight_layout
()
if
not
(
postpone_show
):
plt
.
show
()
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