Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
fixes #151
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Feb 13, 2020
1 parent b187697 commit 53cc66e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion profile_bluesky/startup/00-instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
start bluesky in IPython session for XPCS
"""

from instrument.console_session import *
from instrument.collection import *

# show_ophyd_symbols()
# print_RE_md(printing=False)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .session_logs import *
logger.info(__file__)

from .mpl.console import *
from .mpl import *

logger.info("bluesky framework")

Expand Down
4 changes: 2 additions & 2 deletions profile_bluesky/startup/instrument/framework/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
# callback_db['post_run_verify'] = RE.subscribe(post_run(verify_files_saved), 'stop')

# Make plots update live while scans run.
from bluesky.utils import install_qt_kicker
install_qt_kicker()
from bluesky.utils import install_kicker
install_kicker()

# convenience imports
# from bluesky.callbacks import *
Expand Down
20 changes: 20 additions & 0 deletions profile_bluesky/startup/instrument/mpl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

def isnotebook():
"""
see: https://stackoverflow.com/a/39662359/1046449
"""
try:
shell = get_ipython().__class__.__name__
return shell == 'ZMQInteractiveShell'
# return True # Jupyter notebook or qtconsole
#elif shell == 'TerminalInteractiveShell':
# return False # Terminal running IPython
#else:
# return False # Other type (?)
except NameError:
return False # Probably standard Python interpreter

if isnotebook():
from .notebook import *
else:
from .console import *
3 changes: 3 additions & 0 deletions profile_bluesky/startup/instrument/mpl/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@

__all__ = ['plt',]

from ..session_logs import *
logger.info(__file__)

import matplotlib.pyplot as plt
plt.ion()
14 changes: 14 additions & 0 deletions profile_bluesky/startup/instrument/mpl/notebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

"""
Configure matplotlib in interactive mode for Jupyter notebook
"""

__all__ = ['plt',]

from ..session_logs import *
logger.info(__file__)

# %matplotlib notebook
get_ipython().magic('matplotlib notebook')
import matplotlib.pyplot as plt
plt.ion()

0 comments on commit 53cc66e

Please sign in to comment.