scanplans package

scanplans.beamtimehelper module

A class to print sample information and generate bluesky plan to target samples.

class scanplans.beamtimehelper.BeamtimeHelper(bt: xpdacq.beamtime.Beamtime, pos_key: Tuple[str, str] = 'sample_x', 'sample_y')[source]

A class helping to tackle with tasks related to samples on a rack during the beam time.

Attributes
_bt

The instance storing meta data of the sample and plan

_pos_key

The key for the position of samples. Default is the global variable POS_KEYS

aim_at_sample(sample)[source]

A generator of message: move the sample to the beam spot according to sample position metadata.

Parameters
sample

The sample index or sample name key

Examples

Initiate a BeamtimeHelper. >>> bthelper = BeamtimeHelper(bt) Check the motors. >>> xpd_configuration[“x_controller”] >>> xpd_configuration[“y_controller”] Aim at the sample of index 0 in bt. >>> RE(bthelper.aim_at_sample(0)) Aim at the sample “Ni” in bt. >>> RE(bthelper.aim_at_sample(“Ni”))

get_plan(plan: Union[int, str]) → Generator[source]

Get the plan (message generator).

Parameters
plan

The plan index or plan name key

Returns
plan_gen

The plan message generator.

get_sample(sample: Union[int, str])dict[source]

Get metadata of a sample.

Parameters
sample

The sample index or sample name key

Returns
sample_meta

the meta data of a sample

print_plan(*plans: Union[int, str])[source]

Print the plan information.

Parameters
plans

The plan index or plan name key

print_sample(*samples: Union[int, str])[source]

Print the sample information.

Parameters
samples

The sample index or sample name key

scanplans.cryostat module

This script contains the plan for cryostat measurement. How to use it: (1) Download the script to userScript. (2) Run the script in ipython interface.

‘%run userScript/cryostat.py’

(3) Instantiate a python generator as the plan. Here is an example where the beamtime object is ‘bt’, the temperature controller is ‘cryostat_T’, the position controller is ‘ss_stage_x’ and the plan is to set temperature to 295 K and 300 K and take a single shot for two samples at each temperature. The samples are loaded at x-positions: 10 mm and 10.2 mm. Their corresponding index in bt is 1 and 2. The exposure time is 30 s and 60 s respectively.

‘plan = cryostat_plan(bt, cryostat_T, [295, 300], ss_stage_x, [10, 10.2], [1, 2], [30, 60])’

  1. Let ‘xrun’ rxecute the plan.

    ‘xrun({}, plan)’

    We don’t need to worry about the samples information because it will be added into metadata by this plan so the first positional argument of ‘xrun’ is given a empty dictionary.

scanplans.cryostat.cryostat_plan(bt: object, temp_motor: object, temperatures: List[float], posi_motor: object, positions: List[float], samples: List[int], exposures: List[float], temp_to_power: dict = None)[source]

The scanplan of cryostat measurement.

Parameters
btbeamtime object

The beamtime object.

temp_motormotor object

The controller of temperature.

temperaturesList[float]

A list of temperature setpoints.

posi_motormotor object

The controller of positions.

positionsList[float]

A list of positions.

samplesList[int]

A list of index of samples in bt.

exposuresList[float]

A list of exposure time.

temp_to_powerdict

A mapping from temperature range to power. The range is open at left and close at right. If None, default setting (see function ‘get_heater_range’) is used. Default None.

Yields
Message of the plan

scanplans.move_and_do module

Conduct the plans for the samples one by one.

scanplans.move_and_do.move_and_do_many(bt: xpdacq.beamtime.Beamtime, sps: List[Tuple[Union[int, str], Union[int, str, Generator]]], wait_times: Union[float, List[float]] = 0.0, wait_at_first: bool = False, sample_x: str = 'sample_x', sample_y: str = 'sample_y', x_controller: str = 'x_controller', y_controller: str = 'y_controller') → List[Generator][source]

Move to the sample and conduct the bluesky plan on the sample one by one.

Parameters
btBeamtime

The beamtime object.

spslist

A list of (sample index, plan index). The index is shown in the ‘bt.list()’.

wait_timesfloat or list of float

The wait time for all the samples.

wait_at_firstbool

Whether to wait before the plan is conducted for the first samples. If False, the plan will be conducted immediately to the first sample no matter how wait_time is set.

sample_xstr

The key to the x position of the sample in the sample information. Default ‘sample_y’.

sample_ystr

The key to the y position of the sample in the sample information. Default ‘sample_x’.

x_controllerstr

The key to the x position controller in ~xpdacq.beamtime.xqd_configuration.

y_controllerstr

The key to the x position controller in ~xpdacq.beamtime.xqd_configuration.

Returns
planslist

A list of the bluesky plans. Each plan is a generator.

scanplans.tramp2 module

An advanced temperature ramping plan.

scanplans.tramp2.Tramp2(dets: list, exposure: float, Tstart: float, Tstop: float, Tstep: float, *, ramp_rate: float = None)[source]

A temperature ramping plan with ramping rate configuration.

The ramping rate will be configured before the ramping start. The ramping will be done continuously without holding temperature at exposure.

Parameters
detslist

A list of detectors. Dummy. Not used.

exposurefloat

The exposure time in second.

Tstartfloat

The start temperature in K (included).

Tstopfloat

The stop temperature in K (incldued)

Tstepfloat

The temperature step in K.

ramp_ratefloat

The temperature ramping rate. Make sure the temperature controller has the velocity configuration.

Yields
Bluesky plan.