Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSD Detector Project
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
Container Registry
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
CSD-team
CSD Detector Project
Commits
b42ba4eb
Commit
b42ba4eb
authored
6 years ago
by
U.Mattschas
Browse files
Options
Downloads
Patches
Plain Diff
Update Particles_software.py. Now with electrons and protons.
parent
60582d05
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Particle
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Particles_software.py
+12
-11
12 additions, 11 deletions
Particles_software.py
with
12 additions
and
11 deletions
Particles_software.py
+
12
−
11
View file @
b42ba4eb
# -*- coding: utf-8 -*-
import
random
import
numpy
as
np
class
p
article
:
class
P
article
:
"""
Create angles, mass and velocity to particles on a plane
"""
def
__init__
(
self
):
"""
The angles are created randomly onto a projectet square
"""
self
.
theta
=
random
.
uniform
(
-
np
.
arctan
(
0.5
),
np
.
arctan
(
0.5
))
self
.
phi
=
random
.
uniform
(
-
np
.
arctan
(
0.5
),
np
.
arctan
(
0.5
))
self
.
theta
=
np
.
random
.
uniform
(
-
np
.
arctan
(
0.5
),
np
.
arctan
(
0.5
))
self
.
phi
=
np
.
random
.
uniform
(
-
np
.
arctan
(
0.5
),
np
.
arctan
(
0.5
))
"""
If we want two different masses (electron, proton), I have here
created them with equal probability
"""
self
.
m
=
0.511
#MeV
self
.
e
=
np
.
random
.
uniform
(
1
,
0
)
if
self
.
e
>
0.5
:
self
.
m
=
0.511
#MeV
else
:
self
.
m
=
938.272
#Mev
"""
Velocity: random velocity between X and Y
"""
self
.
v
=
random
.
uniform
(
0.2
,
0.6
)
#Natural units
self
.
v
=
np
.
random
.
uniform
(
0.2
,
0.6
)
#Natural units
#Alter the range of velocities
#Perhaps make vx, vy, vz
"""
Charge, 1,-1
"""
self
.
k
=
random
.
uniform
(
1
,
0
)
self
.
k
=
np
.
random
.
uniform
(
1
,
0
)
if
self
.
k
>
0.5
:
q
=
1
q
=
1
else
:
q
=
-
1
q
=
-
1
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