Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
7733a751
Commit
7733a751
authored
Sep 18, 2015
by
eric pellegrini
Browse files
Bug fix when building slice plot
parent
a188dc7b
Changes
1
Show whitespace changes
Inline
Side-by-side
MDANSE/Framework/Plugins/Plotter/Plotter2D.py
View file @
7733a751
...
...
@@ -279,7 +279,7 @@ class Plotter2D(wx.Panel):
dy
=
(
self
.
Ymax
-
self
.
Ymin
)
/
float
(
self
.
data
.
shape
[
0
])
X
=
numpy
.
floor
((
x
-
self
.
Xmin
)
/
dx
)
Y
=
numpy
.
floor
((
y
-
self
.
Ymin
)
/
dy
)
vslice
,
_
=
self
.
extract_cross_slice
(
X
,
Y
)
vslice
,
hslice
=
self
.
extract_cross_slice
(
X
,
Y
)
if
not
self
.
parent
.
unique_slicer
is
None
:
self
.
cross_slice_dialog
=
self
.
parent
.
unique_slicer
.
dialog
...
...
@@ -330,9 +330,10 @@ class Plotter2D(wx.Panel):
self
.
slice_widget
.
append
(
self
.
subplot
.
axhline
(
y
=
y
,
linewidth
=
3
,
color
=
'%s'
%
self
.
get_circular_color
(
self
.
cross_slice_color_index
)))
v_tmp_plot
=
self
.
v_cross_slice_plot
.
plot
(
self
.
Xaxis
*
self
.
Xunit_conversion_factor
,
vslice
,
color
=
'%s'
%
self
.
get_circular_color
(
self
.
cross_slice_color_index
))
h_tmp_plot
=
self
.
h_cross_slice_plot
.
plot
(
self
.
Yaxis
*
self
.
Yunit_conversion_factor
,
hslice
,
color
=
'%s'
%
self
.
get_circular_color
(
self
.
cross_slice_color_index
))
self
.
v_cross_slice_legend
.
append
([
v_tmp_plot
[
0
],
'
x
= %
d'
%
x
])
self
.
h_cross_slice_legend
.
append
([
v
_tmp_plot
[
0
],
'
y
= %
d'
%
y
])
self
.
v_cross_slice_legend
.
append
([
v_tmp_plot
[
0
],
'
%s
= %
8.3f'
%
(
self
.
Xlabel
,
x
)
])
self
.
h_cross_slice_legend
.
append
([
h
_tmp_plot
[
0
],
'
%s
= %
8.3f'
%
(
self
.
Ylabel
,
y
)
])
self
.
v_cross_slice_plot
.
set_xlabel
(
self
.
Xlabel
+
self
.
fmt_Xunit
)
self
.
h_cross_slice_plot
.
set_xlabel
(
self
.
Ylabel
+
self
.
fmt_Yunit
)
...
...
@@ -402,18 +403,6 @@ class Plotter2D(wx.Panel):
circ_idx
=
idx
%
len
(
self
.
color_list
)
return
self
.
color_list
.
values
()[
circ_idx
]
def
extract_segment_slice
(
self
,
coords
):
x
,
y
=
coords
[
0
]
xp
,
yp
=
coords
[
1
]
dist
=
numpy
.
sqrt
((
x
-
xp
)
**
2
+
(
y
-
yp
)
**
2
)
RX
=
numpy
.
linspace
(
x
,
xp
,
dist
)
RY
=
numpy
.
linspace
(
y
,
yp
,
dist
)
X
,
Y
=
RX
.
astype
(
numpy
.
int
),
RY
.
astype
(
numpy
.
int
)
# Extract the values along the line
slic
=
self
.
data
[
X
,
Y
]
return
slic
,
RX
,
RY
def
extract_cross_slice
(
self
,
x
,
y
):
x
=
int
(
x
)
y
=
int
(
y
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment