NSLS-II / wishlist

an issue tracker for the big picture
1 stars 0 forks source link

Knowing scan-id, how to find exposure time #93

Closed xiaojinghuang closed 8 years ago

xiaojinghuang commented 8 years ago

How to extract scan information such as exposure time, image file names associated with a scan id.

danielballan commented 8 years ago

Exposure time is not currently being saved. This is obviously a critical shortcoming of the current deployment. We are actively working on a software update to ophyd and bluesky that will store exposure time and other configuration data. This will be deployed for the next cycle.

klauer commented 8 years ago

@xiaojinghuang, what @danielballan described is accurate for most beamlines, but for the HXN I made sure that we had exposure time available.

For both HXN step and fly scans, you can do:

In [1]: db[3900]['start']['exposure_time']
Out[1]: '0.1'

Note that that's a string, so to get a floating point value out of it you should do float(db[3900]['start']['exposure_time']).

Getting image filenames, on the other hand, goes against the filestore architecture that @danielballan and @tacaswell worked hard to setup. If you'd like to argue your case, please send it in their direction. :)

danielballan commented 8 years ago

Note: generically, you can also eval(db[3900]['start']['exposure_time']) if you don't want to think about what data type your metadata is. Just let Python figure it out.

xiaojinghuang commented 8 years ago

@klauer , thanks a lot for the help. I'm looking for exposure times of fermat spiral scans (3791,3793,3794 and 3795) taken with the ptychography instrument. I tried the db command, it complains KeyError: 'exposure_time'.

klauer commented 8 years ago

Sorry, @xiaojinghuang, it looks like this was an oversight for the spiral scans. I had to implement these beside the standard SPEC-like scans and neglected to add the functionality. The best I can do for you right now is the following, which includes overhead:

start_time = db[3793]['start']['time']
stop_time = db[3793]['stop']['time']
num = int(db[3793]['start']['num'])
approx_exposure_time = (stop_time - start_time) / num

For scan 3793, this yields (in seconds):

Out[5]: 0.8895295816473663

Can you remind me of the date the next ptychography experiment with spiral scans will be run? There are some big beamline configuration changes coming up and I would like to ensure that this makes it in there.

xiaojinghuang commented 8 years ago

@klauer , at the beginning of next cycle, we'll have a few days to use the ptychography instrument to measure MLLs. During commissioning ZP module, we'll run ptychography measurement to characterize lens as well.

xiaojinghuang commented 8 years ago

@klauer, hi ken, how can I read out the ion chamber counts? I can see they are listed in db[3795]['start']['scan_args']['detectors'].

xiaojinghuang commented 8 years ago

@klauer, ah, i think i figured it out. the exposure time was actually save as scaler time. $scan_id,df = _load_scan(3791,fill_events=False) $df.sclr1_time

klauer commented 8 years ago

@xiaojinghuang, use get_table to get a pandas DataFrame back. Take a look at what IPython says for get_table? to see what fill and such mean.

Example:

header = db[3795]
table = get_table(header, fill=False)
print(table['sclr1_chan2'])
klauer commented 8 years ago

I have this fixed for the next run. It will be possible to get back exposure time from all new scans - 1d/2d step scans, fermat scans, and mll/zp fly scans.