Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas A Caswell tacaswell

  • Brookhaven National Lab
  • New York
View GitHub Profile
@tacaswell
tacaswell / README.md
Last active Feb 18, 2021
Files for working with reduced data from 2020-12 experiments at XPD
View README.md

Collection of notebooks an files for playing with gpcam data

  1. explore_pgcam_data.ipynb -> demo of how to pulll reduced data out of the msgpack databroker
  2. extract.py -> code run on xpd against raw data broker to sort out what raw runs we are interested in
  3. reprocess.py -> code run to re-process the raw data and produce the reduced outputs
@tacaswell
tacaswell / ingest_sensord.py
Created May 16, 2020
Example of how to ingest sensord logs (from journalctl) to EventModel
View ingest_sensord.py
from event_model import compose_run
import datetime
import dateutil.parser
import itertools
from io import StringIO
import subprocess
import numpy as np
import functools
def extract_event(ts, batch):
@tacaswell
tacaswell / ironmanpython.txt
Created Apr 8, 2020
trace back -> IPython exit
View ironmanpython.txt
Python 3.9.0a5+ (heads/master:799d7d61a9, Apr 6 2020, 17:38:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.0.dev -- An enhanced Interactive Python. Type '?' for help.
In [1]: 1 /0
Traceback (most recent call last):
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-a37332903225>", line 1, in <module>
1 /0
@tacaswell
tacaswell / README.md
Last active Apr 2, 2020
ingest xpd chi files
View README.md

This is code to consume processed data from XPD back into document model

View datathoughts.py
import numpy as np
import matplotlib
import matplotlib.lines
from matplotlib.artist import allow_rasterization
import matplotlib.pyplot as plt
class MatplotlibException(Exception):
...
@tacaswell
tacaswell / .gitignore
Last active Sep 18, 2019
Slides for h5py update
View .gitignore
*.h5
.ipynb_checkpoints/
View make_bleeding
#! /usr/bin/bash
set -e
TARGET_ENV=bleeding
OSPATH=~/source/other_source/
PSPATH=~/source/p
DSPATH=~/source/bnl
pull_build () {
git pull || echo failed
View det_killer.py
from epics import caput, caget
from itertools import count
for j in count():
try:
ret = caget('XF:31IDA-BI{Cam:Tbl}cam1:PortName_RBV')
if ret is None:
raise TimeoutError('failed on XF:31IDA-BI{Cam:Tbl}cam1:PortName_RBV')
ret = caget('XF:31IDA-BI{Cam:Tbl}image1:EnableCallbacks_RBV')
if ret is None:
raise TimeoutError('failed on XF:31IDA-BI{Cam:Tbl}image1:EnableCallbacks_RBV')
@tacaswell
tacaswell / requirements.txt
Created Nov 18, 2018
Files from Melbourne 2018 EPICS python-in-controls workshop
View requirements.txt
git+https://github.com/pcdshub/QDarkStyleSheet.git
git+https://github.com/pcdshub/happi.git
git+https://github.com/pcdshub/typhon.git
git+https://github.com/slaclab/pydm.git
git+https://github.com/tacaswell/caproto.git@fix_alarm_subscriptions
git+https://github.com/tacaswell/timechart.git@fix_future_pydm
jinja2
numpy
ophyd
prettytable
View squashing_hdf5
class FileStoreSquashing(FileStorePluginBase):
'''Write out 'squashed' files
.. note::
See :class:`FileStoreBase` for the rest of the required parametrs
This mixin will also configure the ``cam`` and ``proc`` plugins
on the parent.