def test_instrument_encoders(self):
     instrument = qcodes.Instrument('test_instrument_y')
     data = {'instrument': instrument}
     serialized_data = encode_json(data)
     loaded_data = decode_json(serialized_data)
     self.assertEqual(loaded_data['instrument']['__object__'], '__qcodes_instrument__')
     self.assertEqual(loaded_data['instrument']['__content__']['name'], instrument.name)
     instrument.close()
Exemple #2
0
 def test_reshape_metadata_station(self):
     instr = qcodes.Instrument(qtt.measurements.scans.instrumentName('_dummy_test_reshape_metadata_123'))
     st = qcodes.Station(instr)
     result = reshape_metadata(st, printformat='dict')
     instr.close()
     self.assertTrue('_dummy_test_reshape_metadata_123' in result)
     self.assertTrue(isinstance(result, str))
     self.assertFalse('(' in result)
     self.assertFalse(')' in result)
Exemple #3
0
 def test_instrument_encoders(self):
     instrument = qcodes.Instrument('test_instrument_y')
     data = {'instrument': instrument}
     serialized_data = json.dumps(data, cls=QttJsonEncoder)
     loaded_data = json.loads(serialized_data, cls=QttJsonDecoder)
     self.assertEqual(loaded_data['instrument']['__object__'],
                      '__qcodes_instrument__')
     self.assertEqual(loaded_data['instrument']['__content__']['name'],
                      instrument.name)
     instrument.close()
Exemple #4
0
def test_channels_nomessages(model372):
    """
    Test that messages logged in a channel are not propagated to
    any instrument.
    """
    inst = model372
    # test with wrong instrument
    mock = qc.Instrument('mock')
    inst.sample_heater.set_range_from_temperature(1)
    with logger.LogCapture(level=logging.DEBUG) as logs,\
            logger.filter_instrument(mock, handler=logs.string_handler):
        inst.sample_heater.set_range_from_temperature(0.1)
    logs = [l for l in logs.value.splitlines() if '[lakeshore' in l]
    assert len(logs) == 0
    mock.close()
Exemple #5
0
def test_reshape_metadata():
    import qtt.measurements.scans
    param = qcodes.ManualParameter('dummy')
    try:
        dataset = qcodes.Loop(param[0:1:10]).each(param).run()
    except:
        dataset = None
        pass
    if dataset is not None:
        _ = reshape_metadata(dataset, printformat='dict')
    instr = qcodes.Instrument(
        qtt.measurements.scans.instrumentName(
            '_dummy_test_reshape_metadata_123'))
    st = qcodes.Station(instr)
    _ = reshape_metadata(st, printformat='dict')
    instr.close()
Exemple #6
0
def instrument():
    return qcodes.Instrument('ins')