Skip to content

Instantly share code, notes, and snippets.

@chiahaoliu
Created January 21, 2017 03:08
Show Gist options
  • Save chiahaoliu/3b2db98c908a70cbb4a38404012e2f5f to your computer and use it in GitHub Desktop.
Save chiahaoliu/3b2db98c908a70cbb4a38404012e2f5f to your computer and use it in GitHub Desktop.
# you have two options:
# assume you are using diff_x for x-motor and diff_y for y-motor.
# CHECK with wh_pos() !!! (but I think it is)
import bluesky.plans as bp
from cycler import cycler
# option1 : continuous trajactory with sneak pattern. scan diff_x from 1 to 3 with 3 stepes, same for diff_y
# change the argument as needed
_v1 = bp.outer_product_scan([xpd_configuration['area_det'], diff_x, diff_y], diff_x, 1, 3, 3, diff_y, 1, 3, 3, True)
grid_scan_v1 = bp.subs_wrapper(_v1, LiveTable([xpd_configuration['area_det'], diff_x, diff_y]))
# option2 : more flexible scan stpes but no sneak pattern scan diff_x from 1 to 3 with 3 stepes, same for diff_y
# change the argument as needed
traj1 = cycler(diff_x, [1,2,3])
traj2 = cycler(diff_y, [1,2,3])
_v2 = bp.scan_nd([xpd_configuration['area_det'], diff_x, diff_y], traj1*traj2)
grid_scan_v2 = bp.subs_wrapper(_v2, LiveTable([xpd_configuration['area_det'], diff_x, diff_y]))
# both can be run with xrun
xrun(<sample_ind>, grid_scan_v1) # or v2, depends on you
# after scan
# save tiffs
save_last_tiff()
# save livetable
tb = db.get_table(db[-1]) # a panda DF
tb.to_csv(<full_filename_you_want>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment