Skip to content

Instantly share code, notes, and snippets.

View tacaswell's full-sized avatar

Thomas A Caswell tacaswell

View GitHub Profile
from tqdm import tqdm
import ipyparallel as ipp
def main():
target = 'hxn_migration'
rc = ipp.Client()
dview = rc[:]
@tacaswell
tacaswell / parse.py
Last active March 22, 2017 01:53
playing with dbd + parsimonious
from parsimonious.grammar import Grammar, NodeVisitor
grammar = Grammar(r"""
dbd = (comment / cimport / field / menu / record_type / variable / device / include / registrar / function / driver / "\n")+
field = _ "field(" f_name "," _ f_type ")" _ "{" (fp / "\n" )* _ "}"
f_name = ~"[A-Z0-9_]+"
f_type = "DBF_STRING" / "DBF_CHAR" / "DBF_UCHAR" / "DBF_SHORT" / "DBF_USHORT" / "DBF_LONG" / "DBF_ULONG" / "DBF_FLOAT" / "DBF_DOUBLE" / "DBF_ENUM" / "DBF_MENU" / "DBF_DEVICE" / "DBF_INLINK" / "DBF_OUTLINK" / "DBF_FWDLINK" / "DBF_NOACCESS"
fp = _ (prompt / special / size / promptgroup / g_field / comment / extra / "\n")
prompt = "prompt(" prompt_val ")\n"
import aiohttp
import gidgethub
import gidgethub.aiohttp
try:
with open(os.path.expanduser('~/.ghoauth'), 'r') as f:
oauth_token = f.read()
except FileNotFoundError:
oauth_token = None
""" Tiny example for BNL showing multi-actor control """
from dask.distributed import Client, get_client, Variable, fire_and_forget
import numpy as np
import time
import random
def get_image_from_detector():
@tacaswell
tacaswell / README.md
Last active September 22, 2017 21:15
multimodal mpl tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / streaming_arrow.py
Created February 27, 2018 20:15 — forked from cpcloud/streaming_arrow.py
Streaming Arrow
import random
import time
from collections import deque
from threading import Thread
import zmq
import numpy as np
import pandas as pd
(/home/tcaswell/conda_envs/cp_test) tcaswell@xf02id1-ws1:~$ caproto-get 'SR:OPS-BI{DCCT:1}I:Real-I' -vvvv
[get] Spawned caproto-repeater process.
[get] Registering with the Channel Access repeater.
[cli.bcast] Serializing 1 commands into one datagram
[cli.bcast] 1 of 1 RepeaterRegisterRequest(client_address='0.0.0.0')
[get] Repeater registration timed out; continuing.
[get] Searching for 'SR:OPS-BI{DCCT:1}I:Real-I'....
[cli.bcast] Serializing 2 commands into one datagram
[cli.bcast] 1 of 2 VersionRequest(priority=0, version=13)
[cli.bcast] 2 of 2 SearchRequest(name=b'SR:OPS-BI{DCCT:1}I:Real-I', cid=0, version=13)
@tacaswell
tacaswell / push_to_advance.py
Created January 16, 2013 06:03
A quick class for binding keys to step through an iterable in matplotlib
class push_to_advance(object):
def __init__(self):
self.fig = plt.figure()
self.ax = self.fig.gca()
self.bound_keys = []
self.bound_cid = {}
def add_step_through(self, gen, key):
key = key[0] # make a single char
if key in self.bound_keys:
diff --git a/ADApp/commonDriverMakefile b/ADApp/commonDriverMakefile
index 7217ad42..b5aa4ef5 100644
--- a/ADApp/commonDriverMakefile
+++ b/ADApp/commonDriverMakefile
@@ -1,7 +1,25 @@
# This file contains the commands to build driver applications using the common set of plugins
# The variable DBD_NAME should be defined to specify the name of the application DBD file.
-# For backwards compatibilty if DBD_NAME is not specified then PROD_NAME must be specified,
+# For backwards compatibilty if DBD_NAME is not specified then PROD_NAME must be specified,
# and DBD_NAME will set to this.