Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
57e74979
You need to sign in or sign up before continuing.
Commit
57e74979
authored
5 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
simplified evaluator
parent
14295d58
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
dsl/evaluator.py
+13
-26
13 additions, 26 deletions
dsl/evaluator.py
with
13 additions
and
26 deletions
dsl/evaluator.py
+
13
−
26
View file @
57e74979
...
@@ -110,34 +110,21 @@ def evalExpression(expr: str, flagger: BaseFlagger,
...
@@ -110,34 +110,21 @@ def evalExpression(expr: str, flagger: BaseFlagger,
fcols
=
fidx
.
values
fcols
=
fidx
.
values
dcols
=
namespace
[
"
data
"
].
columns
.
values
dcols
=
namespace
[
"
data
"
].
columns
.
values
if
namespace
.
get
(
"
target
"
)
==
"
flags
"
:
try
:
# We are forced to work on flags
if
field
in
fcols
:
if
field
in
fcols
:
out
=
namespace
[
"
flags
"
][
field
]
flagcol
=
namespace
[
"
flags
"
][
field
]
elif
field
in
dcols
:
out
=
flagcol
# Up to now there are no flagging information on the requested
# field, so return a fresh new unflagged vector
datacol
=
namespace
[
"
data
"
][
field
]
dummy
=
pd
.
DataFrame
(
index
=
datacol
.
index
,
columns
=
[
field
])
out
=
flagger
.
initFlags
(
dummy
)
else
:
_raiseNameError
(
field
,
expr
)
elif
field
in
dcols
and
field
in
fcols
:
# Return all unflagged (original) data
datacol
=
namespace
[
"
data
"
][
field
]
flagcol
=
namespace
[
"
flags
"
][
field
]
out
=
np
.
ma
.
masked_array
(
datacol
,
mask
=
flagger
.
isFlagged
(
flagcol
))
elif
field
in
dcols
and
field
not
in
fcols
:
# Return all data, because we have no flagging information
out
=
namespace
[
"
data
"
][
field
].
values
elif
field
not
in
dcols
and
field
in
fcols
:
# Return only flag information, because we have no data
out
=
namespace
[
"
flags
"
][
field
].
values
else
:
if
namespace
.
get
(
"
target
"
)
!=
"
flags
"
:
if
field
in
dcols
:
datacol
=
namespace
[
"
data
"
][
field
]
out
=
datacol
if
field
in
dcols
and
field
in
fcols
:
out
=
np
.
ma
.
masked_array
(
datacol
,
mask
=
flagger
.
isFlagged
(
flagcol
))
except
KeyError
:
_raiseNameError
(
field
,
expr
)
_raiseNameError
(
field
,
expr
)
return
out
return
out
...
...
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