FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PDAF/tutorial/plotting/plot_file.py at master · PDAF/PDAF · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
PDAF
/
PDAF
Public
Notifications
You must be signed in to change notification settings
Fork
19
Star
49
Code
Issues
0
Pull requests
0
Discussions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PDAF
/
tutorial
/
plotting
/
plot_file.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
27 lines (22 loc) · 684 Bytes
Breadcrumbs
PDAF
/
tutorial
/
plotting
/
plot_file.py
Copy path
File metadata and controls
executable file
·
27 lines (22 loc) · 684 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
# A script to plot the 2D field from the online_2D_serialmodel tutorial.
# Requires Python 3, Matplotlib and Numpy.
# Usage: ./plot_field.py <filename>
import
matplotlib
.
pyplot
as
plt
import
numpy
as
np
import
argparse
as
ap
def
read_and_plot
(
filename
):
field
=
np
.
loadtxt
(
filename
)
field
=
field
.
reshape
(
18
,
36
)
plt
.
imshow
(
field
,
origin
=
'lower'
,
interpolation
=
'none'
)
plt
.
title
(
filename
)
plt
.
colorbar
()
plt
.
show
()
if
__name__
==
"__main__"
:
parser
=
ap
.
ArgumentParser
()
parser
.
add_argument
(
'filename'
)
args
=
parser
.
parse_args
()
try
:
read_and_plot
(
args
.
filename
)
except
OSError
as
err
:
print
(
err
)
Back
|
FazBrowse Home
|
New Git URL