NSLS-II / eiger-io

I/O tools for the Eiger detector
BSD 3-Clause "New" or "Revised" License
1 stars 9 forks source link

Add slice #14

Closed jrmlhermitte closed 6 years ago

jrmlhermitte commented 6 years ago

Adding a slice kwarg to Eiger Handler. backwards compatible. This is to satisfy a new mode we are trying in the acquisition from EIGER detectors.

dscan_manual([eiger4m_manual], start, stop, num, steps)

The problem is that currently, for every point in a scan, two files are generated:

-rw-rw-r--  1 softioc chx  88K Apr 26 13:49 db283daf-7526-4aa1-9399_830_data_000001.h5
-rw-rw-r--  1 softioc chx  87M Apr 26 13:49 db283daf-7526-4aa1-9399_830_master.h5

The first contains data but the second is overhead involving information on the detector. Thus to read a file, all a handler needed to know was the file prefix and sequence number (i.e. "830").

Now, a dscan saves all events in the same hdf5 linked file group (i.e. we only have one 'master' file per set of events now). This requires a new keyword argument, the slice number which I define to be image_slice effectively done here.

I could have written two separate handlers but since there are almost no differences, I've combined them into one. I have however, added a new handler spec named AD_EIGER_SLICE just in case.

jrmlhermitte commented 6 years ago

I currently tested this on old and new data and it works fine. It's good to merge.

from databroker import Broker
from eiger_io.fs_handler import EigerHandler

db = Broker.named("chx")

db.reg.register_handler("AD_EIGER2", EigerHandler)
db.reg.register_handler("AD_EIGER_SLICE", EigerHandler)

uid_manual = 'eab6ec58-864d-46af-8c29-67005de840b0'
uid_normal = '57ada663-a663-4cf6-8667-daaf7b7744e6'

imgs_manual = db[uid_manual].data('eiger1m_manual_image')
imgs_normal = list(db[uid_normal].data('eiger4m_single_image'))[0]

next(imgs_manual)

imgs_normal[0]
jrmlhermitte commented 6 years ago

changed image_slice naming to frame_num. Also had to change CHX profiles here.