3.3.1.4. qupulse.hardware.awgs.zihdawg¶
Functions
|
|
|
Query channel offset voltage and optionally set it. |
|
|
|
Query channel signal output status (enabled/disabled) and optionally set it. |
|
|
|
|
|
|
|
Check if channel is a valid AWG channels. |
Classes
|
FAILS TO UPLOAD THE CORRECT ELF FOR SOME REASON |
|
This class organizes compiling and uploading of compiled programs. |
|
|
|
How many independent sequencers should run on the AWG and how the outputs should be grouped by sequencer. |
|
Modulation mode of waveform generator. |
|
HDAWGRepresentation represents an HDAWG8 instruments and manages a LabOne data server api session. |
|
Assign a signal to a marker output. |
|
All available voltage ranges for the HDAWG wave outputs. |
|
|
|
This implementation does not attempt to do something clever like caching. |
|
Exceptions
Base exception class for HDAWG errors. |
|
- class qupulse.hardware.awgs.zihdawg.CachingELFManager(awg_module: zhinst.ziPython.AwgModule)[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.ELFManager
FAILS TO UPLOAD THE CORRECT ELF FOR SOME REASON
- __init__(awg_module: zhinst.ziPython.AwgModule)[source]¶
FAILS TO UPLOAD THE CORRECT ELF FOR SOME REASON
- compile_and_upload(source_string: str) Generator[str, str, None] [source]¶
The source code is saved to a file determined by the source hash, compiled and uploaded to the instrument. The function returns a generator that yields the current state of the progress. The generator is empty iff the upload is complete. An exception is raised if there is an error.
To abort send ‘abort’ to the generator.
Example
>>> my_source = 'playWave("my_wave");' >>> for state in elf_manager.compile_and_upload(my_source): ... print('Current state:', state) ... time.sleep(1)
- Parameters
source_string – Source code to compile
- Returns
Generator object that needs to be consumed
- class qupulse.hardware.awgs.zihdawg.ELFManager(awg_module: zhinst.core.AwgModule)[source]¶
Bases:
abc.ABC
This class organizes compiling and uploading of compiled programs. The source code file is named based on the code hash to cache compilation results. This requires that the waveform names are unique.
The compilation and upload itself are done asynchronously by zhinst.core. To avoid spawning a useless thread for updating the status the method
compile_and_upload()
returns a generator which talks to the undelying library when needed.- class AWGModule(awg_module: zhinst.core.AwgModule)[source]¶
Bases:
object
Provide an easily mockable interface to the zhinst AwgModule object
- __init__(awg_module: zhinst.core.AwgModule)[source]¶
Provide an easily mockable interface to the zhinst AwgModule object
- property elf_dir: pathlib.Path¶
- property src_dir: pathlib.Path¶
- DEFAULT_CLS¶
- __init__(awg_module: zhinst.core.AwgModule)[source]¶
This class organizes compiling and uploading of compiled programs. The source code file is named based on the code hash to cache compilation results. This requires that the waveform names are unique.
The compilation and upload itself are done asynchronously by zhinst.core. To avoid spawning a useless thread for updating the status the method
compile_and_upload()
returns a generator which talks to the undelying library when needed.
- abstract compile_and_upload(source_string: str) Generator[str, str, None] [source]¶
The function returns a generator that yields the current state of the progress. The generator is empty iff the upload is complete. An exception is raised if there is an error.
To abort send ‘abort’ to the generator. (not implemented :P)
Example
>>> my_source = 'playWave("my_wave");' >>> for state in elf_manager.compile_and_upload(my_source): ... print('Current state:', state) ... time.sleep(1)
- Parameters
source_string – Source code to compile
- Returns
Generator object that needs to be consumed
- class qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup(identifier: str, timeout: float)[source]¶
Bases:
qupulse.hardware.awgs.base.AWG
- MIN_WAVEFORM_LEN = 192¶
- WAVEFORM_LEN_QUANTUM = 16¶
- arm(name: Optional[str]) None [source]¶
Load the program ‘name’ and arm the device for running it. If name is None the awg will “dearm” its current program.
Currently hardware triggering is not implemented. The HDAWGProgramManager needs to emit code that calls waitDigTrigger to do that.
- property awg_module: zhinst.core.AwgModule¶
Each AWG channel group has its own awg module to manage program compilation and upload.
- clear() None [source]¶
Removes all programs and waveforms from the AWG.
Caution: This affects all programs and waveforms on the AWG, not only those uploaded using qupulse!
- connect_group(hdawg_device: qupulse.hardware.awgs.zihdawg.HDAWGRepresentation)[source]¶
- property master_device: qupulse.hardware.awgs.zihdawg.HDAWGRepresentation¶
Reference to HDAWG representation.
- property programs: Set[str]¶
The set of program names that can currently be executed on the hardware AWG.
- remove(name: str) None [source]¶
Remove a program from the AWG.
Also discards all waveforms referenced only by the program identified by name.
- Parameters
name – The name of the program to remove.
- property sample_rate: qupulse.utils.types.TimeType¶
The default sample rate of the AWG channel group.
- set_volatile_parameters(program_name: str, parameters: Mapping[str, numbers.Real])[source]¶
Set the values of parameters which were marked as volatile on program creation.
- upload(name: str, program: qupulse.program.loop.Loop, channels: Tuple[Optional[Union[str, int]], ...], markers: Tuple[Optional[Union[str, int]], ...], voltage_transformation: Tuple[Callable, ...], force: bool = False) None [source]¶
Upload a program to the AWG.
Physically uploads all waveforms required by the program - excluding those already present - to the device and sets up playback sequences accordingly. This method should be cheap for program already on the device and can therefore be used for syncing. Programs that are uploaded should be fast(~1 sec) to arm.
- Parameters
name – A name for the program on the AWG.
program – The program (a sequence of instructions) to upload.
channels – Tuple of length num_channels that ChannelIDs of in the program to use. Position in the list
channel (in the list corresponds to the AWG) –
markers – List of channels in the program to use. Position in the List in the list corresponds to
channel –
voltage_transformation – transformations applied to the waveforms extracted rom the program. Position
channel –
force – If a different sequence is already present with the same name, it is overwritten if force is set to True. (default = False)
Known programs are handled in host memory most of the time. Only when uploading the device memory is touched at all.
Returning from setting user register in seqc can take from 50ms to 60 ms. Fluctuates heavily. Not a good way to have deterministic behaviour “setUserReg(PROG_SEL, PROG_IDLE);”.
- user_register(reg: qupulse._program.seqc.UserRegister, value: Optional[int] = None) int [source]¶
Query user registers (1-16) and optionally set it.
- Parameters
reg – User register. If it is an int, a warning is raised and it is interpreted as a one based index
value – Value to set
- Returns
User Register value after setting it
- class qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping(value)[source]¶
Bases:
enum.Enum
How many independent sequencers should run on the AWG and how the outputs should be grouped by sequencer.
- CHAN_GROUP_1x8 = 2¶
- CHAN_GROUP_2x4 = 1¶
- CHAN_GROUP_4x2 = 0¶
- MDS = -1¶
- exception qupulse.hardware.awgs.zihdawg.HDAWGException[source]¶
Bases:
Exception
Base exception class for HDAWG errors.
- exception qupulse.hardware.awgs.zihdawg.HDAWGIOError[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGException
,OSError
- class qupulse.hardware.awgs.zihdawg.HDAWGModulationMode(value)[source]¶
Bases:
enum.Enum
Modulation mode of waveform generator.
- ADVANCED = 5¶
- FG_1 = 3¶
- FG_2 = 4¶
- OFF = 0¶
- SINE_1 = 1¶
- SINE_2 = 2¶
- class qupulse.hardware.awgs.zihdawg.HDAWGRepresentation(device_serial: Optional[str] = None, device_interface: str = '1GbE', data_server_addr: str = 'localhost', data_server_port: int = 8004, api_level_number: int = 6, reset: bool = False, timeout: float = 20, grouping: Optional[qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping] = None)[source]¶
Bases:
object
HDAWGRepresentation represents an HDAWG8 instruments and manages a LabOne data server api session. A data server must be running and the device be discoverable. Channels are per default grouped into pairs.
- Parameters
device_serial – Device serial that uniquely identifies this device to the LabOne data server
device_interface – Either ‘1GbE’ for ethernet or ‘USB’
data_server_addr – Data server address. Must be already running. Default: localhost
data_server_port – Data server port. Default: 8004 for HDAWG, MF and UHF devices
api_level_number – Version of API to use for the session, higher number, newer. Default: 6 most recent
reset – Reset device before initialization
timeout – Timeout in seconds for uploading
- __init__(device_serial: Optional[str] = None, device_interface: str = '1GbE', data_server_addr: str = 'localhost', data_server_port: int = 8004, api_level_number: int = 6, reset: bool = False, timeout: float = 20, grouping: Optional[qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping] = None) None [source]¶
- Parameters
device_serial – Device serial that uniquely identifies this device to the LabOne data server
device_interface – Either ‘1GbE’ for ethernet or ‘USB’
data_server_addr – Data server address. Must be already running. Default: localhost
data_server_port – Data server port. Default: 8004 for HDAWG, MF and UHF devices
api_level_number – Version of API to use for the session, higher number, newer. Default: 6 most recent
reset – Reset device before initialization
timeout – Timeout in seconds for uploading
- property api_session: zhinst.core.ziDAQServer¶
- property channel_grouping: qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping¶
- property channel_pair_AB: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup¶
- property channel_pair_CD: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup¶
- property channel_pair_EF: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup¶
- property channel_pair_GH: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup¶
- property channel_tuples: Tuple[qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup, ...]¶
- get_status_table()[source]¶
Return node tree of instrument with all important settings, as well as each channel group as tuple.
- offset(channel: int, voltage: float = None) float [source]¶
Query channel offset voltage and optionally set it.
- output(channel: int, status: bool = None) bool [source]¶
Query channel signal output status (enabled/disabled) and optionally set it. Corresponds to front LED.
- range(channel: int, voltage: float = None) float [source]¶
Query channel voltage range and optionally set it. The instruments selects the next higher available range. This is the one-sided range Vp. Total range: -Vp…Vp
- property waveform_file_system: qupulse._program.seqc.WaveformFileSystem¶
- exception qupulse.hardware.awgs.zihdawg.HDAWGRuntimeError[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGException
,RuntimeError
- exception qupulse.hardware.awgs.zihdawg.HDAWGTimeoutError[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGException
,TimeoutError
- class qupulse.hardware.awgs.zihdawg.HDAWGTriggerOutSource(value)[source]¶
Bases:
enum.Enum
Assign a signal to a marker output. This is per AWG Core.
- AWG_TRIG_1 = 0¶
- AWG_TRIG_2 = 1¶
- AWG_TRIG_3 = 2¶
- AWG_TRIG_4 = 3¶
- HIGH = 17¶
- LOW = 18¶
- OUT_1_MARK_1 = 4¶
- OUT_1_MARK_2 = 5¶
- OUT_2_MARK_1 = 6¶
- OUT_2_MARK_2 = 7¶
- TRIG_IN_1 = 8¶
- TRIG_IN_2 = 9¶
- TRIG_IN_3 = 10¶
- TRIG_IN_4 = 11¶
- TRIG_IN_5 = 12¶
- TRIG_IN_6 = 13¶
- TRIG_IN_7 = 14¶
- TRIG_IN_8 = 15¶
- exception qupulse.hardware.awgs.zihdawg.HDAWGTypeError[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGException
,TypeError
- exception qupulse.hardware.awgs.zihdawg.HDAWGValueError[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGException
,ValueError
- class qupulse.hardware.awgs.zihdawg.HDAWGVoltageRange(value)[source]¶
Bases:
enum.Enum
All available voltage ranges for the HDAWG wave outputs. Define maximum output voltage.
- RNG_1V = 1¶
- RNG_200mV = 0.2¶
- RNG_2V = 2¶
- RNG_3V = 3¶
- RNG_400mV = 0.4¶
- RNG_4V = 4¶
- RNG_5V = 5¶
- RNG_600mV = 0.6¶
- RNG_800mV = 0.8¶
- class qupulse.hardware.awgs.zihdawg.MDSChannelGroup(identifier: str, timeout: float)[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup
- amplitudes() Tuple[float, ...] [source]¶
Query AWG channel amplitude value (not peak to peak).
From manual: The final signal amplitude is given by the product of the full scale output range of 1 V[in this example], the dimensionless amplitude scaling factor 1.0, and the actual dimensionless signal amplitude stored in the waveform memory.
- property awg_group_index¶
- connect_group(hdawg_device: qupulse.hardware.awgs.zihdawg.HDAWGRepresentation)[source]¶
- class qupulse.hardware.awgs.zihdawg.SimpleELFManager(awg_module: zhinst.ziPython.AwgModule)[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.ELFManager
This implementation does not attempt to do something clever like caching.
- __init__(awg_module: zhinst.ziPython.AwgModule)[source]¶
This implementation does not attempt to do something clever like caching.
- compile_and_upload(source_string: str) Generator[str, str, None] [source]¶
The function returns a generator that yields the current state of the progress. The generator is empty iff the upload is complete. An exception is raised if there is an error.
To abort send ‘abort’ to the generator. (not implemented :P)
Example
>>> my_source = 'playWave("my_wave");' >>> for state in elf_manager.compile_and_upload(my_source): ... print('Current state:', state) ... time.sleep(1)
- Parameters
source_string – Source code to compile
- Returns
Generator object that needs to be consumed
- class qupulse.hardware.awgs.zihdawg.SingleDeviceChannelGroup(group_idx: int, group_size: int, identifier: str, timeout: float)[source]¶
Bases:
qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup
- amplitudes() Tuple[float, ...] [source]¶
Query AWG channel amplitude value (not peak to peak).
From manual: The final signal amplitude is given by the product of the full scale output range of 1 V[in this example], the dimensionless amplitude scaling factor 1.0, and the actual dimensionless signal amplitude stored in the waveform memory.
- qupulse.hardware.awgs.zihdawg.example_upload(hdawg_kwargs: dict, channels: Set[int], markers: Set[Tuple[int, int]])[source]¶
- qupulse.hardware.awgs.zihdawg.get_group_for_channels(hdawg: qupulse.hardware.awgs.zihdawg.HDAWGRepresentation, channels: Set[int]) qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup [source]¶