Skip to content

[pre-commit.ci] auto fixes from pre-commit.com hooks

188b2ce
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Open

Live plotting for 3.0 #161

[pre-commit.ci] auto fixes from pre-commit.com hooks
188b2ce
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Results failed Jun 27, 2025 in 0s

7 fail, 23 pass in 53s

 2 files  + 1   2 suites  +1   53s ⏱️ +50s
30 tests ± 0  23 ✅ + 2  0 💤 ±0   7 ❌  - 2 
60 runs  +30  46 ✅ +25  0 💤 ±0  14 ❌ +5 

Results for commit 188b2ce. ± Comparison against earlier commit ab08f7b.

Annotations

Check warning on line 0 in src.tests.device_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_measured_ramp[False-False] (src.tests.device_test)

artifacts/pytest-results-3.10/test-results.xml [took 8s]
artifacts/pytest-results-3.12/test-results.xml [took 8s]
Raw output
assert 5 == 100
 +  where 5 = len([((<qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cdf5acc0>, <xarray.Dataset> Size: ...nterdependencies": {"paramspecs":...\n    parent_dataset_links:  []\n    run_timestamp_raw:     1751018880.1147463), {})])
 +  and   100 = len(array([-0.3       , -0.29292929, -0.28585859, -0.27878788, -0.27171717,\n       -0.26464646, -0.25757576, -0.25050505, ...343434,  0.35050505,  0.35757576,  0.36464646,\n        0.37171717,  0.37878788,  0.38585859,  0.39292929,  0.4       ]))
device_test_setup = DeviceTestSetup(measurement_test_setup=MeasurementTestSetup(trigger=<threading.Event at 0x7f21d2ba1370: unset>, statio...ect.Terminal object at 0x7f21cc934650>, 'gate2': <qumada.measurement.device_object.Terminal object at 0x7f21cc934620>})
buffered = False, backsweep = False

    @pytest.mark.parametrize(
        "buffered,backsweep",
        itertools.product(
            # buffered
            [True, False],
            # backsweep
            [False, True],
        ),
    )
    def test_measured_ramp(device_test_setup, buffered, backsweep):
        gate1 = device_test_setup.namespace["gate1"]
    
        plot_args = []
    
        def plot_backend(*args, **kwargs):
            plot_args.append((args, kwargs))
    
        from qumada.measurement.measurement import MeasurementScript
    
        MeasurementScript.DEFAULT_LIVE_PLOTTER = plot_backend
    
        (qcodes_data,) = gate1.voltage.measured_ramp(0.4, start=-0.3, buffered=buffered, backsweep=backsweep)
        if backsweep:
            assert gate1.voltage() == pytest.approx(-0.3, abs=0.001)
        else:
            assert gate1.voltage() == pytest.approx(0.4, abs=0.001)
    
        if not buffered:
            # TODO: Why is this necessary???
            (qcodes_data, _, _) = qcodes_data
        xarr = qcodes_data.to_xarray_dataset()
    
        set_points = xarr.dac_ch01_voltage.values
    
        if backsweep:
            fwd = np.linspace(-0.3, 0.4, len(set_points) // 2)
            expected = np.concatenate((fwd, fwd[::-1]))
        else:
            expected = np.linspace(-0.3, 0.4, len(set_points))
    
        if buffered:
            assert len(plot_args) == 1 + int(backsweep)
        else:
>           assert len(plot_args) == len(set_points)
E           assert 5 == 100
E            +  where 5 = len([((<qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cdf5acc0>, <xarray.Dataset> Size: ...nterdependencies": {"paramspecs":...\n    parent_dataset_links:  []\n    run_timestamp_raw:     1751018880.1147463), {})])
E            +  and   100 = len(array([-0.3       , -0.29292929, -0.28585859, -0.27878788, -0.27171717,\n       -0.26464646, -0.25757576, -0.25050505, ...343434,  0.35050505,  0.35757576,  0.36464646,\n        0.37171717,  0.37878788,  0.38585859,  0.39292929,  0.4       ]))

src/tests/device_test.py:130: AssertionError

Check warning on line 0 in src.tests.device_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_measured_ramp[False-True] (src.tests.device_test)

artifacts/pytest-results-3.10/test-results.xml [took 8s]
artifacts/pytest-results-3.12/test-results.xml [took 8s]
Raw output
assert 10 == 200
 +  where 10 = len([((<qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cb7568a0>, <xarray.Dataset> Size: ...ependencies": {"paramspecs":...\n    parent_dataset_links:  []\n    run_timestamp_raw:     1751018888.5374753), {}), ...])
 +  and   200 = len(array([-0.3       , -0.29292929, -0.28585859, -0.27878788, -0.27171717,\n       -0.26464646, -0.25757576, -0.25050505, ...343434, -0.25050505, -0.25757576, -0.26464646,\n       -0.27171717, -0.27878788, -0.28585859, -0.29292929, -0.3       ]))
device_test_setup = DeviceTestSetup(measurement_test_setup=MeasurementTestSetup(trigger=<threading.Event at 0x7f21cc915190: unset>, statio...ect.Terminal object at 0x7f21cb795190>, 'gate2': <qumada.measurement.device_object.Terminal object at 0x7f21cb794da0>})
buffered = False, backsweep = True

    @pytest.mark.parametrize(
        "buffered,backsweep",
        itertools.product(
            # buffered
            [True, False],
            # backsweep
            [False, True],
        ),
    )
    def test_measured_ramp(device_test_setup, buffered, backsweep):
        gate1 = device_test_setup.namespace["gate1"]
    
        plot_args = []
    
        def plot_backend(*args, **kwargs):
            plot_args.append((args, kwargs))
    
        from qumada.measurement.measurement import MeasurementScript
    
        MeasurementScript.DEFAULT_LIVE_PLOTTER = plot_backend
    
        (qcodes_data,) = gate1.voltage.measured_ramp(0.4, start=-0.3, buffered=buffered, backsweep=backsweep)
        if backsweep:
            assert gate1.voltage() == pytest.approx(-0.3, abs=0.001)
        else:
            assert gate1.voltage() == pytest.approx(0.4, abs=0.001)
    
        if not buffered:
            # TODO: Why is this necessary???
            (qcodes_data, _, _) = qcodes_data
        xarr = qcodes_data.to_xarray_dataset()
    
        set_points = xarr.dac_ch01_voltage.values
    
        if backsweep:
            fwd = np.linspace(-0.3, 0.4, len(set_points) // 2)
            expected = np.concatenate((fwd, fwd[::-1]))
        else:
            expected = np.linspace(-0.3, 0.4, len(set_points))
    
        if buffered:
            assert len(plot_args) == 1 + int(backsweep)
        else:
>           assert len(plot_args) == len(set_points)
E           assert 10 == 200
E            +  where 10 = len([((<qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cb7568a0>, <xarray.Dataset> Size: ...ependencies": {"paramspecs":...\n    parent_dataset_links:  []\n    run_timestamp_raw:     1751018888.5374753), {}), ...])
E            +  and   200 = len(array([-0.3       , -0.29292929, -0.28585859, -0.27878788, -0.27171717,\n       -0.26464646, -0.25757576, -0.25050505, ...343434, -0.25050505, -0.25757576, -0.26464646,\n       -0.27171717, -0.27878788, -0.28585859, -0.29292929, -0.3       ]))

src/tests/device_test.py:130: AssertionError

Check warning on line 0 in src.tests.mapping_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_map_terminals_gui (src.tests.mapping_test)

artifacts/pytest-results-3.10/test-results.xml [took 0s]
artifacts/pytest-results-3.12/test-results.xml [took 0s]
Raw output
AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f21cb68c7d0>
station_with_instruments = <qcodes.station.Station object at 0x7f21cb58a780>
script = <qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cb5bc9e0>

    def test_map_terminals_gui(mocker: MockerFixture, station_with_instruments, script):
        mocker.patch("qumada.instrument.mapping.mapping_gui.QApplication", autospec=True)
        mock_main_window = mocker.patch("qumada.instrument.mapping.mapping_gui.MainWindow", autospec=True)
    
        kwargs = {
            "components": station_with_instruments.components,
>           "terminal_parameters": script.gate_parameters,
            "monitoring": False,
        }
E       AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'

src/tests/mapping_test.py:255: AttributeError

Check warning on line 0 in src.tests.mapping_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_mapping_gui_monitoring[True] (src.tests.mapping_test)

artifacts/pytest-results-3.10/test-results.xml [took 0s]
artifacts/pytest-results-3.12/test-results.xml [took 0s]
Raw output
AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'
monitoring = True, qtbot = <pytestqt.qtbot.QtBot object at 0x7f21cb59a2d0>
station_with_instruments = <qcodes.station.Station object at 0x7f21cb436900>
script = <qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cb4351f0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f21cb45c320>

    @pytest.mark.parametrize("monitoring", [True, False])
    def test_mapping_gui_monitoring(monitoring: bool, qtbot, station_with_instruments, script, mocker):
        w = MainWindow(
            station_with_instruments.components,
>           script.gate_parameters,
            monitoring=monitoring,
        )
E       AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'

src/tests/mapping_test.py:269: AttributeError

Check warning on line 0 in src.tests.mapping_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_mapping_gui_monitoring[False] (src.tests.mapping_test)

artifacts/pytest-results-3.10/test-results.xml [took 0s]
artifacts/pytest-results-3.12/test-results.xml [took 0s]
Raw output
AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'
monitoring = False, qtbot = <pytestqt.qtbot.QtBot object at 0x7f21cb4517c0>
station_with_instruments = <qcodes.station.Station object at 0x7f21cb45fe60>
script = <qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cb493dd0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f21cb4a0140>

    @pytest.mark.parametrize("monitoring", [True, False])
    def test_mapping_gui_monitoring(monitoring: bool, qtbot, station_with_instruments, script, mocker):
        w = MainWindow(
            station_with_instruments.components,
>           script.gate_parameters,
            monitoring=monitoring,
        )
E       AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'

src/tests/mapping_test.py:269: AttributeError

Check warning on line 0 in src.tests.mapping_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_mapping_gui_map_automatically (src.tests.mapping_test)

artifacts/pytest-results-3.10/test-results.xml [took 0s]
artifacts/pytest-results-3.12/test-results.xml [took 0s]
Raw output
AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f21cb48d940>
qtbot = <pytestqt.qtbot.QtBot object at 0x7f21cb448920>
station_with_instruments = <qcodes.station.Station object at 0x7f21cb4d4830>
script = <qumada.measurement.scripts.generic_measurement.Generic_1D_Sweep object at 0x7f21cb47d130>

    def test_mapping_gui_map_automatically(mocker, qtbot, station_with_instruments, script):
        # mock dialogs (specify behaviour in return_value and skip)
        mocker.patch("qumada.instrument.mapping.mapping_gui.MessageBox_notallmapped.exec", return_value=QMessageBox.No)
        mocker.patch("qumada.instrument.mapping.mapping_gui.MessageBox_duplicates.exec", return_value=QMessageBox.No)
        mocker.patch("qumada.instrument.mapping.mapping_gui.MessageBox_overwrite.exec", return_value=QMessageBox.No)
    
        w = MainWindow(
            station_with_instruments.components,
>           script.gate_parameters,
        )
E       AttributeError: 'Generic_1D_Sweep' object has no attribute 'gate_parameters'

src/tests/mapping_test.py:382: AttributeError

Check warning on line 0 in src.tests.measurement_test

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 2 runs failed: test_1d_buffered (src.tests.measurement_test)

artifacts/pytest-results-3.10/test-results.xml [took 0s]
artifacts/pytest-results-3.12/test-results.xml [took 0s]
Raw output
AttributeError: 'NoneType' object has no attribute '_is_triggerable'
measurement_test_setup = MeasurementTestSetup(trigger=<threading.Event at 0x7f21cb48db50: unset>, station=<qcodes.station.Station object at 0x7...eredDummyDMM: dmm>, dac=<DummyDac: dac>, db_path=PosixPath('/tmp/pytest-of-runner/pytest-0/test_1d_buffered0/test.db'))
buffer_settings = {'burst_duration': 0.0234375, 'delay': 0, 'duration': 0.0234375, 'sampling_rate': 512}
parameters = {'gate1': {'voltage': {'delay': 0, 'setpoints': array([0.        , 0.28559933, 0.57119866, 0.856798  , 1.14239733,
   ...159265]), 'type': 'dynamic', 'value': 0}}, 'ohmic': {'current': {'type': 'gettable'}, 'voltage': {'type': 'gettable'}}}

    def test_1d_buffered(measurement_test_setup, buffer_settings, parameters):
        script = Generic_1D_Sweep_buffered()
        script.setup(
            parameters,
            metadata=None,
            buffer_settings=buffer_settings,
            trigger_type="hardware",
            trigger_start=measurement_test_setup.trigger.set,
            trigger_reset=measurement_test_setup.trigger.clear,
        )
    
        mapping = {
            "ohmic": {
                "voltage": measurement_test_setup.dmm.voltage,
                "current": measurement_test_setup.dmm.current,
            },
            "gate1": {
                "voltage": measurement_test_setup.dac.ch01.voltage,
            },
            "gate2": {
                "voltage": measurement_test_setup.dac.ch02.voltage,
            },
        }
        script.gate_parameters = mapping
>       ds1, ds2 = script.run()

src/tests/measurement_test.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/qumada/measurement/measurement.py:98: in wrapper
    return func(*args, **unused_kwargs)
src/qumada/measurement/measurement.py:98: in wrapper
    return func(*args, **unused_kwargs)
src/qumada/measurement/measurement.py:98: in wrapper
    return func(*args, **unused_kwargs)
src/qumada/measurement/scripts/generic_measurement.py:653: in run
    self.generate_lists()
src/qumada/measurement/measurement.py:476: in generate_lists
    param.root_instrument._qumada_mapping for param in self.dynamic_channels if is_triggerable(param)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

object = None

    def is_triggerable(object: Instrument | Parameter):
        """
        Checks if the instrument or parameter can be triggered by checking the corresponding flag in
        the mapping
        """
        if isinstance(object, Parameter):
            object = object.root_instrument
>       return object._is_triggerable
E       AttributeError: 'NoneType' object has no attribute '_is_triggerable'

src/qumada/instrument/buffers/buffer.py:51: AttributeError