csaxs_bec.scans.jungfrau_joch_scan.JungfrauJochTestScan#

class JungfrauJochTestScan(num_points: int, exp_time: float, readout_time: float, cycles: int = 1, **kwargs)[source]#

Bases: AsyncFlyScanBase

Owis-based grid scan.

JungfrauJoch Test scan.

Parameters:
  • device (DeviceBase) – The device to be triggered, currently only for delaygenerator csaxs

  • num_points (int) – Number of points per burst

  • exp_time (float) – exposure time.

  • readout_time (float) – readout time of detector

  • cycles (int) – number of cycles, default is 1

Example

scans.jjf_test(points = 100, exp_time= 1e-3, readout_time=1e-3, cycles = 2)

Methods

analyze_path_quality

Analyze the quality of a path by looking at the distribution of step sizes.

cleanup

call the cleanup procedure

close_scan

close the scan

device_msg_metadata

finalize

finalize the scan

get_path_length

Calculate the total length of a path defined by a sequence of positions.

get_radius

Calculate the radial distance from the origin for each position

initialize

move_to_start

return to the start position

open_scan

open the scan

optimize_corridor

Optimize positions using a corridor-based approach.

optimize_nearest_neighbor

Optimize path by always moving to the nearest unvisited point.

optimize_shell

Optimize a path through a set of positions by sorting them in concentric shells.

pre_scan

pre scan procedure.

prepare_positions

prepare the positions for the scan

read_scan_motors

read the scan motors

run

run the scan.

run_baseline_reading

perform a reading of all baseline devices

run_pre_scan_macros

run pre scan macros if any

scan

scan_core

perform the scan core procedure

scan_report_instructions

stage

call the stage procedure

unstage

call the unstage procedure

update_readout_priority

update the readout priority for this request.

update_scan_motors

Scan motors are automatically elevated to readout priority monitored and read out in the beginning of the scan.

Attributes

arg_bundle_size

arg_input

gui_args

gui_config

monitor_sync

monitor_sync is the flyer that will be used to synchronize the monitor readings in the scan bundler.

pre_move

required_kwargs

return_to_start_after_abort

scan_name

scan_report_devices

devices to be included in the scan report

scan_type

use_scan_progress_report

analyze_path_quality(pos: ndarray) PathQualityStats#

Analyze the quality of a path by looking at the distribution of step sizes.

Parameters:

pos (np.ndarray) – Array of positions

Returns:

Dictionary with statistics about the path quality

Return type:

dict

cleanup()#

call the cleanup procedure

close_scan()#

close the scan

finalize()#

finalize the scan

get_path_length(pos: ndarray) float#

Calculate the total length of a path defined by a sequence of positions. :param pos: Array of positions :type pos: np.ndarray

Returns:

Total path length

Return type:

float

get_radius(pos: ndarray) ndarray#

Calculate the radial distance from the origin for each position

Parameters:

pos (np.ndarray) – Array of positions

Returns:

Radial distances

Return type:

np.ndarray

property monitor_sync#

monitor_sync is the flyer that will be used to synchronize the monitor readings in the scan bundler. The return value should be the name of the flyer device.

move_to_start()#

return to the start position

open_scan()#

open the scan

optimize_corridor(positions: ndarray, corridor_size: float | None = None, sort_axis: int = 1, num_iterations: int = 1, preferred_direction: int | None = None, corridor_estimation: Literal['density', 'median_distance'] = 'median_distance')#

Optimize positions using a corridor-based approach.

Note: This method is designed for 2D positions. If higher dimensions are provided, the positions are returned unmodified.

Parameters:
  • positions (np.ndarray) – Array of positions

  • corridor_size (float, optional) – Width of each corridor. Defaults to None (auto-estimated).

  • sort_axis (int, optional) – Axis along which to create corridors (0 or 1). Defaults to 1.

  • num_iterations (int, optional) – Number of corridor sizes to try. Defaults to 1.

  • preferred_direction (int | None, optional) – Preferred direction for the primary axis (1 or -1). If None, alternates direction for each corridor.

  • corridor_estimation (str, optional) – Method for estimating corridor size if not provided. Options are “density” or “median_distance”. Defaults to “density”.

Returns:

Optimized positions

Return type:

np.ndarray

optimize_nearest_neighbor(positions: ndarray, start_index: int | None = None) ndarray#

Optimize path by always moving to the nearest unvisited point.

This is a greedy algorithm that provides good results for many scenarios with relatively low computational complexity.

Parameters:
  • positions (np.ndarray) – Array of positions

  • start_index (int | None, optional) – Index of the starting point. If None, the algorithm will start from the point closest to the origin.

Returns:

Optimized positions

Return type:

np.ndarray

optimize_shell(pos: ndarray, offset: float | None = None, dr: float | None = None, num_iterations: int = 3)#

Optimize a path through a set of positions by sorting them in concentric shells.

Parameters:
  • pos (np.ndarray) – Array of positions

  • offset (float, optional) – Offset for the first shell. Defaults to None (auto-estimated).

  • dr (float, optional) – Width of each shell. Defaults to None (auto-estimated).

  • num_iterations (int, optional) – Number of parameter variations to try. Defaults to 3.

Returns:

Optimized positions

Return type:

np.ndarray

pre_scan()#

pre scan procedure. This method is called before the scan_core method and can be used to perform additional tasks before the scan is started. This

prepare_positions()#

prepare the positions for the scan

read_scan_motors()#

read the scan motors

run()#

run the scan. This method is called by the scan server and is the main entry point for the scan.

run_baseline_reading()#

perform a reading of all baseline devices

run_pre_scan_macros()#

run pre scan macros if any

scan_core()[source]#

perform the scan core procedure

property scan_report_devices#

devices to be included in the scan report

stage()#

call the stage procedure

unstage()#

call the unstage procedure

update_readout_priority()#

update the readout priority for this request. Typically the monitored devices should also include the scan motors.

update_scan_motors() None#

Scan motors are automatically elevated to readout priority monitored and read out in the beginning of the scan.