Example #1
0
class TestMeasure(TestCase):
    def setUp(self):
        self.p1 = ManualParameter('P1', initial_value=1)

    def test_simple_scalar(self):
        data = Measure(self.p1).run_temp()

        self.assertEqual(data.single_set.tolist(), [0])
        self.assertEqual(data.P1.tolist(), [1])
        self.assertEqual(len(data.arrays), 2, data.arrays)

        self.assertNotIn('loop', data.metadata)

        meta = data.metadata['measurement']
        self.assertEqual(meta['__class__'], 'qcodes.measure.Measure')
        self.assertEqual(len(meta['actions']), 1)
        self.assertFalse(meta['background'])
        self.assertFalse(meta['use_data_manager'])
        self.assertFalse(meta['use_threads'])

        ts_start = datetime.strptime(meta['ts_start'], '%Y-%m-%d %H:%M:%S')
        ts_end = datetime.strptime(meta['ts_end'], '%Y-%m-%d %H:%M:%S')
        self.assertGreaterEqual(ts_end, ts_start)

    def test_simple_array(self):
        data = Measure(MultiGetter(arr=(1.2, 3.4))).run_temp()

        self.assertEqual(data.index0.tolist(), [0, 1])
        self.assertEqual(data.arr.tolist(), [1.2, 3.4])
        self.assertEqual(len(data.arrays), 2, data.arrays)

    def test_array_and_scalar(self):
        self.p1.set(42)
        data = Measure(MultiGetter(arr=(5, 6)), self.p1).run_temp()

        self.assertEqual(data.single_set.tolist(), [0])
        self.assertEqual(data.P1.tolist(), [42])
        self.assertEqual(data.index0.tolist(), [0, 1])
        self.assertEqual(data.arr.tolist(), [5, 6])
        self.assertEqual(len(data.arrays), 4, data.arrays)
Example #2
0
#        data.write(write_metadata=True)
#
#
#add_T1exp_metadata(data)

#datatata = LP.run(background=False)
#%%



gate = ManualParameter('gate', vals=Numbers(-10, 10))
frequency = ManualParameter('frequency', vals=Numbers(-10, 10))
amplitude = ManualParameter('amplitude', vals=Numbers(-10, 10))
# a manual parameter returns a value that has been set
# so fix it to a value for this example
amplitude.set(-1)

combined = qc.combine(gate, frequency, name="gate_frequency")
combined.__dict__.items()

a = [1,2,3]
b = [c for c in a]
b = {'ele_%d'%i: i for i in a}
b = {'ele_{}'.format(i): i for i in a}
#
#Sweep = Loop(sweep_values = [1,2,3,4,5,6,8,77,32,44,564])
#
#a= np.array([5,6])
#
#lista = {}
#