Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GPLT - a general plotter script in Python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STEVAN Antoine
GPLT - a general plotter script in Python
Commits
efe479ce
Unverified
Commit
efe479ce
authored
May 15, 2024
by
STEVAN Antoine
Browse files
Options
Downloads
Patches
Plain Diff
add a bit more logging
parent
e40fe7d7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/log.py
+4
-0
4 additions, 0 deletions
src/log.py
src/plot.py
+9
-2
9 additions, 2 deletions
src/plot.py
with
13 additions
and
2 deletions
src/log.py
+
4
−
0
View file @
efe479ce
...
...
@@ -32,3 +32,7 @@ def info(msg: str):
def
warning
(
msg
:
str
):
print
(
f
"
[bold yellow]WARNING[/bold yellow]:
{
msg
}
"
)
def
debug
(
msg
:
str
):
print
(
f
"
[bold green]DEBUG[/bold green]:
{
msg
}
"
)
This diff is collapsed.
Click to expand it.
src/plot.py
+
9
−
2
View file @
efe479ce
...
...
@@ -8,7 +8,7 @@ import shutil
from
itertools
import
zip_longest
from
error
import
GPLTError
from
log
import
panic
,
warning
from
log
import
panic
,
warning
,
debug
,
info
from
typing
import
Any
,
Dict
,
List
,
Optional
,
Tuple
,
TypedDict
...
...
@@ -196,6 +196,7 @@ def _plot_single(g: Graph, i: int, ax: matplotlib.axes.Axes) -> matplotlib.lines
line
=
ax
.
plot
(
xs
,
ys
,
label
=
g
.
get
(
"
name
"
,
None
),
**
line_style
)[
0
]
if
len
(
es
)
!=
0
:
debug
(
f
"
adding errors to graph
{
name
}
"
)
ys
,
es
=
np
.
array
(
ys
),
np
.
array
(
es
)
down
=
ys
-
es
up
=
ys
+
es
...
...
@@ -228,6 +229,8 @@ def _check_class_fields(
def
check
(
graphs
:
Any
):
info
(
f
"
checking graphs
"
)
if
not
isinstance
(
graphs
,
list
):
panic
(
GPLTError
.
INVALID_ARGUMENTS
,
...
...
@@ -238,6 +241,7 @@ def check(graphs: Any):
required_point_fields
=
__get_class_fields
(
Point
)
for
i
,
g
in
enumerate
(
graphs
):
debug
(
f
"
checking graph
{
i
}
"
)
if
not
isinstance
(
g
,
dict
):
panic
(
GPLTError
.
INVALID_ARGUMENTS
,
...
...
@@ -254,7 +258,7 @@ def check(graphs: Any):
)
# TODO: check style
warning
(
f
"
the style of graph
{
name
}
won
'
t be checked
"
)
info
(
f
"
the style of graph
{
name
}
won
'
t be checked
"
)
# see [`HELP`]
...
...
@@ -299,9 +303,12 @@ def plot(
legends
=
{}
for
i
,
g
in
enumerate
(
graphs
):
info
(
f
"
plotting graph
{
i
}
"
)
line
=
_plot_single
(
g
,
i
,
ax
)
legend
=
g
.
get
(
"
legend
"
,
None
)
if
legend
is
not
None
:
debug
(
f
"
adding legend of graph
{
i
}
"
)
if
legend
not
in
legends
:
legends
[
legend
]
=
[]
legends
[
legend
]
+=
[
line
]
...
...
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