Scan Widget
hardware_control.gui.widgets.scan_widget module
- class hardware_control.gui.widgets.scan_widget.ScanWidget(app, name: str, actions: dict, scan_parameters: dict | None = None, GP_option: bool = False, get_measured_values_fxn: Callable = None, scan_cycle_fxn: Callable | None = None, finish_scan_fxn: Callable | None = None)
Bases:
QGroupBoxWidget that scans a number of instrument parameter values and makes a measurement at each one.
- Parameters:
app – The main app
name – The scan widget name that appears in the user interface
actions – A dictionary in which the values are functions to be called at each measured value
scan_parameters – The parameters that one can scan; if no parameters are specified, then all parameters in the instrument will be considered scan parameters
GP_option – Option to use a Gaussian process scan or not
get_measured_values_fxn – Function that makes and returns a measurement at each parameter value
scan_cycle_fxn – Optional function that will be executed after each measurement (i.e. once per measurement cycle)
finish_scan_fxn – Optional function that will be executed at the conclusion of the scan
- Scan Range GUI Parameters:
Start - Value at which the scan starts
Stop - Value at which the scan ends
Step - The step size between the values measured in the scan
- Gaussian Process GUI Parameters:
Start - Value at which the Gaussian process pre-scan starts; this is also the minimum value that the Gaussian process will ever measure
Stop - Value at which the Gaussian process pre-scan ends; this is also the maximum value that the Gaussian process will ever measure
Step - The minimum spacing between adjacent measured values; this value cannot be less than 0.01
# of Pre-Scans - Number of values to pre-scan; Gaussian processes always begin with a prescan over an evenly-spaced array starting and ending with the start and stop values, respectively
# of Queries – Number of values to query during the Gaussian process (after the pre-scan) is finished
- action_changed() None
Change the action done at each scanned value.
- browse_values_files() None
Browse files to use for scanning range.
- button_stop_scan()
Reset the user interface to the state when the app is not scanning.
- compute_values()
Compute the values for the scan to iterate over.
- continue_scan()
Continue the previous scan.
- end_scan()
Reset buttons to non-scanning state.
- new_scan()
Set all parameters to initital scanning state and call start_scan.
- operate_cycle()
Perform all actions that take place at one scan value measurement (i.e. in one cycle).
These actions include making the desired measurement, updating the Gaussian process kernel (if applicable), executing the given scan_cycle_fxn (if given), updating the progress bar, moving to the next scan value to measure, and pausing when all these actions are completed.
- pause()
Give instruments time to update by pausing before and after measurement.
After pausing before, this function calls operate_cycle to start a new cycle.
- pause_before_after()
Determine whether an upcoming pause is before or after a measurement and call the pause function.
- set_instrument() None
When an instrumnet is selected, update the list of parameterts that can be scanned.
- set_list_values() None
Set scan values to the values in the list field.
- set_parameter() None
When a parameter is selected, designate it as the scan parameter.
- start_scan()
Enable stop scan button and call scanning function.
- update_scan_parameters()
Determine which parameter can be scanned over.
- class hardware_control.gui.widgets.scan_widget.regressor(x_prescans, y_prescans, stepsize)
Bases:
objectObject that contains the Gaussian process capability of the scan widget.
- neighbor_probability(potential_vals, found_vals, delta)
For each element in potential_vals, return a value proportional to the number of nearby points in found_vals.
Delta is the window that determines what is considered “nearby”.
- next_query_val()
Select the best point to measure next in a parameter scan.
- update_model(new_y_val)
Update the Gaussian process kernel with newly measured data.