Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Yu HU
hdf-viewer
Commits
34cc4d08
Commit
34cc4d08
authored
Feb 19, 2019
by
Eric Pellegrini
Browse files
added a script for running hdfviewer from command-line
updated setup.py file accordingly
parent
20fb1b32
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripts/run_hdfviewer
0 → 100644
View file @
34cc4d08
#!/usr/bin/env python3
import
nbformat
import
os
import
subprocess
import
sys
import
tempfile
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
!=
2
:
print
(
"Invalid number of arguments"
)
sys
.
exit
(
1
)
filename
=
sys
.
argv
[
1
]
if
not
os
.
path
.
isfile
(
filename
):
print
(
"The file {!r} does not exist"
.
format
(
filename
))
sys
.
exit
(
1
)
cells
=
[]
cells
.
append
(
"%matplotlib ipympl"
)
cells
.
append
(
"""from hdfviewer.widgets.HDFViewer import HDFViewerWidget"""
)
cells
.
append
(
"""widget = HDFViewerWidget({!r})
display(widget)"""
.
format
(
filename
))
notebook
=
nbformat
.
v4
.
new_notebook
(
metadata
=
{
'language'
:
'python'
,})
notebook
[
"cells"
]
=
[
nbformat
.
v4
.
new_code_cell
(
cell
)
for
cell
in
cells
]
notebookFilename
=
tempfile
.
mktemp
(
suffix
=
".ipynb"
)
with
open
(
notebookFilename
,
"w"
)
as
f
:
nbformat
.
write
(
notebook
,
f
,
4
)
subprocess
.
Popen
([
"jupyter-lab"
,
notebookFilename
])
setup.py
View file @
34cc4d08
...
...
@@ -48,4 +48,5 @@ setup(name = name,
install_requires
=
[
"numpy"
,
"matplotlib"
,
"h5py"
,
"jupyterlab"
,
"ipywidgets"
,
"ipympl"
],
cmdclass
=
cmdclass
,
command_options
=
command_options
,
scripts
=
[
"scripts/run_hdfviewer"
]
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment