Struct nicompiler_backend::experiment::Experiment
source · pub struct Experiment { /* private fields */ }
Expand description
A concrete struct consisting of a collection of devices.
Refer to the BaseExperiment
trait for method behavior.
Implementations§
source§impl Experiment
impl Experiment
sourcepub fn new() -> Self
pub fn new() -> Self
Constructor for the Experiment
class.
This constructor initializes an instance of the Experiment
class with an empty collection of devices.
The underlying representation of this collection is a hashmap where device names (strings) map to their
respective Device
objects.
Returns
- An
Experiment
instance with no associated devices.
Example (python)
from nicompiler_backend import Experiment
exp = Experiment()
assert len(exp.devices()) == 0
source§impl Experiment
impl Experiment
pub fn edit_stop_time(&self) -> f64
pub fn compiled_stop_time(&self) -> f64
pub fn compile(&mut self) -> f64
pub fn compile_with_stoptime(&mut self, stop_time: f64)
pub fn is_edited(&self) -> bool
pub fn is_compiled(&self) -> bool
pub fn is_fresh_compiled(&self) -> bool
pub fn clear_edit_cache(&mut self)
pub fn clear_compile_cache(&mut self)
pub fn add_ao_channel(&mut self, name: &str, channel_id: usize)
pub fn add_do_channel(&mut self, name: &str, port_id: usize, line_id: usize)
pub fn device_cfg_samp_clk_src(&mut self, name: &str, src: &str)
pub fn device_cfg_trig( &mut self, name: &str, trig_line: &str, export_trig: bool )
pub fn device_cfg_ref_clk( &mut self, name: &str, ref_clk_line: &str, ref_clk_rate: f64, export_ref_clk: bool )
pub fn device_compiled_channel_names( &mut self, name: &str, require_streamable: bool, require_editable: bool ) -> Vec<String>
pub fn calc_signal( &mut self, name: &str, t_start: f64, t_end: f64, nsamps: usize, require_streamable: bool, require_editable: bool, py: Python<'_> ) -> PyResult<PyObject>
pub fn device_edit_stop_time(&mut self, name: &str) -> f64
pub fn device_compiled_stop_time(&mut self, name: &str) -> f64
pub fn device_clear_compile_cache(&mut self, name: &str)
pub fn device_clear_edit_cache(&mut self, name: &str)
pub fn constant( &mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64, value: f64, keep_val: bool )
pub fn sine( &mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64, keep_val: bool, freq: f64, amplitude: Option<f64>, phase: Option<f64>, dc_offset: Option<f64> )
pub fn high(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)
pub fn low(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)
pub fn go_high(&mut self, dev_name: &str, chan_name: &str, t: f64)
pub fn go_low(&mut self, dev_name: &str, chan_name: &str, t: f64)
pub fn channel_clear_compile_cache(&mut self, dev_name: &str, chan_name: &str)
pub fn channel_clear_edit_cache(&mut self, dev_name: &str, chan_name: &str)
pub fn channel_calc_signal_nsamps( &mut self, dev_name: &str, chan_name: &str, start_time: f64, end_time: f64, num_samps: usize ) -> Vec<f64>
Trait Implementations§
source§impl BaseExperiment for Experiment
impl BaseExperiment for Experiment
fn devices(&self) -> &HashMap<String, Device>
fn devices_(&mut self) -> &mut HashMap<String, Device>
source§fn assert_has_device(&self, name: &str)
fn assert_has_device(&self, name: &str)
Asserts that the specified device exists in the experiment. Read more
source§fn assert_device_has_channel(&self, name: &str, chan_name: &str)
fn assert_device_has_channel(&self, name: &str, chan_name: &str)
Asserts that the specified channel exists within the given device in the experiment. Read more
source§fn add_device_base(&mut self, dev: Device)
fn add_device_base(&mut self, dev: Device)
Helper method to add a device to the experiment’s collection of devices. Read more
source§fn add_ao_device(&mut self, name: &str, samp_rate: f64)
fn add_ao_device(&mut self, name: &str, samp_rate: f64)
Registers an Analog Output (AO) device to the experiment. Read more
source§fn add_do_device(&mut self, name: &str, samp_rate: f64)
fn add_do_device(&mut self, name: &str, samp_rate: f64)
Registers a Digital Output (DO) device to the experiment. Read more
source§fn edit_stop_time(&self) -> f64
fn edit_stop_time(&self) -> f64
Retrieves the latest
edit_stop_time
from all registered devices.
See BaseDevice::edit_stop_time
for more information. Read moresource§fn compiled_stop_time(&self) -> f64
fn compiled_stop_time(&self) -> f64
Retrieves the
compiled_stop_time
from all registered devices.
See BaseDevice::compiled_stop_time
for more information. Read moresource§fn compile(&mut self) -> f64
fn compile(&mut self) -> f64
Broadcasts the compile command to all devices, relying on the
edit_stop_time
as the compilation stop-target.
See BaseDevice::compile
and BaseExperiment::compiled_stop_time
for more information. Read moresource§fn compile_with_stoptime(&mut self, stop_time: f64)
fn compile_with_stoptime(&mut self, stop_time: f64)
Compiles the experiment by broadcasting the compile command to all devices. Read more
source§fn compiled_devices(&self) -> Vec<&Device>
fn compiled_devices(&self) -> Vec<&Device>
Retrieves a list of devices that have been successfully compiled. Read more
source§fn is_edited(&self) -> bool
fn is_edited(&self) -> bool
Checks if any of the registered devices have been edited.
Also see
BaseDevice::is_edited
. Read moresource§fn is_compiled(&self) -> bool
fn is_compiled(&self) -> bool
Checks if any of the registered devices have been compiled.
Also see
BaseDevice::is_compiled
. Read moresource§fn is_fresh_compiled(&self) -> bool
fn is_fresh_compiled(&self) -> bool
Checks if all registered devices are in a freshly compiled state.
Also see
BaseDevice::is_fresh_compiled
. Read moresource§fn clear_edit_cache(&mut self)
fn clear_edit_cache(&mut self)
Clears the edit cache for all registered devices.
Also see
BaseDevice::clear_edit_cache
. Read moresource§fn clear_compile_cache(&mut self)
fn clear_compile_cache(&mut self)
Clears the compile cache for all registered devices.
Also see
BaseDevice::clear_compile_cache
. Read moresource§fn typed_device_op<F, R>(&mut self, name: &str, task_type: TaskType, f: F) -> Rwhere
F: FnMut(&mut Device) -> R,
fn typed_device_op<F, R>(&mut self, name: &str, task_type: TaskType, f: F) -> Rwhere F: FnMut(&mut Device) -> R,
Executes a specified operation (given by the closure
f
) on a targeted device of a specific TaskType
. Read moresource§fn device_op<F, R>(&mut self, name: &str, f: F) -> Rwhere
F: FnMut(&mut Device) -> R,
fn device_op<F, R>(&mut self, name: &str, f: F) -> Rwhere F: FnMut(&mut Device) -> R,
Executes a specified operation (given by the closure
f
) on a targeted device without considering its TaskType
. Read moresource§fn typed_channel_op<F, R>(
&mut self,
name: &str,
chan_name: &str,
task_type: TaskType,
f: F
) -> Rwhere
F: FnMut(&mut Channel) -> R,
fn typed_channel_op<F, R>( &mut self, name: &str, chan_name: &str, task_type: TaskType, f: F ) -> Rwhere F: FnMut(&mut Channel) -> R,
Executes a specified operation (given by the closure
f
) on a targeted channel of a specific device and TaskType
. Read moresource§fn channel_op<F, R>(&mut self, name: &str, chan_name: &str, f: F) -> Rwhere
F: FnMut(&mut Channel) -> R,
fn channel_op<F, R>(&mut self, name: &str, chan_name: &str, f: F) -> Rwhere F: FnMut(&mut Channel) -> R,
Executes a specified operation (given by the closure
f
) on a targeted channel of a device without considering its TaskType
. Read moresource§fn add_ao_channel(&mut self, name: &str, channel_id: usize)
fn add_ao_channel(&mut self, name: &str, channel_id: usize)
Adds an analogue output (AO) channel to the designated device. Read more
source§fn add_do_channel(&mut self, name: &str, port_id: usize, line_id: usize)
fn add_do_channel(&mut self, name: &str, port_id: usize, line_id: usize)
Adds a digital output (DO) channel to the designated device. Read more
source§fn device_calc_signal_nsamps(
&mut self,
dev_name: &str,
start_pos: usize,
end_pos: usize,
nsamps: usize,
require_streamable: bool,
require_editable: bool
) -> Array2<f64>
fn device_calc_signal_nsamps( &mut self, dev_name: &str, start_pos: usize, end_pos: usize, nsamps: usize, require_streamable: bool, require_editable: bool ) -> Array2<f64>
Given interval and number of samples, calculates signal from specified device. Read more
source§fn device_cfg_samp_clk_src(&mut self, name: &str, src: &str)
fn device_cfg_samp_clk_src(&mut self, name: &str, src: &str)
Configures the sample clock source of a device in the experiment. Read more
source§fn device_cfg_trig(&mut self, name: &str, trig_line: &str, export_trig: bool)
fn device_cfg_trig(&mut self, name: &str, trig_line: &str, export_trig: bool)
Configures the trigger settings of a device in the experiment while ensuring synchronization. Read more
source§fn device_cfg_ref_clk(
&mut self,
name: &str,
ref_clk_line: &str,
ref_clk_rate: f64,
export_ref_clk: bool
)
fn device_cfg_ref_clk( &mut self, name: &str, ref_clk_line: &str, ref_clk_rate: f64, export_ref_clk: bool )
Configures the reference clock settings of a device in the experiment. Read more
source§fn device_edit_stop_time(&mut self, name: &str) -> f64
fn device_edit_stop_time(&mut self, name: &str) -> f64
Retrieves the
edit_stop_time
for a specific device. Read moresource§fn device_compiled_stop_time(&mut self, name: &str) -> f64
fn device_compiled_stop_time(&mut self, name: &str) -> f64
Retrieves the maximum
compiled_stop_time
from all registered devices. Read moresource§fn device_clear_compile_cache(&mut self, name: &str)
fn device_clear_compile_cache(&mut self, name: &str)
Clears the compilation cache for a specific device. Read more
source§fn device_clear_edit_cache(&mut self, name: &str)
fn device_clear_edit_cache(&mut self, name: &str)
Clears the edit cache for a specific device. Read more
source§fn device_compiled_channel_names(
&mut self,
name: &str,
require_streamable: bool,
require_editable: bool
) -> Vec<String>
fn device_compiled_channel_names( &mut self, name: &str, require_streamable: bool, require_editable: bool ) -> Vec<String>
Retrieves the names of compiled channels from the specified device based on the given requirements. Read more
source§fn constant(
&mut self,
dev_name: &str,
chan_name: &str,
t: f64,
duration: f64,
value: f64,
keep_val: bool
)
fn constant( &mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64, value: f64, keep_val: bool )
Adds a constant value instruction to the specified analogue output (AO) channel. Read more
source§fn sine(
&mut self,
dev_name: &str,
chan_name: &str,
t: f64,
duration: f64,
keep_val: bool,
freq: f64,
amplitude: Option<f64>,
phase: Option<f64>,
dc_offset: Option<f64>
)
fn sine( &mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64, keep_val: bool, freq: f64, amplitude: Option<f64>, phase: Option<f64>, dc_offset: Option<f64> )
Adds a sine waveform instruction to the specified analogue output (AO) channel. Read more
source§fn high(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)
fn high(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)
Sets the specified digital output (DO) channel to a high state for the given duration. Read more
source§fn low(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)
fn low(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)
Sets the specified digital output (DO) channel to a low state for the given duration. Read more
source§fn go_high(&mut self, dev_name: &str, chan_name: &str, t: f64)
fn go_high(&mut self, dev_name: &str, chan_name: &str, t: f64)
Sets the specified digital output (DO) channel to a high state, until the next instruction. Read more
source§fn go_low(&mut self, dev_name: &str, chan_name: &str, t: f64)
fn go_low(&mut self, dev_name: &str, chan_name: &str, t: f64)
Sets the specified digital output (DO) channel to a low state for a short duration. Read more
source§fn channel_clear_edit_cache(&mut self, dev_name: &str, chan_name: &str)
fn channel_clear_edit_cache(&mut self, dev_name: &str, chan_name: &str)
Clears the edit cache of the specified channel. Read more
source§impl PyClassImpl for Experiment
impl PyClassImpl for Experiment
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
§type Layout = PyCell<Experiment>
type Layout = PyCell<Experiment>
Layout
§type ThreadChecker = ThreadCheckerStub<Experiment>
type ThreadChecker = ThreadCheckerStub<Experiment>
This handles following two situations: Read more
type Inventory = Pyo3MethodsInventoryForExperiment
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<Experiment> for PyClassImplCollector<Experiment>
impl PyClassNewTextSignature<Experiment> for PyClassImplCollector<Experiment>
fn new_text_signature(self) -> Option<&'static str>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a Experiment
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a Experiment
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut Experiment
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut Experiment
source§impl PyTypeInfo for Experiment
impl PyTypeInfo for Experiment
§type AsRefTarget = PyCell<Experiment>
type AsRefTarget = PyCell<Experiment>
Utility type to make Py::as_ref work.
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Returns the safe abstraction over the type object.
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
Checks if
object
is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
Checks if
object
is an instance of this type.Auto Trait Implementations§
impl RefUnwindSafe for Experiment
impl Send for Experiment
impl Sync for Experiment
impl Unpin for Experiment
impl UnwindSafe for Experiment
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more