sqdtoolz 0.9.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqdtoolz/Drivers/ACQ_ETH_FPGA.py +509 -0
- sqdtoolz/Drivers/ACQ_M4i_Digitiser.py +397 -0
- sqdtoolz/Drivers/ACQ_TektronixDSA70804B.py +775 -0
- sqdtoolz/Drivers/ATTEN_Vaunix.py +106 -0
- sqdtoolz/Drivers/AWG5014C.py +296 -0
- sqdtoolz/Drivers/Agilent_N8241A.py +1797 -0
- sqdtoolz/Drivers/DDG_DG645.py +232 -0
- sqdtoolz/Drivers/DSO_DS1054Z.py +426 -0
- sqdtoolz/Drivers/Dependencies/Agilent_N8241A_constants_python3.py +794 -0
- sqdtoolz/Drivers/Dependencies/PrologixGPIBEthernet.py +65 -0
- sqdtoolz/Drivers/Dependencies/RPi_gpio_interface.py +91 -0
- sqdtoolz/Drivers/Dependencies/RPi_serial_interface.py +82 -0
- sqdtoolz/Drivers/Dependencies/Spectrum/M4i.py +1380 -0
- sqdtoolz/Drivers/Dependencies/Spectrum/__init__.py +0 -0
- sqdtoolz/Drivers/Dependencies/Spectrum/py_header/__init__.py +0 -0
- sqdtoolz/Drivers/Dependencies/Spectrum/py_header/regs.py +2863 -0
- sqdtoolz/Drivers/Dependencies/Spectrum/py_header/spcerr.py +81 -0
- sqdtoolz/Drivers/Dependencies/Spectrum/pyspcm.py +245 -0
- sqdtoolz/Drivers/Dependencies/teproteus.py +977 -0
- sqdtoolz/Drivers/Dependencies/tevisainst.py +498 -0
- sqdtoolz/Drivers/FGEN_FY6900.py +234 -0
- sqdtoolz/Drivers/MWS_SGS100A.py +203 -0
- sqdtoolz/Drivers/MWS_SMB100A.py +274 -0
- sqdtoolz/Drivers/MWS_WFSynthHDProV2.py +222 -0
- sqdtoolz/Drivers/MWS_WFSynthHDProV2_RPi.py +56 -0
- sqdtoolz/Drivers/SA_RS_FSV.py +246 -0
- sqdtoolz/Drivers/SMU_B2901A.py +226 -0
- sqdtoolz/Drivers/SMU_Keithley236.py +404 -0
- sqdtoolz/Drivers/SMU_TENMA_72_2710.py +192 -0
- sqdtoolz/Drivers/SW_BJT_RPi.py +87 -0
- sqdtoolz/Drivers/SW_BJT_RPi_Multi.py +107 -0
- sqdtoolz/Drivers/SW_FPGA_VNA.py +114 -0
- sqdtoolz/Drivers/SW_RFSwitchController_CryoRadiall.py +146 -0
- sqdtoolz/Drivers/SW_RPiCryo.py +198 -0
- sqdtoolz/Drivers/SW_RPiRadial.py +183 -0
- sqdtoolz/Drivers/SW_RpiIQBox.py +41 -0
- sqdtoolz/Drivers/THERM_TC0309.py +72 -0
- sqdtoolz/Drivers/Tabor_P2584M.py +1874 -0
- sqdtoolz/Drivers/VNA_Agilent_N5232A.py +680 -0
- sqdtoolz/Drivers/VNA_Keysight_P9373A.py +17 -0
- sqdtoolz/Drivers/VOLT_Delft_IVVI.py +1194 -0
- sqdtoolz/Drivers/VOLT_IVVI_pyro.py +135 -0
- sqdtoolz/Drivers/VOLT_RpiMultiDAC.py +74 -0
- sqdtoolz/Drivers/VOLT_SIM928_PLX.py +371 -0
- sqdtoolz/Drivers/VOLT_SIM928_VCOM.py +381 -0
- sqdtoolz/Drivers/VOLT_SIM928_pyro.py +50 -0
- sqdtoolz/Drivers/VOLT_Stahl_16CH.py +304 -0
- sqdtoolz/Drivers/ZILabOneQ.py +41 -0
- sqdtoolz/Drivers/__init__.py +0 -0
- sqdtoolz/Drivers/dummyACQ.py +109 -0
- sqdtoolz/Drivers/dummyACQex.py +120 -0
- sqdtoolz/Drivers/dummyAWG.py +121 -0
- sqdtoolz/Drivers/dummyDDG.py +116 -0
- sqdtoolz/Drivers/dummyGENmwSource.py +125 -0
- sqdtoolz/Drivers/dummySMU.py +100 -0
- sqdtoolz/Experiment.py +406 -0
- sqdtoolz/ExperimentConfiguration.py +464 -0
- sqdtoolz/ExperimentSpecification.py +150 -0
- sqdtoolz/ExperimentSpecifications/__init__.py +0 -0
- sqdtoolz/ExperimentSweeps.py +70 -0
- sqdtoolz/Experiments/Experimental/ExpACstarkRamseyGE.py +122 -0
- sqdtoolz/Experiments/Experimental/ExpBodePlot.py +69 -0
- sqdtoolz/Experiments/Experimental/ExpCalibGE.py +67 -0
- sqdtoolz/Experiments/Experimental/ExpCalibXrot.py +107 -0
- sqdtoolz/Experiments/Experimental/ExpCalibXrotAuto.py +126 -0
- sqdtoolz/Experiments/Experimental/ExpGateBenchmarks.py +109 -0
- sqdtoolz/Experiments/Experimental/ExpHahnGE.py +121 -0
- sqdtoolz/Experiments/Experimental/ExpMixerCalibrationLO.py +130 -0
- sqdtoolz/Experiments/Experimental/ExpMixerCalibrationSB.py +102 -0
- sqdtoolz/Experiments/Experimental/ExpPeakScouterIQ.py +68 -0
- sqdtoolz/Experiments/Experimental/ExpPulsedCavitySpec.py +93 -0
- sqdtoolz/Experiments/Experimental/ExpQubitFluxSweep.py +83 -0
- sqdtoolz/Experiments/Experimental/ExpRabi.py +170 -0
- sqdtoolz/Experiments/Experimental/ExpRamseyGE.py +125 -0
- sqdtoolz/Experiments/Experimental/ExpRandomisedBenchmarking.py +142 -0
- sqdtoolz/Experiments/Experimental/ExpResistanceIVs.py +54 -0
- sqdtoolz/Experiments/Experimental/ExpResistanceIVsFast.py +45 -0
- sqdtoolz/Experiments/Experimental/ExpSingleShotGE.py +74 -0
- sqdtoolz/Experiments/Experimental/ExpT1GE.py +119 -0
- sqdtoolz/Experiments/Experimental/ExpVNAEquations.py +120 -0
- sqdtoolz/Experiments/Experimental/ExpVNAoptimalSNR.py +38 -0
- sqdtoolz/Experiments/Experimental/ExpZIActiveResetTuneup.py +81 -0
- sqdtoolz/Experiments/Experimental/ExpZIBenchmarkETH.py +95 -0
- sqdtoolz/Experiments/Experimental/ExpZIBlobs.py +83 -0
- sqdtoolz/Experiments/Experimental/ExpZICalibX.py +142 -0
- sqdtoolz/Experiments/Experimental/ExpZIChevrons.py +65 -0
- sqdtoolz/Experiments/Experimental/ExpZIChevrons2QFixedCoupler.py +182 -0
- sqdtoolz/Experiments/Experimental/ExpZICryoscope.py +313 -0
- sqdtoolz/Experiments/Experimental/ExpZIDailyTuneup.py +132 -0
- sqdtoolz/Experiments/Experimental/ExpZIDispersive.py +110 -0
- sqdtoolz/Experiments/Experimental/ExpZIDragScaling.py +90 -0
- sqdtoolz/Experiments/Experimental/ExpZIFixedCouplerTuneup.py +152 -0
- sqdtoolz/Experiments/Experimental/ExpZIQASM.py +133 -0
- sqdtoolz/Experiments/Experimental/ExpZIQASMDataViewer.py +63 -0
- sqdtoolz/Experiments/Experimental/ExpZIQubitFluxSweep.py +252 -0
- sqdtoolz/Experiments/Experimental/ExpZIQubitPowerSweep.py +114 -0
- sqdtoolz/Experiments/Experimental/ExpZIQubitSpec.py +59 -0
- sqdtoolz/Experiments/Experimental/ExpZIRabi.py +111 -0
- sqdtoolz/Experiments/Experimental/ExpZIRabiRamseyT1.py +164 -0
- sqdtoolz/Experiments/Experimental/ExpZIRamsey.py +103 -0
- sqdtoolz/Experiments/Experimental/ExpZIRandomisedBenchmarking.py +126 -0
- sqdtoolz/Experiments/Experimental/ExpZIRes.py +123 -0
- sqdtoolz/Experiments/Experimental/ExpZIResFluxSweep.py +101 -0
- sqdtoolz/Experiments/Experimental/ExpZIResOptimal.py +224 -0
- sqdtoolz/Experiments/Experimental/ExpZIResPowerSweep.py +66 -0
- sqdtoolz/Experiments/Experimental/ExpZISingleQubitTuneup.py +363 -0
- sqdtoolz/Experiments/Experimental/ExpZIT1.py +86 -0
- sqdtoolz/Experiments/Experimental/ExpZIT1SingleShot.py +53 -0
- sqdtoolz/Experiments/Experimental/ExpZITWPATuneup.py +134 -0
- sqdtoolz/Experiments/Experimental/ExpZIqubit.py +289 -0
- sqdtoolz/Experiments/Experimental/ZI/calibrate_tunable_transmon_fixed_coupler.py +311 -0
- sqdtoolz/Experiments/Experimental/ZI/calibrate_tunable_transmon_fixed_coupler_osc.py +291 -0
- sqdtoolz/Experiments/Experimental/ZI/cryo_scope.py +329 -0
- sqdtoolz/Experiments/Experimental/ZI/flux_scope.py +309 -0
- sqdtoolz/Experiments/Experimental/ZI/oqasm_scheduled_qubits.py +320 -0
- sqdtoolz/Experiments/Experimental/ZI/qubit_single_chevron.py +290 -0
- sqdtoolz/Experiments/Experimental/ZI/qubit_spectroscopy_gef.py +288 -0
- sqdtoolz/Experiments/Experimental/ZI/single_qubit_gates.py +259 -0
- sqdtoolz/Experiments/Experimental/ZI/single_qubit_gates_sweep.py +280 -0
- sqdtoolz/Experiments/Experimental/ZI/sinlge_qubit_gates_sweep_chunking.py +288 -0
- sqdtoolz/HAL/ACQ.py +171 -0
- sqdtoolz/HAL/ACQdso.py +166 -0
- sqdtoolz/HAL/ACQsa.py +108 -0
- sqdtoolz/HAL/ACQvna.py +192 -0
- sqdtoolz/HAL/AWG.py +1057 -0
- sqdtoolz/HAL/DDG.py +93 -0
- sqdtoolz/HAL/DataProcessor.py +45 -0
- sqdtoolz/HAL/DecisionBlock.py +10 -0
- sqdtoolz/HAL/Decisions/DEC_SVM.py +38 -0
- sqdtoolz/HAL/GENatten.py +34 -0
- sqdtoolz/HAL/GENfuncGen.py +86 -0
- sqdtoolz/HAL/GENmwSource.py +132 -0
- sqdtoolz/HAL/GENmwSrcAWG.py +157 -0
- sqdtoolz/HAL/GENsmu.py +176 -0
- sqdtoolz/HAL/GENswitch.py +38 -0
- sqdtoolz/HAL/GENswitchTrig.py +44 -0
- sqdtoolz/HAL/GENtherm.py +29 -0
- sqdtoolz/HAL/GENvoltSource.py +50 -0
- sqdtoolz/HAL/HALbase.py +78 -0
- sqdtoolz/HAL/LockableProperties.py +22 -0
- sqdtoolz/HAL/MultiACQ.py +160 -0
- sqdtoolz/HAL/Processors/CPU/CPU_AmpPhs.py +48 -0
- sqdtoolz/HAL/Processors/CPU/CPU_ChannelArithmetic.py +72 -0
- sqdtoolz/HAL/Processors/CPU/CPU_ConstantArithmetic.py +54 -0
- sqdtoolz/HAL/Processors/CPU/CPU_DDC.py +52 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Decimation.py +47 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Duplicate.py +35 -0
- sqdtoolz/HAL/Processors/CPU/CPU_ESD.py +54 -0
- sqdtoolz/HAL/Processors/CPU/CPU_FFT.py +55 -0
- sqdtoolz/HAL/Processors/CPU/CPU_FIR.py +67 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Integrate.py +39 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Max.py +39 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Mean.py +39 -0
- sqdtoolz/HAL/Processors/CPU/CPU_MeanBlock.py +46 -0
- sqdtoolz/HAL/Processors/CPU/CPU_MeanVariance.py +43 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Rename.py +27 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Slice.py +46 -0
- sqdtoolz/HAL/Processors/CPU/CPU_Variance.py +39 -0
- sqdtoolz/HAL/Processors/CPU/CPU_kMeans.py +49 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_DDC.py +54 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_DDCFIR.py +62 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_Decimation.py +29 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_FFT.py +24 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_FIR.py +56 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_Integrate.py +27 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_Mean.py +27 -0
- sqdtoolz/HAL/Processors/FPGA/FPGA_MultiplierConst.py +47 -0
- sqdtoolz/HAL/Processors/GPU/GPU_ChannelArithmetic.py +74 -0
- sqdtoolz/HAL/Processors/GPU/GPU_ConstantArithmetic.py +54 -0
- sqdtoolz/HAL/Processors/GPU/GPU_DDC.py +52 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Decimation.py +52 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Duplicate.py +35 -0
- sqdtoolz/HAL/Processors/GPU/GPU_ESD.py +56 -0
- sqdtoolz/HAL/Processors/GPU/GPU_FFT.py +57 -0
- sqdtoolz/HAL/Processors/GPU/GPU_FIR.py +87 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Integrate.py +37 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Max.py +37 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Mean.py +37 -0
- sqdtoolz/HAL/Processors/GPU/GPU_MeanBlock.py +47 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Rename.py +27 -0
- sqdtoolz/HAL/Processors/GPU/GPU_Slice.py +37 -0
- sqdtoolz/HAL/Processors/ProcessorCPU.py +176 -0
- sqdtoolz/HAL/Processors/ProcessorFPGA.py +91 -0
- sqdtoolz/HAL/Processors/ProcessorGPU.py +197 -0
- sqdtoolz/HAL/SOFTpid.py +169 -0
- sqdtoolz/HAL/SOFTqpu.py +254 -0
- sqdtoolz/HAL/TriggerPulse.py +223 -0
- sqdtoolz/HAL/WaveformGeneric.py +49 -0
- sqdtoolz/HAL/WaveformMapper.py +11 -0
- sqdtoolz/HAL/WaveformSegments.py +601 -0
- sqdtoolz/HAL/WaveformTransformations.py +221 -0
- sqdtoolz/HAL/ZI/QuantumElements/TunableTransmonCouplerFixed.py +139 -0
- sqdtoolz/HAL/ZI/QuantumElements/__init__.py +18 -0
- sqdtoolz/HAL/ZI/ZIACQ.py +209 -0
- sqdtoolz/HAL/ZI/ZIPulses.py +253 -0
- sqdtoolz/HAL/ZI/ZIQuantumElement.py +126 -0
- sqdtoolz/HAL/ZI/ZIQubit.py +294 -0
- sqdtoolz/HAL/ZI/ZIbase.py +3 -0
- sqdtoolz/HAL/ZI/__init__.py +3 -0
- sqdtoolz/Laboratory.py +654 -0
- sqdtoolz/Utilities/DataFitting.py +776 -0
- sqdtoolz/Utilities/DataIQDiscriminate.py +160 -0
- sqdtoolz/Utilities/DataIQNormalise.py +76 -0
- sqdtoolz/Utilities/DataQubitFlux.py +309 -0
- sqdtoolz/Utilities/DataSingleShotThreshold.py +92 -0
- sqdtoolz/Utilities/ExperimentViewer.py +878 -0
- sqdtoolz/Utilities/FileConverter.py +49 -0
- sqdtoolz/Utilities/FileIO.py +592 -0
- sqdtoolz/Utilities/FileJSON.py +48 -0
- sqdtoolz/Utilities/Flattenator.py +168 -0
- sqdtoolz/Utilities/Miscellaneous.py +111 -0
- sqdtoolz/Utilities/OpenQASM/ParserOpenQASM.py +1195 -0
- sqdtoolz/Utilities/OpenQASM/ScheduleParametersJSONConfigZI.py +72 -0
- sqdtoolz/Utilities/OpenQASM/ScheduleParametersSoftQPUZI.py +44 -0
- sqdtoolz/Utilities/OpenQASM/__init__.py +27 -0
- sqdtoolz/Utilities/OpenQASM/includes/stdgates.inc +270 -0
- sqdtoolz/Utilities/OpenQASM/includes/stdgates_transmon_fixed_coupler.inc +24 -0
- sqdtoolz/Utilities/Optimisers.py +64 -0
- sqdtoolz/Utilities/QubitGates.py +264 -0
- sqdtoolz/Utilities/ResonatorTools.py +2469 -0
- sqdtoolz/Utilities/TimingPlots.py +328 -0
- sqdtoolz/Variable.py +387 -0
- sqdtoolz/__init__.py +42 -0
- sqdtoolz-0.9.0.dev1.dist-info/METADATA +125 -0
- sqdtoolz-0.9.0.dev1.dist-info/RECORD +228 -0
- sqdtoolz-0.9.0.dev1.dist-info/WHEEL +5 -0
- sqdtoolz-0.9.0.dev1.dist-info/licenses/LICENSE +203 -0
- sqdtoolz-0.9.0.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import scipy
|
|
2
|
+
import logging
|
|
3
|
+
import numpy as np
|
|
4
|
+
from qcodes import validators as vals, ManualParameter, ArrayParameter
|
|
5
|
+
# from qcodes.instrument_drivers.sqdlab.ADCProcessorGPU import TvModeGPU
|
|
6
|
+
from sqdtoolz.Drivers.Dependencies.Spectrum.M4i import M4i
|
|
7
|
+
import sqdtoolz.Drivers.Dependencies.Spectrum.pyspcm as spcm
|
|
8
|
+
from qcodes.instrument.base import Instrument
|
|
9
|
+
import qcodes
|
|
10
|
+
import gc
|
|
11
|
+
from copy import deepcopy
|
|
12
|
+
|
|
13
|
+
class ACQ_M4i_Digitiser(M4i):
|
|
14
|
+
class DataArray(ArrayParameter):
|
|
15
|
+
def __init__(self, *args, **kwargs):
|
|
16
|
+
super().__init__(*args, snapshot_value=False, **kwargs)
|
|
17
|
+
self.get = self.get_raw
|
|
18
|
+
|
|
19
|
+
def get_raw(self):
|
|
20
|
+
if 'singleshot' in self.name:
|
|
21
|
+
self.instrument.processor.singleshot(True)
|
|
22
|
+
if 'time_integrat' in self.name:
|
|
23
|
+
self.instrument.processor.enable_time_integration(True)
|
|
24
|
+
else:
|
|
25
|
+
self.instrument.processor.enable_time_integration(False)
|
|
26
|
+
data = self.instrument.get_data()
|
|
27
|
+
self.shape = data.shape
|
|
28
|
+
else:
|
|
29
|
+
self.instrument.processor.singleshot(False)
|
|
30
|
+
data = self.instrument.get_data()
|
|
31
|
+
self.shape = data.shape
|
|
32
|
+
gc.collect()
|
|
33
|
+
return data
|
|
34
|
+
|
|
35
|
+
def __init__(self, name, cardid='spcm0', input_couplings='DC', **kwargs):
|
|
36
|
+
super().__init__(name, cardid, **kwargs)
|
|
37
|
+
|
|
38
|
+
###########################################################
|
|
39
|
+
#Default digitizer setup (one analog, one digital channel)#
|
|
40
|
+
self.clock_mode.set(spcm.SPC_CM_EXTREFCLOCK)
|
|
41
|
+
self.reference_clock.set(10000000)#10 MHz ref clk
|
|
42
|
+
self.sample_rate.set(500000000) #500 Msamples per second
|
|
43
|
+
assert self.sample_rate.get() == 500000000, "The digitizer could not be acquired. \
|
|
44
|
+
It might be acquired by a different kernel."
|
|
45
|
+
self.set_ext0_OR_trigger_settings(spcm.SPC_TM_POS, termination=0, coupling=0, level0=500)
|
|
46
|
+
self._trigger_edge = 1
|
|
47
|
+
self.multipurpose_mode_0.set('disabled')
|
|
48
|
+
self.multipurpose_mode_1.set('disabled')
|
|
49
|
+
self.multipurpose_mode_2.set('disabled')
|
|
50
|
+
self.enable_channels(spcm.CHANNEL0 | spcm.CHANNEL1) # spcm.CHANNEL0 | spcm.CHANNEL1
|
|
51
|
+
self.num_channels = 2 #!!!!!CHANGE THIS IF CHANGING ABOVE
|
|
52
|
+
if input_couplings == 'DC':
|
|
53
|
+
input_couplings = 0
|
|
54
|
+
elif input_couplings == 'AC':
|
|
55
|
+
input_couplings = 1
|
|
56
|
+
else:
|
|
57
|
+
assert False, "Parameter input_couplings must be DC or AC."
|
|
58
|
+
self.set_channel_settings(1, mV_range=1000., input_path=1,
|
|
59
|
+
termination=0, coupling=input_couplings)#0)
|
|
60
|
+
self.set_channel_settings(0, mV_range=1000., input_path=1,
|
|
61
|
+
termination=0, coupling=input_couplings)#0)
|
|
62
|
+
###########################################################
|
|
63
|
+
|
|
64
|
+
self.override_card_lock = False
|
|
65
|
+
|
|
66
|
+
self.add_parameter(
|
|
67
|
+
'samples', ManualParameter,
|
|
68
|
+
label='Number of samples per trigger.',
|
|
69
|
+
vals=vals.Multiples(divisor=16, min_value=32))
|
|
70
|
+
self.samples(2048)
|
|
71
|
+
|
|
72
|
+
# self.add_parameter(
|
|
73
|
+
# 'channels',
|
|
74
|
+
# label='Number of channels',
|
|
75
|
+
# set_cmd=self._set_channels,
|
|
76
|
+
# vals=vals.Ints(1,2), initial_value=1)
|
|
77
|
+
|
|
78
|
+
self.add_parameter(
|
|
79
|
+
'segments',
|
|
80
|
+
set_cmd=self._set_segments,
|
|
81
|
+
label='Number of Segments',
|
|
82
|
+
vals=vals.Ints(0,2**28), initial_value=1,
|
|
83
|
+
docstring="Number of segments.\
|
|
84
|
+
Set to zero for autosegmentation.\
|
|
85
|
+
Connect the sequence start trigger to X0 (X1) for channels 0 (1) of the digitizer.")
|
|
86
|
+
|
|
87
|
+
self._repetitions = 1
|
|
88
|
+
self.ch_states = (True, False)
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def ChannelStates(self):
|
|
92
|
+
return self.ch_states
|
|
93
|
+
@ChannelStates.setter
|
|
94
|
+
def ChannelStates(self, ch_states):
|
|
95
|
+
assert len(ch_states) == 2, "There are 2 channel states that must be specified."
|
|
96
|
+
|
|
97
|
+
final_flags = 0
|
|
98
|
+
self.num_channels = 0
|
|
99
|
+
if ch_states[0]:
|
|
100
|
+
final_flags |= spcm.CHANNEL0
|
|
101
|
+
self.num_channels += 1
|
|
102
|
+
if ch_states[1]:
|
|
103
|
+
final_flags |= spcm.CHANNEL1
|
|
104
|
+
self.num_channels += 1
|
|
105
|
+
self.enable_channels(final_flags)
|
|
106
|
+
self.ch_states = ch_states
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def AvailableChannels(self):
|
|
110
|
+
return 2
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def NumSamples(self):
|
|
114
|
+
return self.samples()
|
|
115
|
+
@NumSamples.setter
|
|
116
|
+
def NumSamples(self, num_samples):
|
|
117
|
+
self.samples(num_samples)
|
|
118
|
+
|
|
119
|
+
@property
|
|
120
|
+
def SampleRate(self):
|
|
121
|
+
return self.sample_rate.get()
|
|
122
|
+
@SampleRate.setter
|
|
123
|
+
def SampleRate(self, frequency_hertz):
|
|
124
|
+
self.sample_rate.set(frequency_hertz)
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def NumSegments(self):
|
|
128
|
+
return self.segments()
|
|
129
|
+
@NumSegments.setter
|
|
130
|
+
def NumSegments(self, num_segs):
|
|
131
|
+
self.segments(num_segs)
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def NumRepetitions(self):
|
|
135
|
+
return self._repetitions
|
|
136
|
+
@NumRepetitions.setter
|
|
137
|
+
def NumRepetitions(self, num_reps):
|
|
138
|
+
self._repetitions = num_reps
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def TriggerInputEdge(self):
|
|
142
|
+
return self._trigger_edge
|
|
143
|
+
@TriggerInputEdge.setter
|
|
144
|
+
def TriggerInputEdge(self, pol):
|
|
145
|
+
self._trigger_edge = pol
|
|
146
|
+
if self._trigger_edge == 1:
|
|
147
|
+
self.set_ext0_OR_trigger_settings(spcm.SPC_TM_POS, termination=0, coupling=0, level0=500)
|
|
148
|
+
else:
|
|
149
|
+
self.set_ext0_OR_trigger_settings(spcm.SPC_TM_NEG, termination=0, coupling=0, level0=500)
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def SupportedDecisionBlocks(self):
|
|
153
|
+
return []
|
|
154
|
+
|
|
155
|
+
def _set_segments(self, segments):
|
|
156
|
+
if segments == 0:
|
|
157
|
+
# use autosegmentation. Assuming X0 is the sequence start trigger.
|
|
158
|
+
# ADC input has one marker, which indicates sequence start
|
|
159
|
+
self.multipurpose_mode_0.set('digital_in')
|
|
160
|
+
self.processor.unpacker.markers.set(1)
|
|
161
|
+
self.processor.sync.method.set('all')
|
|
162
|
+
self.processor.sync.mask.set(0x01)
|
|
163
|
+
logging.warning("Autosegmentation enabled. The number of acquisitions is \
|
|
164
|
+
set to number of averages in total. Number of acquisitions \
|
|
165
|
+
per segment will be averages//segments")
|
|
166
|
+
elif segments == 1:
|
|
167
|
+
# only one segment. Not checking for sequence start trigger
|
|
168
|
+
self.multipurpose_mode_0.set('disabled')
|
|
169
|
+
self.enable_TS_SEQ_trig(False)
|
|
170
|
+
else:
|
|
171
|
+
self.multipurpose_mode_0.set('disabled')
|
|
172
|
+
self.enable_TS_SEQ_trig(True)
|
|
173
|
+
# self.initialise_time_stamp_mode()
|
|
174
|
+
# setting number of segments to specific value.
|
|
175
|
+
# Assuming X0 is the sequence start trigger.
|
|
176
|
+
# self.multipurpose_mode_0.set('digital_in')
|
|
177
|
+
|
|
178
|
+
def _set_sample_rate(self, rate):
|
|
179
|
+
self.sample_rate.set(rate)
|
|
180
|
+
new_rate = self.sample_rate.get()
|
|
181
|
+
logging.warning(f"Cannot set sampling rate to {rate}, it is set to {new_rate} instead")
|
|
182
|
+
|
|
183
|
+
def get_data(self, **kwargs):
|
|
184
|
+
'''
|
|
185
|
+
Gets processed data from the GPU. Processing involves gathering data and passing it through TvMode
|
|
186
|
+
'''
|
|
187
|
+
assert self.NumSamples > 32, "M4i requires the number of samples per segment to be at least 32."
|
|
188
|
+
assert self.NumSamples % 16 == 0, "M4i requires the number of samples per segment to be divisible by 16."
|
|
189
|
+
|
|
190
|
+
cur_processor = kwargs.get('data_processor', None)
|
|
191
|
+
|
|
192
|
+
#Capture extra frame when running SEQ triggering as the SEQ trigger signal on X0 may not align exactly before the first captured segment trigger...
|
|
193
|
+
if self.enable_TS_SEQ_trig():
|
|
194
|
+
total_frames = (self.NumRepetitions+1)*self.NumSegments
|
|
195
|
+
else:
|
|
196
|
+
total_frames = (self.NumRepetitions)*self.NumSegments
|
|
197
|
+
|
|
198
|
+
if cur_processor == None:
|
|
199
|
+
if self.num_channels == 1:
|
|
200
|
+
final_arrs = [np.zeros(total_frames * self.NumSamples)]
|
|
201
|
+
final_arrs[0][:] = np.nan
|
|
202
|
+
else:
|
|
203
|
+
final_arrs = [np.zeros(total_frames * self.NumSamples), np.zeros(total_frames * self.NumSamples)]
|
|
204
|
+
final_arrs[0][:] = np.nan
|
|
205
|
+
final_arrs[1][:] = np.nan
|
|
206
|
+
#
|
|
207
|
+
cur_ind = 0
|
|
208
|
+
for cur_block in self.multiple_trigger_fifo_acquisition(total_frames, self.NumSamples, 1, self.NumSegments, notify_page_size_bytes=4096):
|
|
209
|
+
if self.num_channels == 1:
|
|
210
|
+
blk_size = cur_block.size
|
|
211
|
+
end_pt = min( blk_size, final_arrs[0].size - cur_ind)
|
|
212
|
+
final_arrs[0][cur_ind:cur_ind+end_pt] = deepcopy(cur_block[:end_pt])
|
|
213
|
+
else:
|
|
214
|
+
blk_size = int(cur_block.size/2)
|
|
215
|
+
end_pt = min( blk_size, final_arrs[0].size - cur_ind)
|
|
216
|
+
final_arrs[0][cur_ind:cur_ind+end_pt] = deepcopy(cur_block[:2*end_pt:2])
|
|
217
|
+
final_arrs[1][cur_ind:cur_ind+end_pt] = deepcopy(cur_block[1:2*end_pt:2])
|
|
218
|
+
cur_ind += end_pt
|
|
219
|
+
#
|
|
220
|
+
total_num_data = self.NumRepetitions * self.NumSegments * self.NumSamples #The trimmed indexing is required when using SEQ trigger mode in which the data will be taken in excess...
|
|
221
|
+
#TODO: Investigate the impact of multiplying by mVrange/1000/ADC_to_voltage() to get the voltage - may have a slight performance impact?
|
|
222
|
+
return {'data': {
|
|
223
|
+
'parameters' : ['repetition', 'segment', 'sample'],
|
|
224
|
+
'data' : { f'ch{m}' : final_arrs[m][:total_num_data].reshape(self.NumRepetitions, self.NumSegments, self.NumSamples) for m in range(len(final_arrs)) },
|
|
225
|
+
'misc' : {'SampleRates' : [self.sample_rate.get()]*self.num_channels}
|
|
226
|
+
}}
|
|
227
|
+
else:
|
|
228
|
+
#Gather data and either pass it to the data-processor or just collate it under final_arr - note that it is sent to the processor as properly grouped under the ACQ
|
|
229
|
+
#data format specification.
|
|
230
|
+
cache_array = []
|
|
231
|
+
total_reps = 0
|
|
232
|
+
done = False
|
|
233
|
+
for cur_block in self.multiple_trigger_fifo_acquisition(total_frames, self.NumSamples, 1, self.NumSegments, notify_page_size_bytes=4096):
|
|
234
|
+
if len(cache_array) > 0:
|
|
235
|
+
arr_blk = np.concatenate((cache_array, np.array(cur_block)))
|
|
236
|
+
else:
|
|
237
|
+
arr_blk = np.array(cur_block)
|
|
238
|
+
|
|
239
|
+
if self.num_channels == 1:
|
|
240
|
+
num_reps = int( arr_blk.size / (self.NumSegments*self.NumSamples) )
|
|
241
|
+
if num_reps + total_reps <= self.NumRepetitions:
|
|
242
|
+
total_reps += num_reps
|
|
243
|
+
cache_array = arr_blk[(num_reps*self.NumSegments*self.NumSamples):]
|
|
244
|
+
if num_reps == 0:
|
|
245
|
+
continue
|
|
246
|
+
arr_blk = [arr_blk[0:(num_reps*self.NumSegments*self.NumSamples)].reshape(num_reps, self.NumSegments, self.NumSamples)]
|
|
247
|
+
else:
|
|
248
|
+
num_reps = self.NumRepetitions - total_reps
|
|
249
|
+
if num_reps == 0:
|
|
250
|
+
done = True
|
|
251
|
+
arr_blk = [arr_blk[0:(num_reps*self.NumSegments*self.NumSamples)].reshape(num_reps, self.NumSegments, self.NumSamples)]
|
|
252
|
+
done = True
|
|
253
|
+
else:
|
|
254
|
+
num_reps = int( arr_blk.size / (self.NumSegments*self.NumSamples*2) )
|
|
255
|
+
if num_reps + total_reps <= self.NumRepetitions:
|
|
256
|
+
total_reps += num_reps
|
|
257
|
+
cache_array = arr_blk[(num_reps*self.NumSegments*self.NumSamples*2):]
|
|
258
|
+
if num_reps == 0:
|
|
259
|
+
continue
|
|
260
|
+
arr_blk = [
|
|
261
|
+
arr_blk[0:(num_reps*self.NumSegments*self.NumSamples*2):2].reshape(num_reps, self.NumSegments, self.NumSamples),
|
|
262
|
+
arr_blk[1:(num_reps*self.NumSegments*self.NumSamples*2):2].reshape(num_reps, self.NumSegments, self.NumSamples)
|
|
263
|
+
]
|
|
264
|
+
else:
|
|
265
|
+
num_reps = self.NumRepetitions - total_reps
|
|
266
|
+
if num_reps == 0:
|
|
267
|
+
done = True
|
|
268
|
+
arr_blk = [
|
|
269
|
+
arr_blk[0:(num_reps*self.NumSegments*self.NumSamples*2):2].reshape(num_reps, self.NumSegments, self.NumSamples),
|
|
270
|
+
arr_blk[1:(num_reps*self.NumSegments*self.NumSamples*2):2].reshape(num_reps, self.NumSegments, self.NumSamples)
|
|
271
|
+
]
|
|
272
|
+
done = True
|
|
273
|
+
|
|
274
|
+
cur_processor.push_data({
|
|
275
|
+
'parameters' : ['repetition', 'segment', 'sample'],
|
|
276
|
+
'data' : { f'CH{m}' : arr_blk[m].astype(dtype=np.float64) for m in range(self.num_channels) },
|
|
277
|
+
'misc' : {'SampleRates' : [self.sample_rate.get()]*self.num_channels}
|
|
278
|
+
})
|
|
279
|
+
if done:
|
|
280
|
+
break
|
|
281
|
+
|
|
282
|
+
return {'data': cur_processor.get_all_data()}
|
|
283
|
+
|
|
284
|
+
from sqdtoolz.HAL.Processors.ProcessorCPU import*
|
|
285
|
+
from sqdtoolz.HAL.Processors.CPU.CPU_DDC import*
|
|
286
|
+
from sqdtoolz.HAL.Processors.CPU.CPU_FIR import*
|
|
287
|
+
from sqdtoolz.HAL.Processors.CPU.CPU_Mean import*
|
|
288
|
+
from sqdtoolz.HAL.Processors.CPU.CPU_FFT import*
|
|
289
|
+
import matplotlib.pyplot as plt
|
|
290
|
+
import time
|
|
291
|
+
|
|
292
|
+
import scipy.fftpack
|
|
293
|
+
|
|
294
|
+
from sqdtoolz.Laboratory import Laboratory
|
|
295
|
+
|
|
296
|
+
#import pdb
|
|
297
|
+
def runme():
|
|
298
|
+
lab = Laboratory('','')
|
|
299
|
+
new_digi = ACQ_M4i_Digitiser("test")
|
|
300
|
+
new_digi.ChannelStates = (True,False)
|
|
301
|
+
new_digi.NumSegments = 1#3 * (2**26))
|
|
302
|
+
new_digi.NumSamples = 2**19#(2**13)#2**8+2**7)
|
|
303
|
+
new_digi.NumRepetitions = 1
|
|
304
|
+
|
|
305
|
+
new_digi.NumRepetitions = 5
|
|
306
|
+
new_digi.NumSegments = 1
|
|
307
|
+
new_digi.NumSamples = 512
|
|
308
|
+
|
|
309
|
+
# term = new_digi._param32bit(30130)
|
|
310
|
+
# term = new_digi.termination_1()
|
|
311
|
+
# new_digi.snapshot()
|
|
312
|
+
|
|
313
|
+
myProc = ProcessorCPU('test', lab)
|
|
314
|
+
myProc.add_stage(CPU_DDC([25e6]*2))
|
|
315
|
+
myProc.add_stage(CPU_FIR([{'Type' : 'low', 'Taps' : 40, 'fc' : 25e6, 'Win' : 'hamming'}]*4))
|
|
316
|
+
# myProc.add_stage(CPU_Mean('sample'))
|
|
317
|
+
# myProc.add_stage(CPU_Mean('segment'))
|
|
318
|
+
# myProc.add_stage_end(CPU_Mean('repetition'))
|
|
319
|
+
myProc.add_stage(CPU_FFT())
|
|
320
|
+
|
|
321
|
+
a = new_digi.get_data(data_processor=myProc)
|
|
322
|
+
b = new_digi.get_data(data_processor=myProc)
|
|
323
|
+
c = new_digi.get_data(data_processor=myProc)
|
|
324
|
+
d = new_digi.get_data(data_processor=myProc)
|
|
325
|
+
e = new_digi.get_data(data_processor=myProc)
|
|
326
|
+
f=0
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
# new_digi._set_channels(2)
|
|
330
|
+
# new_digi.pretrigger_memory_size(0)
|
|
331
|
+
# for m in range(20):
|
|
332
|
+
# a = new_digi.get_data()#(data_processor=myProc)
|
|
333
|
+
# print(new_digi.get_error_info32bit())
|
|
334
|
+
# print(a['data']['ch0'].shape)
|
|
335
|
+
cur_time = time.time()
|
|
336
|
+
a = new_digi.get_data(data_processor=None)
|
|
337
|
+
cur_time = time.time() - cur_time
|
|
338
|
+
plt.plot(a['data']['ch0'][0][0])
|
|
339
|
+
plt.plot(a['data']['ch0'][0][0] * np.cos(2*np.pi*25e6*np.arange(a['data']['ch0'][0][0].size)/500e6))
|
|
340
|
+
# plt.plot(a['data']['ch0_I'][0][0])
|
|
341
|
+
# plt.plot(a['data']['ch0_Q'][0][0])
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
# dataVals = a['data']['ch0'][0][0]
|
|
345
|
+
# yf = scipy.fftpack.fft(dataVals)
|
|
346
|
+
# N = dataVals.size
|
|
347
|
+
# T = 1.0 / 500e6
|
|
348
|
+
# x = np.linspace(0.0, N*T, N)
|
|
349
|
+
# xf = np.linspace(0.0, 1.0/(2.0*T), int(N/2))
|
|
350
|
+
# plt.plot(xf, 2.0/N * np.abs(yf[:N//2]))
|
|
351
|
+
|
|
352
|
+
plt.show()
|
|
353
|
+
input('Press ENTER')
|
|
354
|
+
print('we made it!')
|
|
355
|
+
# np.savetxt('sample.txt', np.ndarray.flatten(a['data']['ch0'].astype(np.float32)+np.float32(4000*1)))
|
|
356
|
+
# time.sleep(5)
|
|
357
|
+
print('we wrote it!')
|
|
358
|
+
# gc.collect()
|
|
359
|
+
fig, axs = plt.subplots(2)
|
|
360
|
+
for r in range(2):#acq_module.NumRepetitions):
|
|
361
|
+
for s in range(1):
|
|
362
|
+
axs[0].plot(a['data']['ch0_I'][r][s].astype(np.float32)+np.float32(4000*r))
|
|
363
|
+
axs[0].plot(a['data']['ch1_I'][r][s].astype(np.float32)+np.float32(4000*r))
|
|
364
|
+
#
|
|
365
|
+
# axs[0].plot(np.ones(a['data']['ch0'][r][s].size))
|
|
366
|
+
# axs[1].plot(np.ones(512))
|
|
367
|
+
# plt.plot(leData[0][0])
|
|
368
|
+
# plt.show()
|
|
369
|
+
print('we plotted it!')
|
|
370
|
+
# input('wait')
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
new_digi.samples(496)#2**8+2**7)
|
|
374
|
+
b = new_digi.get_data()#(data_processor=myProc)
|
|
375
|
+
print('we made it!')
|
|
376
|
+
# time.sleep(2)
|
|
377
|
+
# np.savetxt('sample.txt', np.ndarray.flatten(a['data']['ch0'].astype(np.float32)+np.float32(4000*1)))
|
|
378
|
+
print('we wrote it!')
|
|
379
|
+
# gc.collect()
|
|
380
|
+
for r in range(1):#acq_module.NumRepetitions):
|
|
381
|
+
for s in range(new_digi.NumSegments):
|
|
382
|
+
axs[1].plot(b['data']['ch0'][r][s].astype(np.float32)+np.float32(4000*r))
|
|
383
|
+
# axs[1].plot(np.ones(512))
|
|
384
|
+
|
|
385
|
+
# plt.plot(leData[0][0])
|
|
386
|
+
plt.show()
|
|
387
|
+
|
|
388
|
+
# # fig.show()
|
|
389
|
+
# #a = [print(np.array(x)) for x in new_digi.multiple_trigger_fifo_acquisition(3*2**26,384,2**11)]
|
|
390
|
+
|
|
391
|
+
# # assert (num_of_acquisitions*self.samples.get()%4096 == 0) or (num_of_acquisitions*self.samples.get() in [2**4, 2**5, 2**6, 2**7, 2**8, 2**9, 2**10, 2**11]), "The number of total samples requested to the card is not valid.\nThis must be 16, 32, 64, 128, 256, 512, 1k ,2k or any multiple of 4k.\nThe easiest way to ensure this is to use powers of 2 for averages, samples and segments, probably in that order of priority."
|
|
392
|
+
# s=0
|
|
393
|
+
input("done")
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
if __name__ == '__main__':
|
|
397
|
+
runme()
|