def test_open_MPT(): mpt1, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic1.mpt')) eq_(comments, []) eq_(mpt1.dtype.names, ("mode", "ox/red", "error", "control changes", "Ns changes", "counter inc.", "time/s", "control/V/mA", "Ewe/V", "dQ/mA.h", "P/W", "I/mA", "(Q-Qo)/mA.h", "x"))
def test_MPR5_matches_MPT5(): mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic5.mpr')) mpt, comments = MPTfile( (re.sub(b'\tXXX\t', b'\t0\t', line) for line in open(os.path.join(testdata_dir, 'bio_logic5.mpt'), mode='rb'))) assert_MPR_matches_MPT(mpr, mpt, comments)
def test_MPR_matches_MPT(testdata_dir, basename): """Check the MPR parser against the MPT parser. Load a binary .mpr file and a text .mpt file which should contain exactly the same data. Check that the loaded data actually match. """ binpath = os.path.join(testdata_dir, basename + '.mpr') txtpath = os.path.join(testdata_dir, basename + '.mpt') mpr = MPRfile(binpath) mpt, comments = MPTfile(txtpath) assert_MPR_matches_MPT(mpr, mpt, comments)
def test_open_MPT_fails_for_bad_file(): mpt1 = MPTfile(os.path.join(testdata_dir, 'bio_logic1.mpr'))
def test_CA_455nm(): mpr = MPRfile(os.path.join(testdata_dir, '121_CA_455nm_6V_30min_C01.mpr')) mpt, comments = MPTfile( os.path.join(testdata_dir, '121_CA_455nm_6V_30min_C01.mpt')) assert_MPR_matches_MPT(mpr, mpt, comments)
def test_CV_C01(): mpr = MPRfile(os.path.join(testdata_dir, 'CV_C01.mpr')) mpt, comments = MPTfile(os.path.join(testdata_dir, 'CV_C01.mpt')) assert_MPR_matches_MPT(mpr, mpt, comments)
def test_MPR6_matches_MPT6(): mpr = MPRfile(os.path.join(testdata_dir, 'bio_logic6.mpr')) mpt, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic6.mpt')) mpr.data = mpr.data[:958] # .mpt file is incomplete assert_MPR_matches_MPT(mpr, mpt, comments)
def test_MPR4_matches_MPT4(): mpr4 = MPRfile(os.path.join(testdata_dir, 'bio_logic4.mpr')) mpt4, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic4.mpt')) assert_MPR_matches_MPT(mpr4, mpt4, comments)
def test_MPR2_matches_MPT2(): mpr2 = MPRfile(os.path.join(testdata_dir, 'bio_logic2.mpr')) mpt2, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic2.mpt')) assert_MPR_matches_MPT(mpr2, mpt2, comments)
def test_MPR1_matches_MPT1(): mpr1 = MPRfile(os.path.join(testdata_dir, 'bio_logic1.mpr')) mpt1, comments = MPTfile(os.path.join(testdata_dir, 'bio_logic1.mpt')) assert_MPR_matches_MPT(mpr1, mpt1, comments)
def test_open_MPT_fails_for_bad_file(testdata_dir): with pytest.raises(ValueError, match='Bad first line'): MPTfile(os.path.join(testdata_dir, 'bio_logic1.mpr'))