Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
amfe
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
Aerospace and Mechanical Engineering
amfe
Commits
bed0e7b8
Commit
bed0e7b8
authored
2 years ago
by
Adrien Crovato
Browse files
Options
Downloads
Patches
Plain Diff
Add arguments to tbox plot util
parent
fab1af11
Branches
feat_amgcl
No related tags found
1 merge request
!6
amfe v1.0.5
Pipeline
#8615
passed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tbox/utils.py
+18
-20
18 additions, 20 deletions
tbox/utils.py
with
18 additions
and
20 deletions
tbox/utils.py
+
18
−
20
View file @
bed0e7b8
...
...
@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
# Copyright 2020 University of Liège
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
@@ -23,7 +23,6 @@ Adrien Crovato
def
myrange
(
start
,
stop
,
step
):
"""
Extended range with custom step
Adrien Crovato
"""
vec
=
[]
i
=
start
...
...
@@ -32,33 +31,34 @@ def myrange(start, stop, step):
i
+=
step
return
vec
def
plot
(
x
,
y
,
xlbl
,
ylbl
,
title
,
invert
=
False
):
def
plot
(
x
,
y
,
cfg
):
"""
Plot using matplotlib
Adrien Crovato
@todo extend to pass unlimited number of arguments
"""
from
fwk.wutils
import
parseargs
args
=
parseargs
()
if
not
args
.
nogui
:
import
matplotlib.pyplot
as
plt
# define font
font
=
{
'
family
'
:
'
serif
'
,
'
color
'
:
'
darkred
'
,
'
weight
'
:
'
normal
'
,
'
size
'
:
16
,}
font
=
{
'
family
'
:
'
serif
'
,
'
color
'
:
'
darkred
'
,
'
weight
'
:
'
normal
'
,
'
size
'
:
16
}
# plot results
plt
.
plot
(
x
,
y
,
'
b-
'
,
lw
=
2
)
plt
.
xlabel
(
xlbl
,
fontdict
=
font
)
plt
.
ylabel
(
ylbl
,
fontdict
=
font
)
plt
.
title
(
title
,
fontdict
=
font
)
if
invert
:
plt
.
plot
(
x
,
y
,
'
b-
'
,
lw
=
2
)
if
'
xlabel
'
in
cfg
:
plt
.
xlabel
(
cfg
[
'
xlabel
'
],
fontdict
=
font
)
if
'
ylabel
'
in
cfg
:
plt
.
ylabel
(
cfg
[
'
ylabel
'
],
fontdict
=
font
)
if
'
title
'
in
cfg
:
plt
.
title
(
cfg
[
'
title
'
],
fontdict
=
font
)
if
'
xlim
'
in
cfg
:
plt
.
xlim
(
cfg
[
'
xlim
'
])
if
'
ylim
'
in
cfg
:
plt
.
ylim
(
cfg
[
'
ylim
'
])
if
'
invert
'
in
cfg
and
cfg
[
'
invert
'
]:
plt
.
gca
().
invert_yaxis
()
#
plt.grid(True)
#
display
plt
.
show
()
def
sort
(
id
,
data
):
"""
Sort data array against id (line connectivity list)
Adrien Crovato
"""
import
numpy
as
np
# sort id vector
...
...
@@ -76,7 +76,6 @@ def sort(id, data):
def
read
(
filename
):
"""
Read from file and store in data array
Adrien Croavto
"""
import
io
import
numpy
as
np
...
...
@@ -89,7 +88,6 @@ def read(filename):
def
write
(
data
,
name
,
frmt
,
dlm
,
hdr
,
cmts
):
"""
Write data array to file
Adrien Crovato
"""
import
numpy
as
np
print
(
'
writing data file
'
+
name
+
'
.
'
)
...
...
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