Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frtrglib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valentin Bruch
frtrglib
Commits
165f3fac
Verified
Commit
165f3fac
authored
May 10, 2023
by
Valentin Bruch
Browse files
Options
Downloads
Patches
Plain Diff
creating 3d animation in plot_pyqtgraph.py
parent
48f2e4e6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plot_pyqtgraph.py
+40
-25
40 additions, 25 deletions
plot_pyqtgraph.py
with
40 additions
and
25 deletions
plot_pyqtgraph.py
+
40
−
25
View file @
165f3fac
...
...
@@ -12,12 +12,13 @@ from pyqtgraph.Qt import QtGui
from
pyqtgraph.Qt.QtWidgets
import
QApplication
from
pyqtgraph
import
makeQImage
import
pyqtgraph.opengl
as
gl
from
matplotlib
.pyplot
import
cm
from
matplotlib
import
colormaps
as
cm
import
pandas
as
pd
from
scipy.optimize
import
curve_fit
import
settings
from
data_management
import
DataManager
from
final_plots
import
photon_assisted_tunneling
from
pyqtgraph_utils
import
*
#from OpenGL import GL
#GL.glEnable(GL.GL_DEPTH_TEST)
...
...
@@ -270,8 +271,8 @@ def plot_interpolated(
mirror_vdc
=
True
,
mirror_vac
=
False
,
cmap
=
"
viridis
"
,
order
=
"
o3a
"
,
method
=
"
mu
"
,
truncation_order
=
3
,
include_Ga
=
False
,
integral_method
=
-
15
,
**
parameters
):
...
...
@@ -283,7 +284,7 @@ def plot_interpolated(
data
=
np
.
load
(
"
figdata/omega5_interp.npz
"
)
app
=
QApplication
([])
w
=
gl
.
GLViewWidget
()
w
.
show
(
)
add3DAxes
(
w
,
size
=
(
70
,
70
,
60
),
fontColor
=
(
0
,
0
,
0
,
255
),
xlabel
=
"
Vosc
"
,
ylabel
=
"
Vavg
"
,
zlabel
=
"
log(G)
"
,
r
=
4
,
h
=
9
,
shift
=
(
0
,
-
135
,
-
95
)
)
#pos = np.array([*np.meshgrid(data["vdc"], data["vac"]), 50*data["gdc_g"]]).reshape((3,-1)).T
#sp = gl.GLScatterPlotItem(pos=pos, size=0.2, color=cm.viridis(data["gdc_g"].flatten()), pxMode=False)
#sp.setGLOptions("additive")
...
...
@@ -292,14 +293,8 @@ def plot_interpolated(
#sp = gl.GLScatterPlotItem(pos=pos_diff, size=0.2, color=cm.viridis(pos_diff[:,2]/10), pxMode=False)
#sp.setGLOptions("additive")
#w.addItem(sp)
vdc
=
data
[
"
vdc
"
]
order
=
f
"
o
{
truncation_order
}
"
if
include_Ga
:
order
+=
"
p
"
assert
integral_method
is
None
or
integral_method
==
-
1
else
:
assert
integral_method
is
None
or
integral_method
==
-
15
vac
=
data
[
"
vac
"
]
vdc
=
data
[
"
vdc
"
][
0
]
vac
=
data
[
"
vac
"
][:,
0
]
gdc
=
np
.
pi
*
data
[
f
"
gdc_
{
method
}
_
{
order
}
"
]
if
mirror_vdc
:
vdc
=
np
.
concatenate
((
-
vdc
[:
0
:
-
1
],
vdc
))
...
...
@@ -314,34 +309,54 @@ def plot_interpolated(
y
=
vdc
,
z
=
50
*
np
.
log
(
gdc
),
colors
=
cmap_light
(
gdc
),
drawEdges
=
False
)
sp
.
translate
(
1e-3
,
-
1e-3
,
-
1e-3
)
drawEdges
=
False
,
smooth
=
True
)
sp
.
translate
(
0
,
0
,
-
1e-3
)
#sp.translate(-1e-2, -1e-2, -1e-2)
w
.
addItem
(
sp
)
for
i
in
range
(
0
,
vac
.
size
,
10
):
line
=
gl
.
GLLinePlotItem
(
pos
=
np
.
array
([
vac
[
i
]
*
np
.
ones_like
(
vdc
),
vdc
,
50
*
np
.
log
(
gdc
[
i
])]).
T
,
color
=
cmap_dark
(
gdc
[
i
]),
width
=
10
)
line
.
setGLOptions
(
"
translucent
"
)
width
=
10
,
antialias
=
True
,
mode
=
"
line_strip
"
)
line
.
setGLOptions
(
"
opaque
"
)
line
.
setDepthValue
(
10
)
w
.
addItem
(
line
)
for
i
in
range
(
0
,
vdc
.
size
,
10
):
line
=
gl
.
GLLinePlotItem
(
pos
=
np
.
array
([
vac
,
vdc
[
i
]
*
np
.
ones_like
(
vac
),
50
*
np
.
log
(
gdc
[:,
i
])]).
T
,
color
=
cmap_dark
(
gdc
[:,
i
]),
width
=
10
)
line
.
setGLOptions
(
"
translucent
"
)
width
=
10
,
antialias
=
True
,
mode
=
"
line_strip
"
)
line
.
setGLOptions
(
"
opaque
"
)
line
.
setDepthValue
(
10
)
w
.
addItem
(
line
)
w
.
opts
[
"
bgcolor
"
]
=
(
1.
,
1.
,
1.
,
0.
)
w
.
opts
[
"
azimuth
"
]
=
-
30
w
.
opts
[
"
elevation
"
]
=
30
w
.
show
()
w
.
opts
[
"
bgcolor
"
]
=
(
1.
,
1.
,
1.
,
1.
)
#w.opts["fov"] = 100
w
.
opts
[
"
distance
"
]
=
450
w
.
opts
[
"
center
"
]
=
QtGui
.
QVector3D
(
0
,
40
,
-
150
)
arr
=
w
.
renderToArray
((
1000
,
800
)).
transpose
((
1
,
0
,
2
))
makeQImage
(
arr
).
save
(
f
"
/tmp/Goverview_
{
method
}
_
{
order
}
.png
"
)
w
.
setGeometry
(
0
,
0
,
2000
,
1360
)
for
frame
,
progress
in
enumerate
(
np
.
linspace
(
0
,
2
*
np
.
pi
,
800
,
endpoint
=
False
)):
settings
.
logger
.
info
(
f
"
progress:
{
progress
*
50
/
np
.
pi
:
.
1
f
}
%
"
)
#w.opts["center"] = QtGui.QVector3D(0,24+18*np.cos(progress+0.3),-180-20*np.sin(progress-0.1))
#w.opts["distance"] = 475 - 15*np.cos(progress+0.2)
#w.opts["azimuth"] = -22*np.cos(progress+0.3) - 21
#w.opts["elevation"] = 12*np.sin(progress-0.1) + 30
w
.
opts
[
"
center
"
]
=
QtGui
.
QVector3D
(
0
,
24
+
12
*
np
.
cos
(
progress
+
0.3
),
-
162
-
14
*
np
.
sin
(
progress
-
0.1
))
w
.
opts
[
"
distance
"
]
=
460
-
10
*
np
.
cos
(
progress
+
0.2
)
w
.
opts
[
"
azimuth
"
]
=
-
16
*
np
.
cos
(
progress
+
0.3
)
-
21
w
.
opts
[
"
elevation
"
]
=
8
*
np
.
sin
(
progress
-
0.1
)
+
30
#arr = w.renderToArray((2000,1500)).transpose((1,0,2))
#makeQImage(arr).save(f"/tmp/frames/img_{frame:04d}.png")
w
.
grabFramebuffer
().
save
(
f
"
/tmp/frames/img_
{
frame
:
04
d
}
.png
"
)
# ffmpeg -framerate 50 -i /tmp/frames/img_%04d.png -c:v libsvtav1 -b:v 4M -movflags +faststart output.webm
app
.
exec
()
#w.grabFrameBuffer().save('/tmp/test.png')
def
convergence_grid_data
(
dm
,
...
...
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