예제 #1
0
 def _get_instrument_from_file(filename):
     with open(os.path.join(filename, 'instrument.txt')) as f:
         lines = f.readlines()[1:]
     sep = ifirst(lines, '\n')
     keywords_instrument = yaml.load(''.join(lines[:sep]))
     name = keywords_instrument.pop('name')
     keywords_calibration = yaml.load(''.join(lines[sep+2:]))
     calibration = QubicCalibration(**keywords_calibration)
     return QubicInstrument(name, calibration, **keywords_instrument)
예제 #2
0
def test_ifirst3():
    assert ifirst([1, 2, 2, 3], 2.0) == 1
    assert ilast([1, 2, 2, 3], 2.0) == 2
예제 #3
0
def test_ifirst1():
    assert ifirst([1, 2, 3], lambda x: x > 1.5) == 1
    assert ilast([1, 2, 3], lambda x: x > 1.5) == 2
예제 #4
0
def test_ifirst3():
    assert ifirst([1, 2, 2, 3], 2.) == 1
    assert ilast([1, 2, 2, 3], 2.) == 2
예제 #5
0
def test_ifirst1():
    assert ifirst([1, 2, 3], lambda x: x > 1.5) == 1
    assert ilast([1, 2, 3], lambda x: x > 1.5) == 2