Skip to content

Instantly share code, notes, and snippets.

@tacaswell
Created Jan 12, 2016
Embed
What would you like to do?
from ophyd import SimDetector
from ophyd.areadetector.plugins import ProcessPlugin, TIFFPlugin
from ophyd.areadetector.filestore_mixins import FileStoreBase
from ophyd.areadetector.trigger_mixins import SingleTrigger
from ophyd.device import (Component as C)
prefix = 'XF:31IDA-BI{Cam:Tbl}'
class LocalTiff(TIFFPlugin, FileStoreBase):
pass
class SquashingDet(SingleTrigger, SimDetector):
proc1 = C(ProcessPlugin, 'Proc1:')
tiff1 = C(LocalTiff, 'TIFF1:', write_file_path='/tmp/')
sd = SquashingDet(prefix)
def setup_squashing(images_per_set, number_of_sets, cam, proc, out_plugin):
proc.nd_array_port.put(cam.port_name.get())
# clear the filter (?)
proc.reset_filter.put(1)
# set up the filter
proc.enable.put(1)
proc.enable_filter.put(1)
proc.filter_type.put('Sum')
proc.auto_reset_filter.put(1)
proc.filter_callbacks.put(1)
proc.num_filter.put(images_per_set)
# set the cam to take the right total number of images
cam.num_images.put(images_per_set * number_of_sets)
# tell next plugin to look at this one for input
out_plugin.nd_array_port.put(proc.port_name.get())
setup_squashing(5, 7, sd.cam, sd.proc1, sd.tiff1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment