tomoscan.tomoscan_2bm

Software for tomography scanning with EPICS at APS beamline 2-BM

Classes

TomoScan2BM

Derived class for tomography scanning with EPICS at APS beamline 2-BM

Functions:

tomoscan.tomoscan_2bm

Software for tomography scanning with EPICS at APS beamline 2-BM

class tomoscan.tomoscan_2bm.NetBooter_Control(mode='serial', serial_port='COM1', id='admin', password='admin', ip='0.0.0.0')[source]

Bases: object

Offer NetBooter Control class:

Support serial/telnet/http control Support outlet status checker / power on / power off / reboot Power on/off return setting success or fail, but reboot no return

How to use it:

From Serial NetBooter = NetBooter_Control(mode=’serial’,serial_port=’COM1’) NetBooter.power_on(1) #Return (True,’’) for set Outlet 1 ON success NetBooter.power_off(5) #Return (True,’’) for set Outlet 5 OFF success NetBooter.reboot(3) #No return, use NetBooter internal reboot function, don’t suggest to use it Outlet3_Status = NetBooter.check_outlet_status(3) #Return (True,’’) for Outlet 3 is ON | (False,’’) for OFF

From HTTP NetBooter = NetBooter_Control(mode=’http’,ip=’192.168.1.101’) NetBooter.power_on(2) #Return (True,’’) for set Outlet 2 ON success NetBooter.power_off(4) #Return (True,’’) for set Outlet 4 OFF success Outlet3_Status = NetBooter.check_outlet_status(3) #Return (True,’’) for Outlet 3 is ON | (False,’’) for OFF

NetBooter_httppost(url)[source]

Common NetBooter http post Input: url(/status.xml[for get stauts] or /cmd.cgi?rly=#1[for set power on/off])

check_outlet_status(outlet)[source]

Check outlet status Input: outlet(1/2/3/4/5) Output: True,’’(For ON)/False,’’(For OFF)/Exception,Exception Reason

login()[source]

Login NetBooter for serial/telnet mode No output

power_off(outlet)[source]

Set specific outlet off Input: outlet(1/2/3/4/5) Output: True,’’[Set success]/False,’’[Set fail]/Exception,’’

power_on(outlet)[source]

Set specific outlet on Input: outlet(1/2/3/4/5) Output: True,’’[Set success]/False,’’[Set fail]/Exception,’’

reboot(outlet)[source]

Set specific outlet reboot by internal reboot function from NetBooter Input: outlet(1/2/3/4/5) No output

class tomoscan.tomoscan_2bm.TomoScan2BM(pv_files, macros)[source]

Bases: TomoScanHelical

Derived class used for tomography scanning with EPICS at APS beamline 2-BM

Parameters
  • pv_files (list of str) – List of files containing EPICS pvNames to be used.

  • macros (dict) – Dictionary of macro definitions to be substituted when reading the pv_files

add_theta()[source]

Add theta at the end of a scan.

begin_scan()[source]

Performs the operations needed at the very start of a scan.

This does the following:

  • Set data directory.

  • Set the TomoScan xml files

  • Calls the base class method.

  • Opens the front-end shutter.

  • Sets the PSO controller.

  • Creates theta array using list from PSO.

  • Turns on data capture.

close_frontend_shutter()[source]

Closes the shutters to collect dark fields. This does the following:

  • Closes the 2-BM front-end shutter.

close_shutter()[source]

Closes the shutters to collect dark fields. This does the following:

  • Closes the 2-BM fast shutter.

end_scan()[source]

Performs the operations needed at the very end of a scan.

This does the following:

  • Calls save_configuration().

  • Put the camera back in “FreeRun” mode and acquiring so the user sees live images.

  • Sets the speed of the rotation stage back to the maximum value.

  • Calls move_sample_in().

  • Calls the base class method.

  • Closes shutter.

  • Add theta to the raw data file.

  • Copy raw data to data analysis computer.

open_frontend_shutter()[source]

Opens the shutters to collect flat fields or projections.

This does the following:

  • Checks if we are in testing mode. If we are, do nothing else opens the 2-BM front-end shutter.

open_shutter()[source]

Opens the shutters to collect flat fields or projections.

This does the following:

  • Opens the 2-BM fast shutter.

pv_callback_2bm(pvname=None, value=None, char_value=None, **kw)[source]

Callback function that is called by pyEpics when certain EPICS PVs are changed

reinit_camera()[source]

Init camera PVs based on the mctOptics selection.

Parameters

camera (int, optional) – The camera to use. Optique Peter system support 2 cameras

set_scan_exposure_time(exposure_time=None)[source]

Sets the camera exposure time during the scan.

The exposure_time is written to the camera’s AcquireTime PV.

Parameters

exposure_time (float, optional) – The exposure time to use. If None then the value of the ExposureTime PV is used.

set_trigger_mode(trigger_mode, num_images)[source]

Sets the trigger mode SIS3820 and the camera.

Parameters
  • trigger_mode (str) – Choices are: “FreeRun”, “Internal”, or “PSOExternal”

  • num_images (int) – Number of images to collect. Ignored if trigger_mode=”FreeRun”. This is used to set the NumImages PV of the camera.

set_trigger_mode_adimec(trigger_mode, num_images)[source]
set_trigger_mode_grasshopper(trigger_mode, num_images)[source]
set_trigger_mode_oryx(trigger_mode, num_images)[source]
wait_frontend_shutter_open(timeout=-1)[source]

Waits for the front end shutter to open, or for abort_scan() to be called.

While waiting this method periodically tries to open the shutter..

Parameters

timeout (float) – The maximum number of seconds to wait before raising a ShutterTimeoutError exception.

Raises
  • ScanAbortError – If abort_scan() is called

  • ShutterTimeoutError – If the open shutter has not completed within timeout value.

wait_pv(epics_pv, wait_val, timeout=-1)[source]

Wait on a pv to be a value until max_timeout (default forever) delay for pv to change