Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ALICE-open-data
ALICE Blender animation
Commits
31255dd6
Commit
31255dd6
authored
Oct 25, 2019
by
Rafael Pezzi
Browse files
Tweaking parameters
parent
97bfee72
Changes
2
Hide whitespace changes
Inline
Side-by-side
animate_particles.py
View file @
31255dd6
...
@@ -37,7 +37,7 @@ particle_colors = {"Electron":clRed, "Pion":clGreen, "Muon":clBlue, "Proton":clM
...
@@ -37,7 +37,7 @@ particle_colors = {"Electron":clRed, "Pion":clGreen, "Muon":clBlue, "Proton":clM
r_part
=
0.05
r_part
=
0.05
# Event Multiplicity
# Event Multiplicity
n_particles
=
2
00
n_particles
=
10
00
# Configure Environment
# Configure Environment
bcs
=
bpy
.
context
.
scene
bcs
=
bpy
.
context
.
scene
...
@@ -47,7 +47,7 @@ bcs.world.light_settings.environment_energy = 0.1
...
@@ -47,7 +47,7 @@ bcs.world.light_settings.environment_energy = 0.1
# Configure Output
# Configure Output
bcsr
=
bcs
.
render
bcsr
=
bcs
.
render
bcsr
.
resolution_percentage
=
5
0
bcsr
.
resolution_percentage
=
10
0
bcsr
.
image_settings
.
file_format
=
'FFMPEG'
bcsr
.
image_settings
.
file_format
=
'FFMPEG'
bcsr
.
ffmpeg
.
format
=
"MPEG4"
bcsr
.
ffmpeg
.
format
=
"MPEG4"
bcsr
.
ffmpeg
.
codec
=
"H264"
bcsr
.
ffmpeg
.
codec
=
"H264"
...
@@ -79,6 +79,8 @@ def create(particles):
...
@@ -79,6 +79,8 @@ def create(particles):
bpy
.
data
.
materials
.
new
(
name
=
type
)
bpy
.
data
.
materials
.
new
(
name
=
type
)
#bpy.context.object.active_material = (1, 0, 0)
#bpy.context.object.active_material = (1, 0, 0)
bpy
.
data
.
materials
[
type
].
diffuse_color
=
particle_colors
[
type
]
bpy
.
data
.
materials
[
type
].
diffuse_color
=
particle_colors
[
type
]
bpy
.
data
.
materials
[
type
].
use_shadows
=
False
bpy
.
data
.
materials
[
type
].
use_cast_shadows
=
False
# Create blender spheres (particles)
# Create blender spheres (particles)
for
particle
in
particles
:
for
particle
in
particles
:
...
@@ -166,6 +168,6 @@ bpy.context.scene.frame_current = 20
...
@@ -166,6 +168,6 @@ bpy.context.scene.frame_current = 20
#bpy.ops.wm.save_as_mainfile(filepath="/home/pezzi/particles_"+str(n_particles)+".blend")
#bpy.ops.wm.save_as_mainfile(filepath="/home/pezzi/particles_"+str(n_particles)+".blend")
# Render animation
# Render animation
#
bpy.ops.render.render(animation=True)
bpy
.
ops
.
render
.
render
(
animation
=
True
)
#exit()
#exit()
particle.py
View file @
31255dd6
...
@@ -28,7 +28,7 @@ def createNparticles(N_particles, x = 0, y = 0, z = 0): # Create particles at g
...
@@ -28,7 +28,7 @@ def createNparticles(N_particles, x = 0, y = 0, z = 0): # Create particles at g
# Derived class to computes the time evolution particle positions
# Derived class to computes the time evolution particle positions
class
ParticlePropagator
(
Particle
):
class
ParticlePropagator
(
Particle
):
def
SetMagneticField
(
self
,
B
=
0.5
*
10
):
def
SetMagneticField
(
self
,
B
=
0.5
):
self
.
B
=
B
self
.
B
=
B
def
SetProperties
(
self
,
Px
,
Py
,
Pz
,
charge
=
1
):
def
SetProperties
(
self
,
Px
,
Py
,
Pz
,
charge
=
1
):
self
.
charge
=
charge
self
.
charge
=
charge
...
@@ -56,6 +56,6 @@ def createNparticlesPropGaussian(N_particles, x = 0, y = 0, z = 0): # Create pa
...
@@ -56,6 +56,6 @@ def createNparticlesPropGaussian(N_particles, x = 0, y = 0, z = 0): # Create pa
charge
=
random
.
choice
([
+
1
,
-
1
])
charge
=
random
.
choice
([
+
1
,
-
1
])
part
=
ParticlePropagator
(
i
,
x
,
y
,
z
)
part
=
ParticlePropagator
(
i
,
x
,
y
,
z
)
part
.
SetMagneticField
()
part
.
SetMagneticField
()
part
.
SetProperties
(
random
.
gauss
(
0
,
1
),
random
.
gauss
(
0
,
1
),
random
.
gauss
(
0
,
1
),
charge
)
part
.
SetProperties
(
random
.
gauss
(
0
,
4
),
random
.
gauss
(
0
,
4
),
random
.
gauss
(
0
,
4
),
charge
)
particles
.
append
(
part
)
particles
.
append
(
part
)
return
particles
;
return
particles
;
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