Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip seqc marker data test if prerequisites not installed #793

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions tests/_program/seqc_tests.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
import unittest
from unittest import TestCase, mock
import time
from itertools import zip_longest, islice
import hashlib
import pathlib
import sys
import tempfile
import pathlib
import hashlib
import random
import time
import unittest
from itertools import zip_longest, islice
from unittest import TestCase, mock

import numpy as np

from qupulse._program.seqc import BinaryWaveform, loop_to_seqc, WaveformPlayback, Repeat, SteppingRepeat, Scope, \
to_node_clusters, find_sharable_waveforms, mark_sharable_waveforms, UserRegisterManager, HDAWGProgramManager, \
UserRegister, WaveformFileSystem
from qupulse.expressions import ExpressionScalar
from qupulse.hardware.util import zhinst_voltage_to_uint16
from qupulse.parameter_scope import DictScope

from qupulse.program.loop import Loop
from qupulse._program.waveforms import ConstantWaveform
from qupulse._program.seqc import BinaryWaveform, loop_to_seqc, WaveformPlayback, Repeat, SteppingRepeat, Scope,\
to_node_clusters, find_sharable_waveforms, mark_sharable_waveforms, UserRegisterManager, HDAWGProgramManager,\
UserRegister, WaveformFileSystem
from qupulse._program.volatile import VolatileRepetitionCount

from qupulse.program.volatile import VolatileRepetitionCount
from qupulse.program.waveforms import ConstantWaveform
from tests.pulses.sequencing_dummies import DummyWaveform

try:
import zhinst
except ImportError:
zhinst = None

# This block checks if zhinst_voltage_to_uint16 works. A failing implementation (due to missing dependencies)
# skips tests further down
try:
zhinst_voltage_to_uint16(np.zeros(16), np.zeros(16),
(np.zeros(16), np.zeros(16), np.zeros(16), np.zeros(16)))
except AttributeError:
# prerequisites not installed
zhinst_voltage_to_uint16 = None


def take(n, iterable):
"Return first n items of the iterable as a list"
Expand Down Expand Up @@ -63,6 +70,7 @@ def test_dynamic_rate_reduction(self):

self.assertEqual(min(max_rate, n), dyn_n)

@unittest.skipIf(zhinst_voltage_to_uint16 is None, "BinaryWaveform.from_sampled backend missing")
def test_marker_data(self):
channel_1_data = np.linspace(-0.3, 0.4, num=192)
channel_2_data = np.linspace(-0.1, 0.1, num=192)
Expand Down
Loading