Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
35
Issue boards
Milestones
Wiki
Code
Merge requests
7
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
66da1516
Commit
66da1516
authored
3 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Plain Diff
Merge branch 'plotInHistory' into cookBux
parents
3a869a80
02c51568
No related branches found
Branches containing commit
No related tags found
Tags containing commit
7 merge requests
!685
Release 2.4
,
!684
Release 2.4
,
!567
Release 2.2.1
,
!566
Release 2.2
,
!501
Release 2.1
,
!372
fix doctest snippets
,
!369
Current documentation
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
saqc/core/modules/tools.py
+2
-0
2 additions, 0 deletions
saqc/core/modules/tools.py
saqc/funcs/tools.py
+16
-28
16 additions, 28 deletions
saqc/funcs/tools.py
saqc/lib/plotting.py
+14
-3
14 additions, 3 deletions
saqc/lib/plotting.py
with
32 additions
and
31 deletions
saqc/core/modules/tools.py
+
2
−
0
View file @
66da1516
...
...
@@ -6,6 +6,7 @@ from typing import Optional
from
typing_extensions
import
Literal
import
saqc
import
numpy
as
np
from
saqc.lib.types
import
FreqString
from
saqc.core.modules.base
import
ModuleBase
...
...
@@ -42,6 +43,7 @@ class Tools(ModuleBase):
xscope
:
Optional
[
slice
]
=
None
,
stats_dict
:
Optional
[
dict
]
=
None
,
store_kwargs
:
Optional
[
dict
]
=
None
,
to_mask
:
Optional
[
float
]
=
np
.
inf
,
**
kwargs
,
)
->
saqc
.
SaQC
:
return
self
.
defer
(
"
plot
"
,
locals
())
This diff is collapsed.
Click to expand it.
saqc/funcs/tools.py
+
16
−
28
View file @
66da1516
...
...
@@ -16,6 +16,7 @@ from saqc.lib.types import FreqString
from
saqc.core
import
processing
,
Flags
from
saqc.lib.tools
import
periodicMask
from
saqc.lib.plotting
import
makeFig
from
saqc.core.register
import
_maskData
_MPL_DEFAULT_BACKEND
=
mpl
.
get_backend
()
...
...
@@ -252,18 +253,19 @@ def plot(
path
:
Optional
[
str
]
=
None
,
max_gap
:
Optional
[
FreqString
]
=
None
,
stats
:
bool
=
False
,
history
:
Optional
[
Literal
[
"
valid
"
,
"
complete
"
]]
=
"
valid
"
,
history
:
Optional
[
Literal
[
"
valid
"
,
"
complete
"
,
"
clear
"
]]
=
"
valid
"
,
xscope
:
Optional
[
slice
]
=
None
,
stats_dict
:
Optional
[
dict
]
=
None
,
store_kwargs
:
Optional
[
dict
]
=
None
,
to_mask
:
Optional
[
float
]
=
np
.
inf
,
**
kwargs
,
):
"""
Stores or shows a figure object, containing data graph with flag marks for field.
There are two modes,
'
interactive
'
and
'
store
'
mode
, wich
is
determind
via
the
There are two modes,
'
interactive
'
and
'
store
'
, w
h
ich
are
determind
through
the
``save_path`` keyword. In interactive mode (default) the plot is shown at runtime
and the execution stops until the plot window is closed manually
by a user
. In
and the
program
execution stops until the plot window is closed manually. In
store mode the generated plot is stored to disk and no manually interaction is
needed.
...
...
@@ -287,7 +289,7 @@ def plot(
max_gap : str, default None
If None, all the points in the data will be connected, resulting in long linear
lines, where continous chunks of data is missing. Nans in the data get dropped
before plotting. If an
O
ffset string is passed, only points that have a distance
before plotting. If an
o
ffset string is passed, only points that have a distance
below `max_gap` get connected via the plotting line.
stats : bool, default False
...
...
@@ -298,34 +300,13 @@ def plot(
*
"
valid
"
- Only plot those flags, that do not get altered or
"
unflagged
"
by subsequent tests. Only list tests
in the legend, that actually contributed flags to the overall resault.
*
"
complete
"
- plot all the flags set and list all the tests ran on a variable. Suitable for debugging/tracking.
*
"
clear
"
- clear plot from all the flagged values
* None - just plot the resulting flags for one variable, without any historical meta information.
s
: slice or Offset, default None
xscope
: slice or Offset, default None
Parameter, that determines a chunk of the data to be plotted /
processed. `s` can be anything, that is a valid argument to the ``pandas.Series.__getitem__`` method.
ax_kwargs : dict, default None
ax_kwargs : dict, default None
Keyword arguments controlling plot generation. Will be passed on to the
``Matplotlib.axes.Axes.set()`` property batch setter for the axes showing the
data plot. The most relevant of those properties might be
"
ylabel
"
,
"
title
"
and in addition:
"
ylim
"
.
The
"
xlim
"
keyword can be passed a slice object with date offset entries to controll figure
scope.
fig_kwargs : dict, default None
Keyword arguments controlling figure generation. In interactive mode,
``None`` defaults to ``{
"
figsize
"
: (16, 9)}`` to ensure a proper figure size
in store-mode.
scatter_kwargs : dict, default None
Keyword arguments controlling the appearance of the dots, marking flagged values.
Dict just gets passed on to the matplotlib.pyplot.scatter method. Keywords of interest may be:
``
"
alpha
"
`` (transparancy), ``
"
marker
"
`` (marker appearance) and ``
"
s
"
`` (dot size).
The ``
"
marker
"
`` and ``
"
color
"
`` keywords can also be passed lists, that the plotting routine will then cycle
through.
store_kwargs : dict, default {}
Keywords to be passed on to the ``matplotlib.pyplot.savefig`` method, handling
the figure storing. To store an pickle object of the figure, use the option
...
...
@@ -363,6 +344,13 @@ def plot(
>>>
func
=
lambda
x
,
y
,
z
:
round
((
x
.
isna
().
sum
())
/
len
(
x
),
2
)
"""
interactive
=
path
is
None
level
=
kwargs
.
get
(
"
flag
"
,
BAD
)
if
to_mask
<
np
.
inf
:
data
=
data
.
copy
()
data
.
loc
[
flags
[
field
]
>=
to_mask
,
field
]
=
np
.
nan
if
level
<=
to_mask
:
history
=
None
if
store_kwargs
is
None
:
store_kwargs
=
{}
...
...
@@ -377,7 +365,7 @@ def plot(
data
=
data
,
field
=
field
,
flags
=
flags
,
level
=
kwargs
.
get
(
"
flag
"
,
BAD
)
,
level
=
level
,
max_gap
=
max_gap
,
stats
=
stats
,
history
=
history
,
...
...
This diff is collapsed.
Click to expand it.
saqc/lib/plotting.py
+
14
−
3
View file @
66da1516
...
...
@@ -23,8 +23,7 @@ STATSDICT = {
"
flagged percentage
"
:
lambda
x
,
y
,
z
:
round
(((
y
>=
z
).
sum
())
/
len
(
x
),
2
),
}
PLOT_KWARGS
=
{
"
alpha
"
:
0.8
,
"
linewidth
"
:
1
}
PLOT_KWARGS
=
{
"
alpha
"
:
0.8
,
"
linewidth
"
:
1
}
AX_KWARGS
=
{}
FIG_KWARGS
=
{
"
figsize
"
:
(
16
,
9
)}
SCATTER_KWARGS
=
{
...
...
@@ -36,6 +35,7 @@ SCATTER_KWARGS = {
"
s
"
:
70
,
}
def
makeFig
(
data
:
DiosLikeT
,
field
:
str
,
...
...
@@ -73,7 +73,18 @@ def makeFig(
stats : bool, default False
Whether to include statistics table in plot.
xscope :
history : {
"
valid
"
,
"
complete
"
, None}, default
"
valid
"
Discriminate the plotted flags with respect to the tests they originate from.
*
"
valid
"
- Only plot those flags, that do not get altered or
"
unflagged
"
by subsequent tests. Only list tests
in the legend, that actually contributed flags to the overall resault.
*
"
complete
"
- plot all the flags set and list all the tests ran on a variable. Suitable for debugging/tracking.
*
"
clear
"
- clear plot from all the flagged values
* None - just plot the resulting flags for one variable, without any historical meta information.
xscope : slice or Offset, default None
Parameter, that determines a chunk of the data to be plotted /
processed. `s` can be anything, that is a valid argument to the ``pandas.Series.__getitem__`` method.
stats_dict: dict, default None
(Only relevant if `stats`=True).
...
...
This diff is collapsed.
Click to expand it.
David Schäfer
@schaefed
mentioned in commit
63b55c6d
·
2 years ago
mentioned in commit
63b55c6d
mentioned in commit 63b55c6d7dadb0e612b23a897f292d5ffc14cb52
Toggle commit list
David Schäfer
@schaefed
mentioned in commit
684dc8a0
·
2 years ago
mentioned in commit
684dc8a0
mentioned in commit 684dc8a0515470d644fc85fee95d07661c8dd572
Toggle commit list
David Schäfer
@schaefed
mentioned in commit
8f7a90e4
·
1 year ago
mentioned in commit
8f7a90e4
mentioned in commit 8f7a90e4aed61c79a9dc8d67541a46beba0907e8
Toggle commit list
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