Skip to content

aps-6bm-mpe/ipython-s6bm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipython-s6bm

User account for 6-BM-A using ipython

Installation of BlueSky control system

It is highly recommended to deploy this control system in a virtual environemnt. For example:

conda create -n bluesky

Switch to the new env

conda activate bluesky

to install BlueSky core packages with

conda install -c conda-forge bluesky

then the apstools packages for APS devices.

pip install apstools

Due to the hybrid installation source, some packages might be installed via both conda and pip. This is typically not an issue as the latest version should be the same regardless the source. However, it is recommended to check the acutal packages being used via IPython session should any issue occur.

Some supplementary packages recommended:

conda install jupyter jupyterlab

Config Meta-data handler (MongoDB)

Copy the configuration file configs/mongodb_config.yml to HOME/.config/databroker/mongodb_config.yml to enable meta-data handler backed by a MongoDB server.

The entry host need to be changed to the IP of the machine that hosts the MongoDB service.

Ipython based control

Profile

The environment var IPYTHONDIR needs to be set where the profile folder is, or simply create symbolic link of the deisred profile to ~/.ipython/, which is the default location to store all IPython profiles.

>> export IPYTHONDIR=ipython_profiles/

Startup

First, activate the BlueSky env if not already

>> conda activate bluesky

Then, issue the following command in the terminal to run IPython with pre-configured environment for Tomo-characterization at 6-BM-A:

>> ipython --profile=s6bm

By default, all devices are initialized to 'debug' mode where only simulated devices are connected.

To check the current mode, simply do

>> mode

or directly switch to different model with

>> mode.set(MODE_NAME)

Currently there are three modes available:

debug only connect to simulated ophyd devices
dryrun connect to real devices (PVs) and a simulated shutter
production production mode, ready for data collection

Run tomo experiment

The details of a tomography experiment should be specified in a YAML file (see configs/tomo_6bma.yml for example). To run the experiment once, one can simply type

>> RE(tomo_scan('my_tomo_exp.yml'))

If you would like to modify certain field interactively, you can also load the YAML as dictionary using

>> tomo_exp = load_config('my_tomo_exp.yml')

and directly modify different entries in the dict. Then you can pass the dict to RE to run.

For example, let's say that we want the first experiment to be a step scan using tiff as output and the second one using fly scan with HDF5 as output. The following code should work

>> mode.set('production')
...# some other prep work before running
>> tomo_exp = load_config('my_tomo_exp.yml')
>> tomo_exp['tomo']['type'] = 'step'
>> tomo_exp['output']['type'] = 'tiff'
>> RE(tomo_scan(tomo_exp))
...# some cleaning up for the first experiment 
>> tomo_exp['tomo']['type'] = 'fly'
>> tomo_exp['output']['type'] = 'hdf'
>> RE(tomo_scan(tomo_exp))
...# some cleaning up for the second experiment

Dev note

  • Branch v0.01 was developed using standard signal staging and tested.
  • Current master branch uses a empty stage_sigs to by pass the staging.
  • If the experiment has to be aborted RE.abort() due to various reason, you can use resume_motors_position() to move motors back to the posiiton before the experiment.
  • To avoid namespace contamination, please use list_predefined_vars() and list_predefined_func() to check the predefined vars and functions.

About

User account for 6-BM-A using ipython

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published