Skip to content
Snippets Groups Projects
Commit 626b6ff0 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

cli: fix interactive mode

At some point this mode stopped producing plots.  This fixes that by
updating the code execution call to InteractiveShellEmbed.

Also only imports ipython opportunistically, so it's not a hard dependency.
parent 1544b114
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !84. Comments created here will be created in the context of that merge request.
...@@ -27,7 +27,7 @@ gwinc/base: ...@@ -27,7 +27,7 @@ gwinc/base:
cat <<EOF > Dockerfile cat <<EOF > Dockerfile
FROM igwn/base:buster FROM igwn/base:buster
RUN apt-get update -qq RUN apt-get update -qq
RUN apt-get -y install --no-install-recommends git python3-gitlab python3 python3-yaml python3-scipy python3-matplotlib python3-ipython python3-lalsimulation python3-pypdf2 python3-h5py RUN apt-get -y install --no-install-recommends git python3-gitlab python3 python3-yaml python3-scipy python3-matplotlib python3-lalsimulation python3-pypdf2 python3-h5py
RUN git clone https://gitlab-ci-token:ci_token@git.ligo.org/gwinc/inspiral_range.git RUN git clone https://gitlab-ci-token:ci_token@git.ligo.org/gwinc/inspiral_range.git
EOF EOF
- docker build -t $IMAGE_TAG . - docker build -t $IMAGE_TAG .
......
...@@ -3,7 +3,6 @@ import os ...@@ -3,7 +3,6 @@ import os
import signal import signal
import argparse import argparse
import numpy as np import numpy as np
from IPython.terminal.embed import InteractiveShellEmbed
import logging import logging
logging.basicConfig( logging.basicConfig(
...@@ -247,14 +246,8 @@ def main(): ...@@ -247,14 +246,8 @@ def main():
# interactive shell plotting # interactive shell plotting
if args.interactive: if args.interactive:
from IPython.terminal.embed import InteractiveShellEmbed
ipshell = InteractiveShellEmbed( ipshell = InteractiveShellEmbed(
user_ns={
'freq': freq,
'traces': traces,
'ifo': ifo,
'plot_style': plot_style,
'plot_noise': plot_noise,
},
banner1=''' banner1='''
GWINC interactive plotter GWINC interactive plotter
...@@ -262,10 +255,18 @@ You may interact with plot using "plt." methods, e.g.: ...@@ -262,10 +255,18 @@ You may interact with plot using "plt." methods, e.g.:
>>> plt.title("foo") >>> plt.title("foo")
>>> plt.savefig("foo.pdf") >>> plt.savefig("foo.pdf")
''') ''',
user_ns={
'freq': freq,
'traces': traces,
'ifo': ifo,
'plot_style': plot_style,
'plot_noise': plot_noise,
},
)
ipshell.enable_pylab() ipshell.enable_pylab()
ipshell.run_code("plot_noise(freq, traces, **plot_style)") ipshell.ex("fig = plot_noise(freq, traces, **plot_style)")
ipshell.run_code("plt.title('{}')".format(plot_style['title'])) ipshell.ex("plt.title('{}')".format(plot_style['title']))
ipshell() ipshell()
########## ##########
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment