Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dayabay-model
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
dayabay-data-preservation
dayabay-model
Commits
b4214219
Commit
b4214219
authored
2 years ago
by
Maxim Gonchar
Browse files
Options
Downloads
Patches
Plain Diff
chore: update parameters location
parent
d0a989e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/dayabay_v0.py
+24
-14
24 additions, 14 deletions
models/dayabay_v0.py
with
24 additions
and
14 deletions
models/dayabay_v0.py
+
24
−
14
View file @
b4214219
...
...
@@ -2,6 +2,7 @@ from dagflow.bundles.load_parameters import load_parameters
from
multikeydict.nestedmkdict
import
NestedMKDict
from
pathlib
import
Path
from
typing
import
Union
,
Tuple
,
List
,
Optional
from
pandas
import
DataFrame
class
ParametersWrapper
(
NestedMKDict
):
def
to_dict
(
self
,
**
kwargs
)
->
list
:
...
...
@@ -14,29 +15,38 @@ class ParametersWrapper(NestedMKDict):
return
data
def
to_df
(
self
,
**
kwargs
)
->
DataFrame
:
def
to_df
(
self
,
*
,
columns
:
Optional
[
List
[
str
]]
=
None
,
**
kwargs
)
->
DataFrame
:
dct
=
self
.
to_dict
(
**
kwargs
)
columns
=
(
'
path
'
,
'
value
'
,
'
label
'
)
if
columns
is
None
:
columns
=
[
'
path
'
,
'
value
'
,
'
central
'
,
'
sigma
'
,
'
normvalue
'
,
'
label
'
]
df
=
DataFrame
(
dct
,
columns
=
columns
)
return
df
def
to_latex
(
self
)
->
str
:
df
=
self
.
to_df
(
label_from
=
'
latex
'
)
return
df
.
to_latex
(
escape
=
False
)
def
to_latex
(
self
,
*
,
return_df
:
bool
=
False
,
**
kwargs
)
->
Union
[
str
,
Tuple
[
str
,
DataFrame
]]:
df
=
self
.
to_df
(
label_from
=
'
latex
'
,
**
kwargs
)
tex
=
df
.
to_latex
(
escape
=
False
)
if
return_df
:
return
tex
,
df
return
tex
def
model_dayabay_v0
():
storage
=
ParametersWrapper
({},
sep
=
'
.
'
)
datasource
=
Path
(
'
data/dayabay-v0
'
)
storage
|=
load_parameters
({
'
path
'
:
'
ibd
'
,
'
load
'
:
datasource
/
'
parameters/pdg2012.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
detector
'
,
'
load
'
:
datasource
/
'
parameters/detector_nprotons_correction.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
reactor
'
,
'
load
'
:
datasource
/
'
parameters/reactor_thermal_power_nominal.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
reactor
'
,
'
load
'
:
datasource
/
'
parameters/detector_eres.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
ibd
'
,
'
load
'
:
datasource
/
'
parameters/pdg2012.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
detector
'
,
'
load
'
:
datasource
/
'
parameters/detector_nprotons_correction.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
reactor
'
,
'
load
'
:
datasource
/
'
parameters/reactor_thermal_power_nominal.yaml
'
})
storage
|=
load_parameters
({
'
path
'
:
'
reactor
'
,
'
load
'
:
datasource
/
'
parameters/detector_eres.yaml
'
})
# from pprint import pprint
# pprint(storage.object, sort_dicts=False)
print
(
storage
[
'
parameter_node
'
].
to_df
())
from
pprint
import
pprint
pprint
(
storage
.
object
,
sort_dicts
=
False
)
print
(
storage
[
'
parameter
'
].
to_df
())
df
=
storage
[
'
constants
'
].
to_df
()
print
(
df
)
print
(
storage
[
'
parameter
'
].
to_latex
())
tex
=
storage
[
'
constant
s
'
].
to_latex
()
tex
=
storage
[
'
parameter.
constant
'
].
to_latex
(
columns
=
[
'
path
'
,
'
value
'
,
'
label
'
]
)
print
(
tex
)
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