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
ea135458
Commit
ea135458
authored
6 years ago
by
lorenzennio
Browse files
Options
Downloads
Patches
Plain Diff
Developing unittests. x fit super unstable. y fit ok, but some very off fits now and then.
parent
9570134d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
analysis.py
+2
-2
2 additions, 2 deletions
analysis.py
test.py
+3
-1
3 additions, 1 deletion
test.py
testAnalysis.py
+33
-5
33 additions, 5 deletions
testAnalysis.py
with
38 additions
and
8 deletions
analysis.py
+
2
−
2
View file @
ea135458
...
...
@@ -87,7 +87,7 @@ class Analysis:
self
.
zPoints
[
'
Mean
'
],
sx
=
self
.
xPoints
[
'
Error
'
],
sy
=
self
.
zPoints
[
'
Error
'
])
xODR
=
odr
.
ODR
(
xData
,
xModel
,
beta0
=
[
1
,
1
,
1
,
1
])
xODR
=
odr
.
ODR
(
xData
,
xModel
,
beta0
=
[
1
,
1
00
,
1
00
,
1
00
])
xOUT
=
xODR
.
run
()
xOUT
.
pprint
()
"""
...
...
@@ -124,7 +124,7 @@ class Analysis:
self
.
yPoints
[
'
Mean
'
],
sx
=
self
.
zPoints
[
'
Error
'
],
sy
=
self
.
yPoints
[
'
Error
'
])
yODR
=
odr
.
ODR
(
yData
,
yModel
,
beta0
=
[
1e3
,
1
,
1
])
yODR
=
odr
.
ODR
(
yData
,
yModel
,
beta0
=
[
1e3
,
1
00
,
1
00
])
yOUT
=
yODR
.
run
()
yOUT
.
pprint
()
"""
...
...
This diff is collapsed.
Click to expand it.
test.py
+
3
−
1
View file @
ea135458
...
...
@@ -13,5 +13,7 @@ class Particle:
DET
=
Detector
()
DETRes
=
DET
.
detect
(
Particle
())
ANA
=
Analysis
(
DETRes
)
ANA
=
Analysis
()
ANA
.
fill
(
DETRes
)
ANA
.
yFit
()
This diff is collapsed.
Click to expand it.
testAnalysis.py
+
33
−
5
View file @
ea135458
...
...
@@ -7,7 +7,7 @@ class testAnalysis(unittest.TestCase):
"""
A simple test to check the angle means ans error computation.
"""
def
test
(
self
):
def
test
xFit
(
self
):
#ang = np.array([6,5,6,5,8,4,8,4,7,1,7,1,10,3,10,3,None,None,None,None])
#ang = np.reshape(ang, (5,2,2))
A
=
Analysis
()
...
...
@@ -15,15 +15,15 @@ class testAnalysis(unittest.TestCase):
#self.assertEqual(A.results['Error'][0], 0.5)
z
=
np
.
arange
(
30
)
y
=
A
.
yEOM
([
100
,
1
,
1
],
z
)
z
=
np
.
arange
(
0
,
30
)
y
=
A
.
yEOM
([
100
0
,
1
,
1
],
z
)
#plt.plot(z,y)
#plt.show()
Data
=
[]
for
i
in
range
(
0
,
len
(
z
)):
err
=
np
.
random
.
random
(
size
=
(
4
))
print
(
err
)
err
=
0.01
*
np
.
random
.
random
(
size
=
(
4
))
#
print(err)
Data
.
append
([[
0
,
0
],
[
y
[
i
]
+
err
[
0
],
y
[
i
]
-
err
[
1
]],
[
z
[
i
]
+
err
[
2
],
z
[
i
]
-
err
[
3
]]])
#np.concatenate((Data,
# [[0,0], [y[i]+0.1,y[i]-0.1], [z[i]+0.1, z[i]-0.1]]), axis=0)
...
...
@@ -34,3 +34,31 @@ class testAnalysis(unittest.TestCase):
#print(y)
#print(z)
#print(Data)
def
testyFit
(
self
):
#ang = np.array([6,5,6,5,8,4,8,4,7,1,7,1,10,3,10,3,None,None,None,None])
#ang = np.reshape(ang, (5,2,2))
A
=
Analysis
()
#self.assertEqual(A.results['Mean'][0], 5.5)
#self.assertEqual(A.results['Error'][0], 0.5)
x
=
np
.
arange
(
0
,
10
,
0.1
)
z
=
A
.
xEOM
([
1
,
10
,
10
,
100
],
x
)
#plt.plot(z,x)
#plt.show()
Data
=
[]
for
i
in
range
(
0
,
len
(
z
)):
err
=
0.01
*
np
.
random
.
random
(
size
=
(
4
))
#print(err)
Data
.
append
([[
x
[
i
]
+
err
[
0
],
x
[
i
]
-
err
[
1
]],
[
0
,
0
],
[
z
[
i
]
+
err
[
2
],
z
[
i
]
-
err
[
3
]]])
#np.concatenate((Data,
# [[0,0], [y[i]+0.1,y[i]-0.1], [z[i]+0.1, z[i]-0.1]]), axis=0)
Data
=
np
.
array
(
Data
)
A
.
fill
(
Data
)
A
.
xFit
()
#print(y)
#print(z)
#print(Data)
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