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

source

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

source

pub fn edit_stop_time(&self) -> f64

source

pub fn compiled_stop_time(&self) -> f64

source

pub fn compile(&mut self) -> f64

source

pub fn compile_with_stoptime(&mut self, stop_time: f64)

source

pub fn is_edited(&self) -> bool

source

pub fn is_compiled(&self) -> bool

source

pub fn is_fresh_compiled(&self) -> bool

source

pub fn clear_edit_cache(&mut self)

source

pub fn clear_compile_cache(&mut self)

source

pub fn add_ao_channel(&mut self, name: &str, channel_id: usize)

source

pub fn add_do_channel(&mut self, name: &str, port_id: usize, line_id: usize)

source

pub fn device_cfg_samp_clk_src(&mut self, name: &str, src: &str)

source

pub fn device_cfg_trig( &mut self, name: &str, trig_line: &str, export_trig: bool )

source

pub fn device_cfg_ref_clk( &mut self, name: &str, ref_clk_line: &str, ref_clk_rate: f64, export_ref_clk: bool )

source

pub fn device_compiled_channel_names( &mut self, name: &str, require_streamable: bool, require_editable: bool ) -> Vec<String>

source

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>

source

pub fn device_edit_stop_time(&mut self, name: &str) -> f64

source

pub fn device_compiled_stop_time(&mut self, name: &str) -> f64

source

pub fn device_clear_compile_cache(&mut self, name: &str)

source

pub fn device_clear_edit_cache(&mut self, name: &str)

source

pub fn constant( &mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64, value: f64, keep_val: bool )

source

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> )

source

pub fn high(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)

source

pub fn low(&mut self, dev_name: &str, chan_name: &str, t: f64, duration: f64)

source

pub fn go_high(&mut self, dev_name: &str, chan_name: &str, t: f64)

source

pub fn go_low(&mut self, dev_name: &str, chan_name: &str, t: f64)

source

pub fn channel_clear_compile_cache(&mut self, dev_name: &str, chan_name: &str)

source

pub fn channel_clear_edit_cache(&mut self, dev_name: &str, chan_name: &str)

source

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

source§

fn devices(&self) -> &HashMap<String, Device>

source§

fn devices_(&mut self) -> &mut HashMap<String, Device>

source§

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)

Asserts that the specified channel exists within the given device in the experiment. Read more
source§

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)

Registers an Analog Output (AO) device to the experiment. Read more
source§

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

Retrieves the latest edit_stop_time from all registered devices. See BaseDevice::edit_stop_time for more information. Read more
source§

fn compiled_stop_time(&self) -> f64

Retrieves the compiled_stop_time from all registered devices. See BaseDevice::compiled_stop_time for more information. Read more
source§

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 more
source§

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>

Retrieves a list of devices that have been successfully compiled. Read more
source§

fn is_edited(&self) -> bool

Checks if any of the registered devices have been edited. Also see BaseDevice::is_edited. Read more
source§

fn is_compiled(&self) -> bool

Checks if any of the registered devices have been compiled. Also see BaseDevice::is_compiled. Read more
source§

fn is_fresh_compiled(&self) -> bool

Checks if all registered devices are in a freshly compiled state. Also see BaseDevice::is_fresh_compiled. Read more
source§

fn clear_edit_cache(&mut self)

Clears the edit cache for all registered devices. Also see BaseDevice::clear_edit_cache. Read more
source§

fn clear_compile_cache(&mut self)

Clears the compile cache for all registered devices. Also see BaseDevice::clear_compile_cache. Read more
source§

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 more
source§

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 more
source§

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 more
source§

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 more
source§

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)

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>

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)

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)

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 )

Configures the reference clock settings of a device in the experiment. Read more
source§

fn device_edit_stop_time(&mut self, name: &str) -> f64

Retrieves the edit_stop_time for a specific device. Read more
source§

fn device_compiled_stop_time(&mut self, name: &str) -> f64

Retrieves the maximum compiled_stop_time from all registered devices. Read more
source§

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)

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>

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 )

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> )

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)

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)

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)

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)

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)

Clears the edit cache of the specified channel. Read more
source§

fn channel_calc_signal_nsamps( &mut self, dev_name: &str, chan_name: &str, start_time: f64, end_time: f64, num_samps: usize ) -> Vec<f64>

Calculates the sampled signal for a given channel over a specified time interval. Read more
source§

fn channel_clear_compile_cache(&mut self, dev_name: &str, chan_name: &str)

Clears the compile cache of the specified channel. Read more
source§

impl IntoPy<Py<PyAny>> for Experiment

source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
source§

impl PyClass for Experiment

§

type Frozen = False

Whether the pyclass is frozen. Read more
source§

impl PyClassImpl for Experiment

source§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
§

type Layout = PyCell<Experiment>

Layout
§

type BaseType = PyAny

Base class
§

type ThreadChecker = ThreadCheckerStub<Experiment>

This handles following two situations: Read more
§

type Inventory = Pyo3MethodsInventoryForExperiment

§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
source§

fn items_iter() -> PyClassItemsIter

source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

source§

fn dict_offset() -> Option<isize>

source§

fn weaklist_offset() -> Option<isize>

source§

impl PyClassNewTextSignature<Experiment> for PyClassImplCollector<Experiment>

source§

fn new_text_signature(self) -> Option<&'static str>

source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a Experiment

§

type Holder = Option<PyRef<'py, Experiment>>

source§

fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut Experiment

§

type Holder = Option<PyRefMut<'py, Experiment>>

source§

fn extract(obj: &'py PyAny, holder: &'a mut Self::Holder) -> PyResult<Self>

source§

impl PyTypeInfo for Experiment

§

type AsRefTarget = PyCell<Experiment>

Utility type to make Py::as_ref work.
source§

const NAME: &'static str = _

Class name.
source§

const MODULE: Option<&'static str> = ::core::option::Option::None

Module name, if any.
source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
source§

fn type_object(py: Python<'_>) -> &PyType

Returns the safe abstraction over the type object.
source§

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

Checks if object is an instance of this type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OkWrap<T> for Twhere T: IntoPy<Py<PyAny>>,

§

type Error = PyErr

source§

fn wrap(self, py: Python<'_>) -> Result<Py<PyAny>, PyErr>

source§

impl<T> PyErrArguments for Twhere T: IntoPy<Py<PyAny>> + Send + Sync,

source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Ungil for Twhere T: Send,