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
Admin message
Wartung heute um 18:25 wegen einer Sicherheitswarnung von GitLab
Show more breadcrumbs
UHHDetLab
SiPM
PeakOTron
Commits
963c0058
Commit
963c0058
authored
8 months ago
by
Antonello, Dr. Massimiliano
Browse files
Options
Downloads
Patches
Plain Diff
Some changes to sumlab_auto to save now also a sumlab compatible h5 file
parent
457bb620
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
requirements.txt
+2
-1
2 additions, 1 deletion
requirements.txt
user/sumlab_auto.py
+39
-10
39 additions, 10 deletions
user/sumlab_auto.py
with
41 additions
and
11 deletions
requirements.txt
+
2
−
1
View file @
963c0058
...
@@ -7,3 +7,4 @@ numpy
...
@@ -7,3 +7,4 @@ numpy
pandas
pandas
scipy
scipy
argparse
argparse
h5py
\ No newline at end of file
This diff is collapsed.
Click to expand it.
user/sumlab_auto.py
+
39
−
10
View file @
963c0058
...
@@ -2,10 +2,10 @@ import sys
...
@@ -2,10 +2,10 @@ import sys
import
os
import
os
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
from
PeakOTron
import
PeakOTron
from
PeakOTron
import
PeakOTron
import
pandas
as
pd
import
h5py
import
numpy
as
np
import
argparse
import
argparse
import
numpy
as
np
import
pandas
as
pd
def
float_or_none
(
value
):
def
float_or_none
(
value
):
return
None
if
value
.
lower
()
==
'
none
'
else
float
(
value
)
return
None
if
value
.
lower
()
==
'
none
'
else
float
(
value
)
...
@@ -69,13 +69,18 @@ print("=======================================\033[0m")
...
@@ -69,13 +69,18 @@ print("=======================================\033[0m")
# Loop thorough SORTED files in alphabetical order!
# Loop thorough SORTED files in alphabetical order!
files_to_fit
=
sorted
(
files_to_fit
,
key
=
lambda
x
:
x
[
0
])
files_to_fit
=
sorted
(
files_to_fit
,
key
=
lambda
x
:
x
[
0
])
G
=
[];
d_G
=
[];
G_prefit
=
[];
d_G_prefit
=
[]
V_bias
=
[]
for
i
,
(
file
,
path
)
in
enumerate
(
files_to_fit
):
for
i
,
(
file
,
path
)
in
enumerate
(
files_to_fit
):
V
=
float
(
file
.
split
(
'
deg
'
)[
1
].
split
(
'
V
'
)[
0
].
replace
(
'
_
'
,
'
.
'
))
V
=
float
(
file
.
split
(
'
deg
'
)[
1
].
split
(
'
V
'
)[
0
].
replace
(
'
_
'
,
'
.
'
))
if
'
ns
'
in
file
:
if
'
ns
'
in
file
:
t_gate
=
float
(
file
.
split
(
'
V
'
)[
1
].
split
(
'
ns
'
)[
0
].
replace
(
'
_
'
,
'
.
'
))
t_gate
=
float
(
file
.
split
(
'
V
'
)[
1
].
split
(
'
ns
'
)[
0
].
replace
(
'
_
'
,
'
.
'
))
print
(
f
"
Fitting:
\033
[95m
{
file
}
\033
[0m (t_gate =
{
t_gate
}
ns)
"
)
print
(
f
"
Fitting:
\033
[95m
{
file
}
\033
[0m (t_gate =
{
t_gate
}
ns)
"
)
#items = file.split('_')
#V = float(items[2].replace('V', '').replace('p', '.'))
# f_tau_hmt = f_tau(V, V_bd_hmt, V_0_hmt)
# f_tau_hmt = f_tau(V, V_bd_hmt, V_0_hmt)
V_bias
.
append
(
V
)
# Load files.
# Load files.
data
=
np
.
loadtxt
(
path
,
skiprows
=
0
)
data
=
np
.
loadtxt
(
path
,
skiprows
=
0
)
...
@@ -95,7 +100,8 @@ for i, (file, path) in enumerate(files_to_fit):
...
@@ -95,7 +100,8 @@ for i, (file, path) in enumerate(files_to_fit):
fit_out
=
{}
fit_out
=
{}
prefit_val
,
prefit_err
=
f_data
.
GetPrefitResults
(
bin_units
=
False
)
prefit_val
,
prefit_err
=
f_data
.
GetPrefitResults
(
bin_units
=
False
)
print
(
"
\033
[95m
"
+
rf
"
Prefit: G =
{
prefit_val
.
get
(
'
G
'
)
}
d_G =
{
prefit_err
.
get
(
'
G
'
)
}
"
+
"
\033
[0m
"
)
print
(
"
\033
[95m
"
+
rf
"
Prefit: G =
{
prefit_val
.
get
(
'
G
'
)
}
d_G =
{
prefit_err
.
get
(
'
G
'
)
}
"
+
"
\033
[0m
"
)
for
key
,
value
in
prefit_val
.
items
():
for
key
,
value
in
prefit_val
.
items
():
fit_out
[
"
prefit_{:s}
"
.
format
(
key
)]
=
value
fit_out
[
"
prefit_{:s}
"
.
format
(
key
)]
=
value
for
key
,
value
in
prefit_err
.
items
():
for
key
,
value
in
prefit_err
.
items
():
...
@@ -103,7 +109,8 @@ for i, (file, path) in enumerate(files_to_fit):
...
@@ -103,7 +109,8 @@ for i, (file, path) in enumerate(files_to_fit):
if
not
prefit_only
:
if
not
prefit_only
:
fit_val
,
fit_err
=
f_data
.
GetFitResults
(
bin_units
=
False
)
fit_val
,
fit_err
=
f_data
.
GetFitResults
(
bin_units
=
False
)
print
(
"
\033
[95m
"
+
rf
"
Fit: G =
{
fit_val
.
get
(
'
G
'
)
}
d_G =
{
fit_err
.
get
(
'
G
'
)
}
"
+
"
\033
[0m
"
)
print
(
"
\033
[95m
"
+
rf
"
Fit: G =
{
fit_val
.
get
(
'
G
'
)
}
d_G =
{
fit_err
.
get
(
'
G
'
)
}
"
+
"
\033
[0m
"
)
for
key
,
value
in
fit_val
.
items
():
for
key
,
value
in
fit_val
.
items
():
fit_out
[
"
{:s}
"
.
format
(
key
)]
=
value
fit_out
[
"
{:s}
"
.
format
(
key
)]
=
value
for
key
,
value
in
fit_err
.
items
():
for
key
,
value
in
fit_err
.
items
():
...
@@ -114,4 +121,26 @@ for i, (file, path) in enumerate(files_to_fit):
...
@@ -114,4 +121,26 @@ for i, (file, path) in enumerate(files_to_fit):
df
=
pd
.
DataFrame
.
from_dict
([
fit_out
])
df
=
pd
.
DataFrame
.
from_dict
([
fit_out
])
df
.
to_csv
(
"
{}/fit_results_{:s}.csv
"
.
format
(
folder
,
file
[:
-
4
]))
df
.
to_csv
(
"
{}/fit_results_{:s}.csv
"
.
format
(
folder
,
file
[:
-
4
]))
if
not
prefit_only
and
'
G
'
in
fit_out
and
'
d_G
'
in
fit_out
:
G
.
append
(
fit_out
[
'
G
'
])
d_G
.
append
(
fit_out
[
'
d_G
'
])
else
:
G
.
append
(
0
)
d_G
.
append
(
0
)
G_prefit
.
append
(
fit_out
[
'
prefit_G
'
])
d_G_prefit
.
append
(
fit_out
[
'
prefit_d_G
'
])
G
=
np
.
array
(
G
)
d_G
=
np
.
array
(
d_G
)
G_prefit
=
np
.
array
(
G_prefit
)
d_G_prefit
=
np
.
array
(
d_G_prefit
)
V_bias
=
np
.
array
(
V_bias
)
with
h5py
.
File
(
f
"
{
folder
}
/
{
os
.
path
.
basename
(
folder
)
}
.h5
"
,
'
w
'
)
as
f
:
f
.
create_dataset
(
'
G
'
,
data
=
G
)
f
.
create_dataset
(
'
d_G
'
,
data
=
d_G
)
f
.
create_dataset
(
'
G_prefit
'
,
data
=
G_prefit
)
f
.
create_dataset
(
'
d_G_prefit
'
,
data
=
d_G_prefit
)
f
.
create_dataset
(
'
V_bias
'
,
data
=
V_bias
)
print
(
"
\033
[95m=======================================
\033
[0m
"
)
print
(
"
\033
[95m=======================================
\033
[0m
"
)
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