mirror of
https://github.com/echemdata/galvani.git
synced 2025-12-14 01:15:34 +00:00
Added a class to read in .mpt files as numpy record arrays
Realised that comparing numpy arrays read in from the binary .mpr files to a csv.DictReader would be more work than just writing a new function to read in a record array.
This commit is contained in:
@@ -4,7 +4,7 @@ import os.path
|
||||
|
||||
from nose.tools import ok_, eq_, raises
|
||||
|
||||
from .. import MPTfile
|
||||
from ..BioLogic import MPTfile, MPTfileCSV
|
||||
|
||||
testdata_dir = os.path.join(os.path.dirname(__file__), 'testdata')
|
||||
|
||||
@@ -12,6 +12,20 @@ testdata_dir = os.path.join(os.path.dirname(__file__), 'testdata')
|
||||
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"))
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_open_MPT_fails_for_bad_file():
|
||||
mpt1 = MPTfile(os.path.join(testdata_dir, 'bio-logic1.mpr'))
|
||||
|
||||
|
||||
def test_open_MPT_csv():
|
||||
mpt1, comments = MPTfileCSV(os.path.join(testdata_dir, 'bio-logic1.mpt'))
|
||||
eq_(comments, [])
|
||||
eq_(mpt1.fieldnames, ["mode", "ox/red", "error", "control changes",
|
||||
"Ns changes", "counter inc.", "time/s",
|
||||
"control/V/mA", "Ewe/V", "dq/mA.h", "P/W",
|
||||
@@ -19,5 +33,5 @@ def test_open_MPT():
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_open_MPT_fails_for_bad_file():
|
||||
mpt1 = MPTfile(os.path.join(testdata_dir, 'bio-logic1.mpr'))
|
||||
def test_open_MPT_csv_fails_for_bad_file():
|
||||
mpt1 = MPTfileCSV(os.path.join(testdata_dir, 'bio-logic1.mpr'))
|
||||
|
||||
Reference in New Issue
Block a user