rx_device
rx_device
Implementation of receive card.
RxCard
dataclass
RxCard(path: str, sample_rate: int, channel_enable: tuple[bool, ...], max_amplitude: tuple[int, ...], impedance_50_ohms: tuple[bool, ...])
Bases: SpectrumDevice
Receive card (digitizer).
Implementation of the abstract SpectrumDevice for the Spectrum Instrumentation M2p.59xx series,
developed and tested with the M2p.5933-x4 (up to 8 channels).
The card is the clock master of the system: it runs on its internal PLL and exports its clock
to the transmit card. Data are recorded in gated FIFO mode (SPC_REC_FIFO_GATE).
The ADC gate generated by the transmit card is applied to the external trigger input.
Start and end of each gate are recorded by the timestamp engine.
The digital phase reference (input X2) is sampled synchronously into bit 15 of analog channel 0.
Initialize the receive card.
Parameters:
-
path(str) –Path of the spectrum card device, e.g. /dev/spcm0
-
sample_rate(int) –Card sampling rate in MHz.
-
channel_enable(tuple[bool, ...]) –Enable flag per channel (8 entries); the number of enabled channels must be 1, 2, 4 or 8.
-
max_amplitude(tuple[int, ...]) –Input range per channel in mV.
-
impedance_50_ohms(tuple[bool, ...]) –Input termination per channel, True for 50 Ohm, False for high impedance (1 MOhm).
Source code in src/console/spcm_control/rx_device.py
total_gates
property
total_gates: int
Helper function to return the number of gates that have been collected by the Rx Card.
setup_card
Set up spectrum card in receive (RX) mode.
The card is reset and its type is verified (M2p.59xx). The clock is set to the internal PLL with clock output enabled, and the sampling rate is set from the class attribute. The enabled channels (1, 2, 4 or 8) are configured with input range and termination. X2 is configured as digital input and sampled into bit 15 of channel 0. The card is armed in gated FIFO mode on the positive edge of the external trigger (ADC gate), with timestamps recording start and end of each gate.
Raises:
-
Warning–The actual set sample rate deviates from the corresponding class attribute to be set, class attribute is overwritten.
Source code in src/console/spcm_control/rx_device.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
start_operation
start_operation(submit_fn: Callable[[int, RxData], None] | None = None, index_offset: int = 0) -> None
Start card operation.
Parameters:
-
submit_fn(Callable[[int, RxData], None] | None, default:None) –Optional callback invoked as
submit_fn(global_index, rx_data)for each completed gate. When provided the gate's slot inrx_datais set toNoneimmediately after the call so the caller owns the object. WhenNonethe populated items remain inrx_datafor the caller to collect afterstop_operation(). -
index_offset(int, default:0) –Added to the per-gate index before calling submit_fn, allowing the caller to assign globally unique indices across multiple averages.
Source code in src/console/spcm_control/rx_device.py
stop_operation
Stop card thread.