Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
afab4fc3
Commit
afab4fc3
authored
1 year ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Consistently use list arguments for select_ & require_ methods
parent
674ffe18
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!885
Revised CalCat API
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/calcat_interface2.py
+6
-6
6 additions, 6 deletions
src/cal_tools/calcat_interface2.py
with
6 additions
and
6 deletions
src/cal_tools/calcat_interface2.py
+
6
−
6
View file @
afab4fc3
...
...
@@ -83,7 +83,7 @@ class ModulesConstantVersions:
constants
:
Dict
[
str
,
SingleConstantVersion
]
# Keys e.g. 'LPD00'
def
select_modules
(
self
,
*
aggregators
)
->
"
ModulesConstantVersions
"
:
def
select_modules
(
self
,
aggregators
)
->
"
ModulesConstantVersions
"
:
d
=
{
aggr
:
scv
for
(
aggr
,
scv
)
in
self
.
constants
.
items
()
if
aggr
in
aggregators
}
return
ModulesConstantVersions
(
d
)
...
...
@@ -173,7 +173,7 @@ class CalibrationData(Mapping):
res
=
cls
(
d
,
modules
)
if
modules
:
res
=
res
.
select_modules
(
*
modules
)
res
=
res
.
select_modules
(
modules
)
return
res
@classmethod
...
...
@@ -227,14 +227,14 @@ class CalibrationData(Mapping):
def
qm_names
(
self
):
return
[
module_index_to_qm
(
n
)
for
n
in
self
.
module_nums
]
def
require_calibrations
(
self
,
*
calibrations
):
def
require_calibrations
(
self
,
calibrations
):
"""
Drop any modules missing the specified constant types
"""
mods
=
set
(
self
.
aggregators
)
for
cal_type
in
calibrations
:
mods
.
intersection_update
(
self
[
cal_type
].
constants
)
return
self
.
select_modules
(
mods
)
def
select_calibrations
(
self
,
*
calibrations
,
require_all
=
True
):
def
select_calibrations
(
self
,
calibrations
,
require_all
=
True
):
if
require_all
:
missing
=
set
(
calibrations
)
-
set
(
self
.
constant_groups
)
if
missing
:
...
...
@@ -248,9 +248,9 @@ class CalibrationData(Mapping):
# TODO: missing for some modules?
return
type
(
self
)(
d
,
self
.
aggregators
)
def
select_modules
(
self
,
*
aggregators
):
def
select_modules
(
self
,
aggregators
):
return
type
(
self
)({
cal_type
:
mcv
.
select_modules
(
*
aggregators
).
constants
cal_type
:
mcv
.
select_modules
(
aggregators
).
constants
for
(
cal_type
,
mcv
)
in
self
.
constant_groups
.
items
()
},
sorted
(
aggregators
))
...
...
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