scanlib.tomo_scan_lib

Library of control functions for the Sector 32 ID C X-ray Microscope.

Functions:

update_variable_dict(variableDict)
wait_pv(pv, wait_val[, max_timeout_sec]) Wait on a pv to be a value until max_timeout (default forever)
start_verifier(conf, report_file, ...) This function starts a real-time verifier application on a remote machine.
stop_verifier(host, port, key) This method creates RemoteController instance that has a connection with remote server.
init_general_PVs(global_PVs, variableDict)
stop_scan(global_PVs, variableDict)
cleanup(global_PVs, variableDict, host, ...)
reset_CCD(global_PVs, variableDict)
setup_detector(global_PVs, variableDict)
setup_writer(global_PVs, variableDict[, ...])
setup_tiff_writer(global_PVs, variableDict)
capture_multiple_projections(global_PVs, ...)
move_sample_in(global_PVs, variableDict)
move_sample_out(global_PVs, variableDict)
open_shutters(global_PVs, variableDict)
close_shutters(global_PVs, variableDict)
add_theta(global_PVs, variableDict, theta_arr)
add_extra_hdf5(global_PVs, variableDict, ...)
move_dataset_to_run_dir(global_PVs, variableDict)
move_energy(global_PVs, variableDict)
bitreversed_decimal(dec_input, maxbits) Description: Compute bit-reversed value of a decimal number
gen_interlaced_views(N, K, N_p) Generate interlaced view angles
scanlib.tomo_scan_lib.update_variable_dict(variableDict)[source]
scanlib.tomo_scan_lib.wait_pv(pv, wait_val, max_timeout_sec=-1)[source]

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

scanlib.tomo_scan_lib.start_verifier(conf, report_file, variableDict, ver_dir, host, port, key)[source]

This function starts a real-time verifier application on a remote machine. It first starts a server that controls starting and stopping of the verifier. On starting the server this method will pass verifier arguments: configuration file, report file, and sequence, and server arguments: port, and key.

Parameters:
  • conf (str) – configuration file on the remote machine where the verifier will execute
  • report_file (str) – name of the report file that will be stored on the remote machine
  • variableDict (dict) – a dictionary defining sequence of data type scanning
  • ver_dir (str) – a directory of remote executable
  • host (str) – a remote computer
  • port (str) – a port on which the remote server will listen
  • key (str) – a random string used for authentication
Returns:

none

scanlib.tomo_scan_lib.stop_verifier(host, port, key)[source]

This method creates RemoteController instance that has a connection with remote server. Using this connection the code calls a ‘stop_process’ method on the remote server that will stop the verifier process. Then the connection is closed.

Parameters:
  • host (str) – a remote computer
  • port (int) – a port on which the remote server will listen
  • key (str) – a string generated in start_verifier method, user as authentication key
Returns:

none

scanlib.tomo_scan_lib.init_general_PVs(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.stop_scan(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.cleanup(global_PVs, variableDict, host, port, keys)[source]
scanlib.tomo_scan_lib.capture_multiple_projections(global_PVs, variableDict, num_proj, frame_type)[source]
scanlib.tomo_scan_lib.move_sample_in(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.move_sample_out(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.open_shutters(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.close_shutters(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.add_theta(global_PVs, variableDict, theta_arr)[source]
scanlib.tomo_scan_lib.add_extra_hdf5(global_PVs, variableDict, theta_arr, interf_arrs)[source]
scanlib.tomo_scan_lib.move_dataset_to_run_dir(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.move_energy(global_PVs, variableDict)[source]
scanlib.tomo_scan_lib.bitreversed_decimal(dec_input, maxbits)[source]

Description: Compute bit-reversed value of a decimal number

Parameters:
  • dec_input – Decimal input whose bit-reversed value must be computed
  • maxbits – Total number of bits in binary used to represent ‘in’ and ‘out’.
Returns:

out – Bit-reversed value of ‘in’.

scanlib.tomo_scan_lib.gen_interlaced_views(N, K, N_p)[source]

Generate interlaced view angles

Formula: the_views[n] = [(n mod(N/K))K + Br(floor(nK/N)
mod(K))]*pi/N; mod denotes modulo, floor gives the lowest integer value, Br denotes bit-reversal

Example:

N_theta = 16 # Total number of distinct view angles in a frame
K = 4 # Number of interlaced sub-frames in each frame
N_p = 32 # Total number of view angles (Note that angles repeat from frame to frame)

the_views = gen_interlaced_views(N_theta, K, N_p)

X = np.linspace(0, N_p-1)
plt.plot(X, the_views, 'o')
plt.plot(the_views, 'ro')
plt.plot(the_views, 'b-')
plt.grid()
plt.xlabel('View index')
plt.ylabel('View angle (degrees)')
plt.title('Interlaced views')
plt.show()
Parameters:
  • N (int) – Total number of distinct view angles in a frame
  • K (int) – Number of interlaced sub-frames in each frame
  • N_p (int) – Total number of view angles (Note that angles repeat from frame to frame)
Returns:

the_views (np.ndarray) – Interlaced view angles