Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lukas Weber
load_leveller
Commits
c9d9085d
Commit
c9d9085d
authored
Apr 08, 2019
by
Lukas Weber
Browse files
rename conditions to filter
parent
625083ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
python/loadleveller/mcextract.py
View file @
c9d9085d
...
...
@@ -50,24 +50,24 @@ class MCArchive:
o
.
mean
[
i
,:]
=
value
[
'mean'
]
o
.
error
[
i
,:]
=
value
[
'error'
]
def
condition
_mask
(
self
,
conditions
):
if
not
conditions
:
def
filter
_mask
(
self
,
filter
):
if
not
filter
:
return
[
True
for
_
in
range
(
self
.
num_tasks
)]
return
[
all
(
self
.
parameters
[
key
][
i
]
==
val
for
key
,
val
in
conditions
.
items
())
for
i
in
range
(
self
.
num_tasks
)]
return
[
all
(
self
.
parameters
[
key
][
i
]
==
val
for
key
,
val
in
filter
.
items
())
for
i
in
range
(
self
.
num_tasks
)]
def
get_parameter
(
self
,
name
,
unique
=
False
,
conditions
=
{}):
selection
=
list
(
itertools
.
compress
(
self
.
parameters
[
name
],
self
.
condition_mask
(
conditions
)))
def
get_parameter
(
self
,
name
,
unique
=
False
,
filter
=
{}):
selection
=
list
(
itertools
.
compress
(
self
.
parameters
[
name
],
self
.
filter_mask
(
filter
)))
if
unique
:
return
list
(
sorted
(
set
(
selection
)))
return
selection
def
get_observable
(
self
,
name
,
conditions
=
{}):
def
get_observable
(
self
,
name
,
filter
=
{}):
orig
=
self
.
observables
[
name
]
selection
=
Observable
(
0
)
mask
=
self
.
condition_mask
(
conditions
)
mask
=
self
.
filter_mask
(
filter
)
selection
.
rebinning_bin_count
=
orig
.
rebinning_bin_count
[
mask
]
selection
.
rebinning_bin_length
=
orig
.
rebinning_bin_length
[
mask
]
selection
.
autocorrelation_time
=
orig
.
autocorrelation_time
[
mask
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment