Skip to content

Instantly share code, notes, and snippets.

  1. Maybe it is a good idea to make ScanPlan belongs to Beamtme like what we have for current xpdAcq There are two advantages to this approach:
    • we don't have to keep updating registered plan, we can simply maintain ct, Tramp and tseries

    • Unify plan input to RE and still make bluesky plan possible

      class Customized_RE(RunEngine)
      ....
      if isinstance(plan, ScanPlan):
      

plan.factory

@chiahaoliu
chiahaoliu / sub_tiff_export.md
Created July 14, 2016 15:37
my trial on subtracted tiff exporter

code itself, basically a copy of Dan's subtracted tiff exporter:

class SubtractedTiffExporter(LiveTiffExporter):
   "Intercept images before saving and subtract dark image"

   def start(self, doc):
       # The metadata refers to the scan uid of the dark scan.
       #if 'dark_frame' not in doc:
 dark_sub = True
## customized count
def delayed_count(detectors, shutter_config, interval=None, num=1, *, md=None):
"""
Take one or more readings from detectors.
Parameters
----------
detectors : list
list of 'readable' objects
gasses : list of string
name of gasses want to alterna
 OSError Traceback (most recent call last)
/home/xf28id1/Documents/Milinda/Scripts/aquasition/kapton.py in <module>()
----> 1 _end_beamtime()
/home/xf28id1/src/xpdacq/xpdacq/beamtimeSetup.py in _end_beamtime(base_dir, archive_dir, bto, usr_confirm)
227 _confirm_archive(archive_full_name)
228 # flush
--> 229 _delete_home_dir_tree()
230 # delete bt
231 del ips.ns_table['user_global']['bt']
# every time we exit out from ipython, we need to configure devices
# in this example, we move sample_stage_2 in x direction (ss_stg2_x)
xpd_configuration['temp_controller'] = cryostat
xpd_configuration['stat_motor'] = ss_stg2_x
# scanplan : 1s expo, from 300k to 303k with 1k step
# sample_ind <1> at motor position 1.55
# sample_ind <3> at motor position 2.55
# sample_ind <7> at motor position 3.55
ScanPlan(bt, statTramp, 1, 300, 303, 1, {1:1.55, 3:2.55, 7:3.55})
# 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
@chiahaoliu
chiahaoliu / quick_guide.py
Last active March 9, 2017 18:44
170307_Sanjit_support
import bluesky.plans as bp
from xpdacq.beamtime import _configure_area_det
## set up tiff name
xpd_data_proc.data_fields.append(('gas_current_gas', ''))
## switch gas
gas.set('He') # switch to 'He', available entries are defined by gas.gas_list. E.g. gas.gas_list= ['He', 'O2']
## configure the exposure time first
@chiahaoliu
chiahaoliu / GasPlan.py
Last active March 9, 2017 19:23
plan guide
import bluesky.plans as bp
from xpdacq.beamtime import _configure_area_det
import os
import numpy as np
import itertools
from bluesky.plans import (scan, subs_wrapper, abs_set, count, list_scan,
adaptive_scan, reset_positions_wrapper)
from bluesky.callbacks import LiveTable, LivePlot
from bluesky.plan_tools import print_summary
import os
import numpy as np
from itertools import product
from xpdacq.beamtime import _configure_area_det
import bluesky.plans as bp
from bluesky.plans import (scan, subs_wrapper, abs_set, count, list_scan,
adaptive_scan, reset_positions_wrapper)
from bluesky.callbacks import LiveTable, LivePlot
@chiahaoliu
chiahaoliu / advanced_cryostat.py
Last active March 23, 2017 02:32
170322_Ben_support: cryostat with expo changes
import os
import numpy as np
from itertools import product
from xpdacq.beamtime import _configure_area_det
import bluesky.plans as bp
from bluesky.plans import (scan, subs_wrapper, abs_set, count, list_scan,
adaptive_scan, reset_positions_wrapper)
from bluesky.callbacks import LiveTable, LivePlot