-
Notifications
You must be signed in to change notification settings - Fork 12
Scripting
Execute code using the Run Script facility:
This code is deprecated, but necessary for now. New instructions will be provided soon.
from nion.swift.model import HardwareSource
stem = HardwareSource.HardwareSourceManager().get_instrument_by_id("autostem_controller")
ronchigram = stem.ronchigram_camera
eels = stem.eels_camera
All values in AS2 controls are float data type.
Passing values to SetValAndConfirm: the 1.0 refers to confirmation; 1.0 is nominal value; 3000 is ms to wait to reach that value, this function will return as soon as value has reached target value.
The possible control values are available by examining AS2 controls and variables. All units are SI unless otherwise specified in AS2.
as2_control_name = "DriftTubeLoss"
tolerance_factor = 1.0 # nominal value
timeout_ms = 3000
energy_ev = stem.GetVal(as2_control_name)
offset_ev = 3.0
stem.SetValAndConfirm(as2_control_name, energy_ev + offset_ev, tolerance_factor, timeout_ms)
TODO
TODO
The probe position is a tuple (y, x)
with values ranging from [0, 1] with 0, 0 being top left and 1, 1 being bottom right.
The coordinates are fractional coordinates on the last scan.
You can convert to physical coordinates using the calibration on the last scan.
During scanning, the probe position will be None. When not scanning, you can set the probe position to a tuple or "unspecify" the probe position by setting it to None to return to its parked position.
stem.probe_position = 0.5, 0.5 # put probe in the middle
TODO