Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pygwinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gwinc
pygwinc
Commits
1b2462cd
Commit
1b2462cd
authored
4 years ago
by
Jameson Rollins
Browse files
Options
Downloads
Patches
Plain Diff
cli: tweaks to interactive mode
allow use of --no-plot option with interactive mode, and improve banner and docs.
parent
3462a97d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#128483
passed
4 years ago
Stage: dist
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+17
-0
17 additions, 0 deletions
README.md
gwinc/__main__.py
+23
-12
23 additions, 12 deletions
gwinc/__main__.py
with
40 additions
and
12 deletions
README.md
+
17
−
0
View file @
1b2462cd
...
...
@@ -83,6 +83,23 @@ the path to the budget module/package:
$
python3
-m
gwinc path/to/mybudget
```
The command line interface also includes an "interactive" mode which
provides an
[
IPython
](
https://ipython.org/
)
shell for interacting with a processed budget:
```
shell
$
python3
-m
gwinc
-i
Aplus
GWINC interactive shell
The
'ifo'
Struct and
'traces'
data are available
for
inspection.
Use the
'whos'
command
to view the workspace.
You may interact with the plot using the
'plt'
functions, e.g.:
In
[
.]: plt.title
(
"foo"
)
In
[
.]: plt.savefig
(
"foo.pdf"
)
In
[
1]:
```
See command help for more info:
```
shell
$
python3
-m
gwinc
-h
...
...
This diff is collapsed.
Click to expand it.
gwinc/__main__.py
+
23
−
12
View file @
1b2462cd
...
...
@@ -74,7 +74,7 @@ parser.add_argument(
group
=
parser
.
add_mutually_exclusive_group
()
group
.
add_argument
(
'
--interactive
'
,
'
-i
'
,
action
=
'
store_true
'
,
help
=
"
interactive
plot
with
interactive shell
"
)
help
=
"
launch
interactive
shell
with
plotting capability after budget processing
"
)
group
.
add_argument
(
'
--save
'
,
'
-s
'
,
action
=
'
append
'
,
help
=
"
save plot (.png/.pdf/.svg) or budget traces (.hdf5/.h5) to file (may be specified multiple times)
"
)
...
...
@@ -87,7 +87,7 @@ group.add_argument(
group
.
add_argument
(
'
--diff
'
,
'
-d
'
,
metavar
=
'
IFO
'
,
help
=
"
show differences table between another IFO description and exit (budget not calculated)
"
)
group
.
add_argument
(
parser
.
add_argument
(
'
--no-plot
'
,
'
-np
'
,
action
=
'
store_false
'
,
dest
=
'
plot
'
,
help
=
"
supress plotting
"
)
parser
.
add_argument
(
...
...
@@ -247,16 +247,26 @@ def main():
# interactive shell plotting
if
args
.
interactive
:
from
IPython.terminal.embed
import
InteractiveShellEmbed
ipshell
=
InteractiveShellEmbed
(
banner1
=
'''
GWINC interactive plotter
banner
=
"""
GWINC interactive shell
The
'
ifo
'
Struct and
'
traces
'
data are available for inspection.
Use the
'
whos
'
command to view the workspace.
"""
if
not
args
.
plot
:
banner
+=
"""
You may plot the budget using the
'
plot_noise()
'
function:
You may interact with plot using
"
plt.
"
methods, e.g.:
In [.]: plot_noise(freq, traces, **plot_style)
"""
banner
+=
"""
You may interact with the plot using the
'
plt
'
functions, e.g.:
>>>
plt
.
title
(
"
foo
"
)
>>>
plt
.
savefig
(
"
foo.pdf
"
)
'''
,
In [.]: plt.title(
"
foo
"
)
In [.]: plt.savefig(
"
foo.pdf
"
)
"""
from
IPython.terminal.embed
import
InteractiveShellEmbed
ipshell
=
InteractiveShellEmbed
(
banner1
=
banner
,
user_ns
=
{
'
freq
'
:
freq
,
'
traces
'
:
traces
,
...
...
@@ -266,8 +276,9 @@ You may interact with plot using "plt." methods, e.g.:
},
)
ipshell
.
enable_pylab
()
ipshell
.
ex
(
"
fig = plot_noise(freq, traces, **plot_style)
"
)
ipshell
.
ex
(
"
plt.title(
'
{}
'
)
"
.
format
(
plot_style
[
'
title
'
]))
if
args
.
plot
:
ipshell
.
ex
(
"
fig = plot_noise(freq, traces, **plot_style)
"
)
ipshell
.
ex
(
"
plt.title(
'
{}
'
)
"
.
format
(
plot_style
[
'
title
'
]))
ipshell
()
##########
...
...
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