forked from NSLS-II-XPD/xpdView
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NSLS-II-XPD#15 from CJ-Wright/waterfall_callback
Waterfall callback
- Loading branch information
Showing
9 changed files
with
210 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# codecov can find this file anywhere in the repo, so we don't need to clutter | ||
# the root folder. | ||
#comment: false | ||
|
||
codecov: | ||
notify: | ||
require_ci_to_pass: no | ||
|
||
coverage: | ||
status: | ||
patch: | ||
default: | ||
target: '80' | ||
if_no_uploads: error | ||
if_not_found: success | ||
if_ci_failed: failure | ||
project: | ||
default: false | ||
library: | ||
target: auto | ||
if_no_uploads: error | ||
if_not_found: success | ||
if_ci_failed: failure | ||
paths: '!*/tests/.*' | ||
|
||
tests: | ||
target: 97.9% | ||
paths: '*/tests/.*' | ||
|
||
flags: | ||
tests: | ||
paths: | ||
- tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[run] | ||
source = | ||
xpdview | ||
[report] | ||
omit = | ||
*/python?.?/* | ||
*/site-packages/nose/* | ||
# ignore _version.py and versioneer.py | ||
.*version.* | ||
*_version.py | ||
|
||
exclude_lines = | ||
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[flake8] | ||
exclude = | ||
.git, | ||
__pycache__, | ||
doc/conf.py, | ||
old, | ||
build, | ||
dist, | ||
max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
python-targets: | ||
- 3 | ||
doc-warnings: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
language: python | ||
sudo: false | ||
env: | ||
global: | ||
BUILD_DOCS_BRANCH: master | ||
DOCS_SUBDIR: doc/ | ||
TARGET_DEV_SUBDIR: bluesky/ | ||
HTML_SUBDIR: build/html | ||
DOCS_CONDA_DEPS: "bluesky" | ||
DOCS_PIP_DEPS: "tqdm" | ||
|
||
cache: | ||
directories: | ||
- $HOME/.cache/pip | ||
- $HOME/.cache/matplotlib | ||
|
||
services: | ||
- mongodb | ||
addons: | ||
apt: | ||
sources: | ||
- mongodb-3.2-precise | ||
packages: | ||
- mongodb-org-server | ||
|
||
python: | ||
- 3.5 | ||
before_install: | ||
- git clone https://github.com/NSLS-II/nsls2-ci --branch master --single-branch ~/ci_scripts | ||
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" | ||
- "export DISPLAY=:99.0" | ||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | ||
- chmod +x miniconda.sh | ||
- ./miniconda.sh -b -p ~/mc | ||
- export PATH=~/mc/bin:$PATH | ||
- conda update conda --yes | ||
- export CONDARC=ci/condarc | ||
- export MDS_HOST=localhost | ||
- export MDS_DATABASE=test | ||
- export MDS_TIMEZONE=US/Eastern | ||
- mkdir -p /home/travis/.config/metadatastore | ||
- 'echo ''port: 27017'' > /home/travis/.config/metadatastore/connection.yml' | ||
- export FS_HOST=localhost | ||
- export FS_DATABASE=test | ||
- mkdir -p /home/travis/.config/filestore | ||
- 'echo ''port: 27017'' > /home/travis/.config/filestore/connection.yml' | ||
|
||
|
||
install: | ||
- export GIT_FULL_HASH=`git rev-parse HEAD` | ||
- conda create --yes -n testenv numpy scipy flake8 matplotlib python=$TRAVIS_PYTHON_VERSION pytest coverage pip databroker ophyd historydict boltons doct pyepics super_state_machine mock xlrd scikit-beam bluesky pyFAI pyxdameraulevenshtein pyqt=4 -c lightsource2 -c conda-forge -c soft-matter | ||
- source activate testenv | ||
- python setup.py install | ||
# Need to clean the python build directory (and other cruft) or pytest is | ||
# going to find the build directory and get confused why there are two sets | ||
# of every test file | ||
- python -c "from filestore import utils, conf; utils.install_sentinels(conf.connection_config, 1)" | ||
# make sure the sqlite file exists to avoid race conditions | ||
- python -c "from bluesky.utils import get_history; get_history()" | ||
- pip install codecov pytest-env python-coveralls | ||
- git clean -xfd | ||
|
||
script: | ||
# - coverage run run_tests.py | ||
# - coverage report -m | ||
- flake8 xpdview | ||
|
||
#after_success: | ||
# - codecov | ||
# - coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from bluesky.callbacks.broker import BrokerCallbackBase | ||
from .waterfall import Waterfall | ||
|
||
|
||
class LiveWaterfall(BrokerCallbackBase): | ||
""" | ||
Stream 1D images in a waterfall viewer. | ||
Parameters | ||
---------- | ||
x_name : str | ||
field name for x dimension | ||
y_name: str | ||
field name for y dimension | ||
db: databroker.Broker instance | ||
The Broker to fill the events if events are not filled | ||
units: tuple of str | ||
The units for the x and y axes | ||
""" | ||
|
||
def __init__(self, x_name, y_name, db=None, units=None): | ||
super().__init__((x_name, y_name,), db=db) | ||
self.db = db | ||
self.x_name = x_name | ||
self.y_name = y_name | ||
self.units = units | ||
|
||
from matplotlib.figure import Figure | ||
self.fig = Figure() | ||
|
||
self.wf = Waterfall(fig=self.fig, unit=self.units) | ||
self.i = 0 | ||
|
||
def start(self, doc): | ||
self.i = 0 | ||
self.wf.key_list.clear() | ||
self.wf.int_data_list.clear() | ||
|
||
def event(self, doc): | ||
super().event(doc) | ||
y = doc['data'][self.y_name] | ||
x = doc['data'][self.x_name] | ||
self.update((x, y)) | ||
|
||
def update(self, data): | ||
self.wf.update(key_list=[self.i], int_data_list=[data]) | ||
self.i += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters