Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PeakOTron
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
UHHDetLab
SiPM
PeakOTron
Commits
be86ff8e
Commit
be86ff8e
authored
3 years ago
by
Jack Christopher Hutchinson Rolph
Browse files
Options
Downloads
Patches
Plain Diff
Update PeakOTron.py
parent
a9357d72
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PeakOTron.py
+15
-20
15 additions, 20 deletions
PeakOTron.py
with
15 additions
and
20 deletions
PeakOTron.py
+
15
−
20
View file @
be86ff8e
...
@@ -108,12 +108,20 @@ class BinnedLH:
...
@@ -108,12 +108,20 @@ class BinnedLH:
self
.
ndof
=
len
(
self
.
y
)
-
(
self
.
func_code
.
co_argcount
-
1
)
self
.
ndof
=
len
(
self
.
y
)
-
(
self
.
func_code
.
co_argcount
-
1
)
self
.
eps
=
np
.
finfo
(
np
.
float64
).
eps
*
10
self
.
eps
=
np
.
finfo
(
np
.
float64
).
eps
*
10
self
.
eps_inv
=
1
/
self
.
eps
self
.
eps_inv
=
1
/
self
.
eps
self
.
log_eps
=
np
.
log
(
self
.
eps
)
def
Logify
(
self
,
y
):
return
np
.
where
(
y
>
self
.
eps
,
np
.
log
(
y
),
self
.
log_eps
)
def
__call__
(
self
,
*
arg
):
def
__call__
(
self
,
*
arg
):
self
.
last_arg
=
arg
self
.
last_arg
=
arg
y_hat
=
self
.
f
(
self
.
x
,
*
arg
)
y_hat
=
self
.
f
(
self
.
x
,
*
arg
)
y_hat
=
np
.
nan_to_num
(
y_hat
,
nan
=
self
.
eps_inv
)
y_hat
=
np
.
nan_to_num
(
y_hat
,
nan
=
self
.
eps_inv
)
logL
=
self
.
y
*
np
.
log
(
y_hat
+
self
.
eps
)
-
y_hat
logL
=
self
.
y
*
(
self
.
Logify
(
y_hat
)
-
self
.
Logify
(
self
.
y
))
+
(
self
.
y
-
y_hat
)
nlogL
=
-
np
.
sum
(
logL
)
nlogL
=
-
np
.
sum
(
logL
)
return
nlogL
return
nlogL
...
@@ -187,8 +195,8 @@ class PeakOTron:
...
@@ -187,8 +195,8 @@ class PeakOTron:
def
__init__
(
self
,
def
__init__
(
self
,
verbose
=
False
,
verbose
=
False
,
n_call_minuit
=
10
000
,
n_call_minuit
=
2
000
,
n_iterations_minuit
=
10
0
n_iterations_minuit
=
5
0
):
):
...
@@ -282,7 +290,6 @@ class PeakOTron:
...
@@ -282,7 +290,6 @@ class PeakOTron:
def
LevDist
(
self
,
str1
,
str2
):
def
LevDist
(
self
,
str1
,
str2
):
counter
=
{
"
+
"
:
0
,
"
-
"
:
0
}
counter
=
{
"
+
"
:
0
,
"
-
"
:
0
}
distance
=
0
distance
=
0
...
@@ -2157,14 +2164,15 @@ class PeakOTron:
...
@@ -2157,14 +2164,15 @@ class PeakOTron:
if
(
not
np
.
isnan
(
dDCR
)
and
dDCR
is
not
None
):
if
(
not
np
.
isnan
(
dDCR
)
and
dDCR
is
not
None
):
minuit
.
errors
[
"
DCR
"
]
=
abs
(
dDCR
)
minuit
.
errors
[
"
DCR
"
]
=
abs
(
dDCR
)
minuit
.
limits
[
"
mu
"
]
=
(
self
.
_eps
,
max
(
1
,
k_hi
))
minuit
.
limits
[
"
mu
"
]
=
(
self
.
_eps
,
max
(
1
,
k_hi
))
minuit
.
limits
[
"
G
"
]
=
(
self
.
_eps
,
None
)
minuit
.
limits
[
"
G
"
]
=
(
self
.
_eps
,
None
)
minuit
.
limits
[
"
x_0
"
]
=
(
x_0
-
3
*
G
,
x_0
+
3
*
G
)
minuit
.
limits
[
"
x_0
"
]
=
(
x_0
-
G
/
2
,
x_0
+
G
/
2
)
minuit
.
limits
[
"
alpha
"
]
=
(
self
.
_eps
,
1
-
self
.
_eps
)
minuit
.
limits
[
"
alpha
"
]
=
(
self
.
_eps
,
1
-
self
.
_eps
)
minuit
.
limits
[
"
r_beta
"
]
=
(
self
.
_eps
,
1
-
self
.
_eps
)
minuit
.
limits
[
"
r_beta
"
]
=
(
self
.
_eps
,
1
-
self
.
_eps
)
minuit
.
limits
[
"
lbda
"
]
=
(
self
.
_eps
,
1
-
self
.
_eps
)
minuit
.
limits
[
"
lbda
"
]
=
(
self
.
_eps
,
1
-
self
.
_eps
)
minuit
.
limits
[
"
sigma_0
"
]
=
(
self
.
_eps
,
3
*
G
)
minuit
.
limits
[
"
sigma_0
"
]
=
(
self
.
_eps
,
G
)
minuit
.
limits
[
"
sigma_1
"
]
=
(
self
.
_eps
,
3
*
G
)
minuit
.
limits
[
"
sigma_1
"
]
=
(
self
.
_eps
,
G
)
minuit
.
limits
[
"
DCR
"
]
=
(
self
.
_eps
,
None
)
minuit
.
limits
[
"
DCR
"
]
=
(
self
.
_eps
,
None
)
...
@@ -2252,16 +2260,3 @@ class PeakOTron:
...
@@ -2252,16 +2260,3 @@ class PeakOTron:
'
Errors
'
:
lambda
val
:
f
'
{
val
:
,.
2
E
}
'
'
Errors
'
:
lambda
val
:
f
'
{
val
:
,.
2
E
}
'
})
})
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