def qc_run(name, seq, *params):
    loop = None
    for sp in seq.params:
        if loop is None:
            loop = Loop(sp[sp.values])
        else:
            loop = loop.loop((sp[sp.values]))

    play_task = Task(upload_play, seq)

    if loop is not None:
        m = loop.each(play_task, *params)
    else:
        m = Measure(play_task, *params)

    ds = m.run(loc_record={'name':name})
    return ds
示例#2
0
    def test_nested_loop_over_channels(self, loop_channels, measure_channel):
        channel_to_label = {0: 'A', 1: 'B', 2: 'C', 3: "D"}
        loc_fmt = 'data/{date}/#{counter}_{name}_{date}_{time}'
        rcd = {'name': 'nestedLoopOverChannels'}
        loc_provider = FormatLocation(fmt=loc_fmt, record=rcd)
        loop = Loop(
            self.instrument.channels[loop_channels[0]].temperature.sweep(
                0, 10, 0.5))
        loop = loop.loop(
            self.instrument.channels[loop_channels[1]].temperature.sweep(
                50, 51, 0.1))
        loop = loop.each(self.instrument.channels[measure_channel].temperature)
        data = loop.run(location=loc_provider)

        self.assertEqual(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature_set'.format(
                    channel_to_label[loop_channels[0]])).ndarray.shape, (21, ))
        self.assertEqual(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature_set'.format(
                    channel_to_label[loop_channels[1]])).ndarray.shape, (
                        21,
                        11,
                    ))
        self.assertEqual(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature'.format(
                    channel_to_label[measure_channel])).ndarray.shape,
            (21, 11))

        assert_array_equal(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature_set'.format(
                    channel_to_label[loop_channels[0]])).ndarray,
            np.arange(0, 10.1, 0.5))

        expected_array = np.repeat(np.arange(50, 51.01, 0.1).reshape(1, 11),
                                   21,
                                   axis=0)
        array = getattr(
            data, 'testchanneldummy_Chan'
            '{}_temperature_set'.format(
                channel_to_label[loop_channels[1]])).ndarray
        assert_allclose(array, expected_array)
示例#3
0
    def test_nested_loop_over_channels(self, loop_channels, measure_channel):
        channel_to_label = {0: 'A', 1: 'B', 2: 'C', 3: "D"}
        loop = Loop(
            self.instrument.channels[loop_channels[0]].temperature.sweep(
                0, 10, 0.5))
        loop = loop.loop(
            self.instrument.channels[loop_channels[1]].temperature.sweep(
                50, 51, 0.1))
        loop = loop.each(self.instrument.channels[measure_channel].temperature)
        data = loop.run()

        self.assertEqual(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature_set'.format(
                    channel_to_label[loop_channels[0]])).ndarray.shape, (21, ))
        self.assertEqual(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature_set'.format(
                    channel_to_label[loop_channels[1]])).ndarray.shape, (
                        21,
                        11,
                    ))
        self.assertEqual(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature'.format(
                    channel_to_label[measure_channel])).ndarray.shape,
            (21, 11))

        assert_array_equal(
            getattr(
                data, 'testchanneldummy_Chan{}_temperature_set'.format(
                    channel_to_label[loop_channels[0]])).ndarray,
            np.arange(0, 10.1, 0.5))

        expected_array = np.repeat(np.arange(50, 51.01, 0.1).reshape(1, 11),
                                   21,
                                   axis=0)
        array = getattr(
            data, 'testchanneldummy_Chan'
            '{}_temperature_set'.format(
                channel_to_label[loop_channels[1]])).ndarray
        assert_allclose(array, expected_array)