From 66b389cb818be0f00fd5584e100a651c73005375 Mon Sep 17 00:00:00 2001 From: Lok-kun Tsui Date: Fri, 1 Nov 2019 13:10:49 -0600 Subject: [PATCH] Add biologic data functionality (#59) * Added example BioLogic data file. Started working on Bode plot function * Added loading of data from Biologic ECLab MPT format * Added loading of data from Biologic ECLab MPT format * Reverted plotting.py to commit ebdb855 * BioLogic Data files need latin-w specied as their encoding. --- data/exampleDataBioLogic.mpt | 104 +++++++++++++++++++ impedance/preprocessing.py | 42 +++++++- impedance/tests/test_preprocessing.py | 139 +++++++++++++++++--------- 3 files changed, 236 insertions(+), 49 deletions(-) create mode 100644 data/exampleDataBioLogic.mpt diff --git a/data/exampleDataBioLogic.mpt b/data/exampleDataBioLogic.mpt new file mode 100644 index 00000000..23eae411 --- /dev/null +++ b/data/exampleDataBioLogic.mpt @@ -0,0 +1,104 @@ +EC-Lab ASCII FILE +Nb header lines : 61 + +Potentio Electrochemical Impedance Spectroscopy + +Run on channel : 1 (SN 30924) +User : +CE vs. WE compliance from -10 V to 10 V +Electrode connection : standard +Ewe ctrl range : min = -2.50 V, max = 2.50 V +Safety Limits : + Do not start on E overload +Acquisition started on : 02/04/2018 10:02:46 +Technique started on : 02/04/2018 10:02:46 +Saved on : + File : EIS OCV after.mpr + Directory : C:\Users\shadd\OneDrive\Documents\EC-Lab\Data\Samples\LSC Thin Film Dynamic XAS\eis\ + Host : 100.88.9.64 +Device : SP-150 (SN 10791079) +Address : USB +EC-Lab for windows v11.18 (software) +Internet server v11.18 (firmware) +Command interpretor v11.16 (firmware) +Electrode material : +Initial state : +Electrolyte : +Comments : +Electrode surface area : 0.001 cm² +Characteristic mass : 0.001 g +Equivalent Weight : 0.000 g/eq. +Density : 0.000 g/cm3 +Cycle Definition : Charge/Discharge alternance +Mode Single sine +E (V) 0.0000 +vs. Ref +tE (h:m:s) 0:00:0.0000 +record 0 +dI 0.000 +unit dI mA +dt (s) 0.000 +fi 1.000 +unit fi kHz +ff 10.000 +unit ff mHz +Nd 9 +Points per decade +spacing Logarithmic +Va (mV) 20.0 +pw 0.10 +Na 1 +corr 0 +E range min (V) -2.500 +E range max (V) 2.500 +I Range Auto +Bandwidth 5 +nc cycles 0 +goto Ns' 0 +nr cycles 0 +inc. cycle 0 + +freq/Hz Re(Z)/Ohm -Im(Z)/Ohm |Z|/Ohm Phase(Z)/deg time/s /V /mA Cs/µF Cp/µF cycle number I Range |Ewe|/V |I|/A Re(Y)/Ohm-1 Im(Y)/Ohm-1 |Y|/Ohm-1 Phase(Y)/deg +1.0003201E+003 6.5470886E+001 3.8998979E-001 6.5472046E+001 -3.4128919E-001 7.836904905780102E-001 -2.8677555E-004 -4.8041187E-002 4.0796973E+002 1.4475133E-002 1.000000000000000E+000 11 2.0979473E-002 3.2043408E-004 1.5273423E-002 9.0979054E-005 1.5273694E-002 3.4128919E-001 +7.7024658E+002 6.3611004E+001 1.3082615E+000 6.3624454E+001 -1.1782128E+000 1.023564581904793E+000 -1.5194454E-004 -4.6747018E-002 1.5794133E+002 6.6778518E-002 1.000000000000000E+000 11 2.0540658E-002 3.2284218E-004 1.5713904E-002 3.2318145E-004 1.5717227E-002 1.1782128E+000 +5.9291284E+002 6.3786083E+001 -4.9220982E-001 6.3787983E+001 4.4211814E-001 1.263390459964285E+000 -7.4513012E-004 -4.3362688E-002 -5.4535461E+002 -3.2471459E-002 1.000000000000000E+000 11 2.0790689E-002 3.2593426E-004 1.5676467E-002 -1.2096857E-004 1.5676934E-002 -4.4211814E-001 +4.5631409E+002 6.6016418E+001 1.1641068E+000 6.6026680E+001 -1.0102260E+000 1.501974258018890E+000 -3.0815601E-004 -4.5148868E-002 2.9961490E+002 9.3134411E-002 1.000000000000000E+000 11 2.1135710E-002 3.2010864E-004 1.5143039E-002 2.6702625E-004 1.5145393E-002 1.0102260E+000 +3.5101083E+002 6.4581978E+001 -1.2355437E+000 6.4593796E+001 1.0960149E+000 1.740991762693739E+000 -4.4578550E-004 -4.4659656E-002 -3.6697925E+002 -1.3426912E-001 1.000000000000000E+000 11 2.0873591E-002 3.2315165E-004 1.5478531E-002 -2.9612597E-004 1.5481363E-002 -1.0960149E+000 +2.7043265E+002 6.2677181E+001 2.4978859E+000 6.2726936E+001 -2.2822120E+000 1.980250014021294E+000 -3.5031990E-004 -4.3256257E-002 2.3560712E+002 3.7361598E-001 1.000000000000000E+000 11 2.0410474E-002 3.2538612E-004 1.5929470E-002 6.3484022E-004 1.5942115E-002 2.2822120E+000 +2.0793719E+002 6.3067787E+001 -1.2588621E+000 6.3080349E+001 1.1434983E+000 2.221791572213988E+000 -8.1646649E-005 -4.5975298E-002 -6.0800867E+002 -2.4214636E-001 1.000000000000000E+000 11 2.0379290E-002 3.2306876E-004 1.5849641E-002 -3.1636612E-004 1.5852798E-002 -1.1434983E+000 +1.6025639E+002 6.4594604E+001 1.8496882E+000 6.4621078E+001 -1.6402358E+000 2.461283556855051E+000 -3.8442411E-004 -4.3489099E-002 5.3691589E+002 4.3990093E-001 1.000000000000000E+000 11 2.0884346E-002 3.2318165E-004 1.5468487E-002 4.4294534E-004 1.5474827E-002 1.6402358E+000 +1.2330331E+002 6.4560471E+001 -3.1567256E+000 6.4637596E+001 2.7992847E+000 2.703672688439838E+000 -4.8565463E-004 -4.6270505E-002 -4.0889194E+002 -9.7524077E-001 1.000000000000000E+000 11 2.0499757E-002 3.1714913E-004 1.5452412E-002 -7.5555564E-004 1.5470873E-002 -2.7992847E+000 +9.4908844E+001 6.3480858E+001 1.6610308E+000 6.3502586E+001 -1.4988508E+000 2.942820539785316E+000 -3.8451736E-004 -4.4392087E-002 1.0095685E+003 6.9072998E-001 1.000000000000000E+000 11 2.0590926E-002 3.2425334E-004 1.5742002E-002 4.1190290E-004 1.5747391E-002 1.4988508E+000 +7.3059525E+001 6.2966324E+001 5.2031708E-001 6.2968475E+001 -4.7344822E-001 3.188471964764176E+000 -2.7130955E-004 -4.5604751E-002 4.1867324E+003 2.8586766E-001 1.000000000000000E+000 11 2.0577567E-002 3.2679157E-004 1.5880421E-002 1.3122655E-004 1.5880963E-002 4.7344822E-001 +5.6241814E+001 5.7859802E+001 9.9445152E-001 5.7868347E+001 -9.8466057E-001 3.422752882586792E+000 -1.0407178E-004 -4.4780090E-002 2.8456221E+003 8.4035397E-001 1.000000000000000E+000 11 2.0143228E-002 3.4808714E-004 1.7278053E-002 2.9696242E-004 1.7280605E-002 9.8466057E-001 +4.3295860E+001 6.3966675E+001 1.3191714E+000 6.3980274E+001 -1.1814315E+000 3.671299161011120E+000 -2.6906142E-004 -4.4787843E-002 2.7865864E+003 1.1846302E+000 1.000000000000000E+000 11 2.0901790E-002 3.2669117E-004 1.5626494E-002 3.2226194E-004 1.5629817E-002 1.1814315E+000 +3.3346024E+001 6.5947289E+001 9.2110091E-001 6.5953720E+001 -8.0021131E-001 3.921533039567294E+000 -2.2575019E-004 -4.3758258E-002 5.1816597E+003 1.0106591E+000 1.000000000000000E+000 11 2.0938896E-002 3.1747861E-004 1.5160668E-002 2.1175254E-004 1.5162147E-002 8.0021131E-001 +2.5665239E+001 6.3702545E+001 1.7817245E+000 6.3727459E+001 -1.6021131E+000 4.154926330695162E+000 -9.5601783E-005 -4.6195067E-002 3.4804409E+003 2.7205839E+000 1.000000000000000E+000 11 2.0358242E-002 3.1945793E-004 1.5685689E-002 4.3871990E-004 1.5691822E-002 1.6021131E+000 +1.9753477E+001 6.5081535E+001 2.1123164E+000 6.5115807E+001 -1.8589658E+000 4.397345302189933E+000 -2.1638442E-004 -4.1474000E-002 3.8143242E+003 4.0138645E+000 1.000000000000000E+000 11 2.0845771E-002 3.2013381E-004 1.5349172E-002 4.9817981E-004 1.5357254E-002 1.8589658E+000 +1.5199414E+001 6.3539898E+001 4.5586529E+000 6.3703217E+001 -4.1036391E+000 4.633730913439649E+000 9.0237538E-004 -3.3789847E-002 2.2969775E+003 1.1762701E+001 1.000000000000000E+000 11 2.0587701E-002 3.2318151E-004 1.5657548E-002 1.1233466E-003 1.5697794E-002 4.1036391E+000 +1.1695360E+001 6.3876205E+001 1.0484103E+000 6.3884808E+001 -9.4032025E-001 4.841729163323180E+000 -4.0071129E-004 -4.6839628E-002 1.2980017E+004 3.4957681E+000 1.000000000000000E+000 11 2.0466087E-002 3.2035922E-004 1.5651066E-002 2.5688342E-004 1.5653174E-002 9.4032025E-001 +9.0005779E+000 6.4856674E+001 2.2519822E+000 6.4895760E+001 -1.9886506E+000 5.106054535863223E+000 -1.7444455E-004 -4.4451091E-002 7.8520815E+003 9.4554462E+000 1.000000000000000E+000 11 2.0855276E-002 3.2136578E-004 1.5400046E-002 5.3472724E-004 1.5409327E-002 1.9886506E+000 +6.9382758E+000 6.6270004E+001 4.8155041E+000 6.6444733E+001 -4.1560884E+000 5.284150250983657E+000 -5.1673641E-004 -4.2596571E-002 4.7635073E+003 2.5020111E+001 1.000000000000000E+000 11 2.1021318E-002 3.1637299E-004 1.5010525E-002 1.0907386E-003 1.5050102E-002 4.1560884E+000 +5.3364062E+000 6.0613422E+001 7.0270448E+000 6.1019394E+001 -6.6129022E+000 5.511760181805585E+000 -5.3050503E-004 -4.4840775E-002 4.2442261E+003 5.6287014E+001 1.000000000000000E+000 11 2.0068668E-002 3.2888999E-004 1.6279198E-002 1.8872826E-003 1.6388232E-002 6.6129022E+000 +4.1118407E+000 6.5389824E+001 5.1409044E+000 6.5591599E+001 -4.4953094E+000 5.799166702112416E+000 -2.5830572E-004 -4.4575538E-002 7.5291216E+003 4.6251621E+001 1.000000000000000E+000 11 2.0706074E-002 3.1568180E-004 1.5198955E-002 1.1949317E-003 1.5245855E-002 4.4953094E+000 +3.1603959E+000 6.5957474E+001 6.4717007E+000 6.6274216E+001 -5.6038833E+000 6.165715492876188E+000 -2.5586769E-004 -4.1634265E-002 7.7814443E+003 7.4200676E+001 1.000000000000000E+000 11 2.0657677E-002 3.1170005E-004 1.5016712E-002 1.4734290E-003 1.5088825E-002 5.6038833E+000 +2.4353178E+000 6.6105698E+001 8.3983793E+000 6.6637047E+001 -7.2403388E+000 7.091491243481869E+000 -2.5227055E-004 -4.5968611E-002 7.7816021E+003 1.2360285E+002 1.000000000000000E+000 12 2.0532459E-002 3.0812377E-004 1.4887007E-002 1.8913157E-003 1.5006667E-002 7.2403388E+000 +1.8735006E+000 6.7790421E+001 9.3406420E+000 6.8430908E+001 -7.8452168E+000 7.695733512213337E+000 -2.3840250E-004 -4.9602441E-002 9.0947256E+003 1.6944878E+002 1.000000000000000E+000 12 2.0631243E-002 3.0149010E-004 1.4476506E-002 1.9946748E-003 1.4613280E-002 7.8452168E+000 +1.4435508E+000 6.8793274E+001 1.2584828E+001 6.9934914E+001 -1.0366881E+001 8.474704402549833E+000 -2.6629356E-004 -4.8265681E-002 8.7607393E+003 2.8369214E+002 1.000000000000000E+000 12 2.0631682E-002 2.9501261E-004 1.4065588E-002 2.5731151E-003 1.4299010E-002 1.0366881E+001 +1.1097296E+000 7.0818695E+001 1.4015121E+001 7.2192184E+001 -1.1194271E+001 9.482888423750410E+000 -2.8385382E-004 -4.6256147E-002 1.0233073E+004 3.8567319E+002 1.000000000000000E+000 12 2.0676859E-002 2.8641408E-004 1.3588376E-002 2.6891590E-003 1.3851915E-002 1.1194271E+001 +8.5569519E-001 7.3593681E+001 1.6304792E+001 7.5378220E+001 -1.2492184E+001 1.078522027222789E+001 -2.2798174E-004 -4.4691723E-002 1.1407376E+004 5.3373364E+002 1.000000000000000E+000 12 2.0671895E-002 2.7424228E-004 1.2952357E-002 2.8696144E-003 1.3266432E-002 1.2492184E+001 +6.5806097E-001 7.7258682E+001 1.8608200E+001 7.9468040E+001 -1.3542087E+001 1.247328605907387E+001 -2.3022603E-004 -4.4709988E-002 1.2997194E+004 7.1264520E+002 1.000000000000000E+000 12 2.0611921E-002 2.5937372E-004 1.2233825E-002 2.9465877E-003 1.2583675E-002 1.3542087E+001 +5.0638443E-001 8.1968651E+001 2.0657204E+001 8.4531532E+001 -1.4144769E+001 1.466198717639782E+001 -2.6393970E-004 -4.5334160E-002 1.5214870E+004 9.0860236E+002 1.000000000000000E+000 12 2.0720711E-002 2.4512404E-004 1.1471239E-002 2.8909065E-003 1.1829905E-002 1.4144769E+001 +3.8965085E-001 8.6686745E+001 2.1498911E+001 8.9312904E+001 -1.3928714E+001 1.750188021795475E+001 -3.2005640E-004 -4.5885794E-002 1.8998883E+004 1.1008612E+003 1.000000000000000E+000 12 2.0682929E-002 2.3157828E-004 1.0867365E-002 2.6951814E-003 1.1196590E-002 1.3928714E+001 +2.9992697E-001 9.2175919E+001 2.1338537E+001 9.4613602E+001 -1.3034252E+001 2.118497017957270E+001 -2.4967210E-004 -4.5876503E-002 2.4867949E+004 1.2649172E+003 1.000000000000000E+000 12 2.0666899E-002 2.1843475E-004 1.0296991E-002 2.3837325E-003 1.0569305E-002 1.3034252E+001 +2.3078397E-001 9.6659569E+001 1.9389862E+001 9.8585190E+001 -1.1342957E+001 2.596847926007467E+001 -2.1849413E-004 -4.5806799E-002 3.5566387E+004 1.3758334E+003 1.000000000000000E+000 12 2.0514278E-002 2.0808681E-004 9.9453824E-003 1.9950387E-003 1.0143511E-002 1.1342957E+001 +1.7773455E-001 1.0135281E+002 1.7685032E+001 1.0288417E+002 -9.8978796E+000 3.217531640824745E+001 -2.7801958E-004 -4.5361456E-002 5.0634020E+004 1.4960874E+003 1.000000000000000E+000 12 2.0630637E-002 2.0052295E-004 9.5749972E-003 1.6707394E-003 9.7196680E-003 9.8978796E+000 +1.3685971E-001 1.0487324E+002 1.4734948E+001 1.0590333E+002 -7.9978442E+000 4.023156292419299E+001 -2.8862839E-004 -4.5373376E-002 7.8921602E+004 1.5278259E+003 1.000000000000000E+000 12 2.0701602E-002 1.9547640E-004 9.3507292E-003 1.3138006E-003 9.4425743E-003 7.9978442E+000 +1.0535786E-001 1.0643014E+002 1.2445711E+001 1.0715536E+002 -6.6697531E+000 5.069225056775031E+001 -3.2512844E-004 -4.6334777E-002 1.2137618E+005 1.6373636E+003 1.000000000000000E+000 12 2.0622525E-002 1.9245445E-004 9.2690848E-003 1.0839067E-003 9.3322443E-003 6.6697531E+000 +8.1177264E-002 1.0825275E+002 9.8288803E+000 1.0869805E+002 -5.1879830E+000 6.426458385228761E+001 -2.7158897E-004 -4.6403907E-002 1.9947188E+005 1.6309711E+003 1.000000000000000E+000 12 2.0676991E-002 1.9022412E-004 9.1621093E-003 8.3187973E-004 9.1997972E-003 5.1879830E+000 +6.2444042E-002 1.0905769E+002 7.8290782E+000 1.0933835E+002 -4.1061287E+000 8.190427154357894E+001 -2.9753472E-004 -4.6381809E-002 3.2555059E+005 1.6691476E+003 1.000000000000000E+000 12 2.0652365E-002 1.8888492E-004 9.1224452E-003 6.5488584E-004 9.1459220E-003 4.1061287E+000 +4.8106518E-002 1.0965545E+002 5.8287849E+000 1.0981026E+002 -3.0427196E+000 1.047969864975894E+002 -2.7181290E-004 -4.6593346E-002 5.6759450E+005 1.5992208E+003 1.000000000000000E+000 12 2.0665042E-002 1.8818863E-004 9.0937791E-003 4.8338398E-004 9.1066174E-003 3.0427196E+000 +3.7039053E-002 1.1001928E+002 4.7268991E+000 1.1012077E+002 -2.4601591E+000 1.345257991363178E+002 -2.6343847E-004 -4.6538346E-002 9.0904188E+005 1.6749355E+003 1.000000000000000E+000 12 2.0656547E-002 1.8758084E-004 9.0725692E-003 3.8979642E-004 9.0809390E-003 2.4601591E+000 +2.8483247E-002 1.1061794E+002 3.7406499E+000 1.1068118E+002 -1.9367727E+000 1.731803454789624E+002 -2.9081272E-004 -4.6354901E-002 1.4937694E+006 1.7062009E+003 1.000000000000000E+000 12 2.0677306E-002 1.8681864E-004 9.0297991E-003 3.0535116E-004 9.0349605E-003 1.9367727E+000 +2.1945218E-002 1.1078029E+002 2.8922150E+000 1.1081804E+002 -1.4955194E+000 2.233466787150901E+002 -2.8049920E-004 -4.5970257E-002 2.5075503E+006 1.7080079E+003 1.000000000000000E+000 12 2.0674316E-002 1.8656092E-004 9.0207281E-003 2.3551015E-004 9.0238014E-003 1.4955194E+000 +1.6895540E-002 1.1097003E+002 2.3458567E+000 1.1099483E+002 -1.2110267E+000 2.885022309564229E+002 -2.8034937E-004 -4.5939464E-002 4.0155640E+006 1.7936761E+003 1.000000000000000E+000 12 2.0680824E-002 1.8632242E-004 9.0074167E-003 1.9041274E-004 9.0094293E-003 1.2110267E+000 \ No newline at end of file diff --git a/impedance/preprocessing.py b/impedance/preprocessing.py index 54291b8a..67b0d9fc 100644 --- a/impedance/preprocessing.py +++ b/impedance/preprocessing.py @@ -25,7 +25,7 @@ def readFile(filename, instrument=None): """ supported_types = ['gamry', 'autolab', 'parstat', 'zplot', 'versastudio' - 'powersuite'] + 'powersuite', 'biologic'] if instrument is not None: assert instrument in supported_types,\ @@ -36,6 +36,8 @@ def readFile(filename, instrument=None): f, Z = readGamry(filename) elif instrument == 'autolab': f, Z = readAutolab(filename) + elif instrument == 'biologic': + f, Z = readBioLogic(filename) elif instrument == 'parstat': f, Z = readParstat(filename) elif instrument == 'zplot': @@ -114,6 +116,44 @@ def readAutolab(filename): return np.array(f), np.array(Z) +def readBioLogic(filename): + """ function for reading the .mpt file from Biologic + EC-lab software + + Parameters + ---------- + filename: string + Filename of .csv file to extract impedance data from + + Returns + ------- + frequencies : np.ndarray + Array of frequencies + impedance : np.ndarray of complex numbers + Array of complex impedances + + """ + + with open(filename, 'r', encoding="latin-1") as input_file: + lines = input_file.readlines() + + header_line = lines[1] + + # MPT data format has variable number of header lines + number_header_lines = int(header_line.split(":")[1]) + + raw_data = lines[number_header_lines:] + f, Z = [], [] + for line in raw_data: + each = line.split('\t') + f.append(float(each[0])) + + # MPT data format saves the imaginary portion as -Im(Z) not Im(Z) + Z.append(complex(float(each[1]), -1*float(each[2]))) + + return np.array(f), np.array(Z) + + def readParstat(filename): """ function for reading the .txt file from Parstat diff --git a/impedance/tests/test_preprocessing.py b/impedance/tests/test_preprocessing.py index ddf8165b..06a777dd 100644 --- a/impedance/tests/test_preprocessing.py +++ b/impedance/tests/test_preprocessing.py @@ -1,6 +1,6 @@ from impedance.preprocessing import readFile, readGamry, ignoreBelowX from impedance.preprocessing import readZPlot, readVersaStudio -from impedance.preprocessing import readPowerSuite +from impedance.preprocessing import readPowerSuite, readBioLogic from impedance.preprocessing import cropFrequencies import numpy as np @@ -208,17 +208,18 @@ 1120134.9, 2000000]) f_VerStu = np.array([100000, 77426.37, 59948.43, 46415.89, 35938.14, - 27825.59, 21544.35, 16681.01, 12915.5, 10000, 7742.637, - 5994.842, 4641.589, 3593.814, 2782.559, 2154.435, 1668.101, - 1291.55, 1000, 774.2637, 599.4843, 464.1589, 359.3814, - 278.256, 215.4435, 166.8101, 129.155, 100, 77.42637, - 59.94843, 46.41589, 35.93814, 27.82559, 21.54435, - 16.68101, 12.9155, 10, 7.742637, 5.994843, 4.641589, - 3.593814, 2.782559, 2.154435, 1.668101, 1.29155, 1, - 0.7742637, 0.5994843, 0.4641589, 0.3593814, 0.2782559, - 0.2154435, 0.1668101, 0.129155, 0.1, 0.07742637, - 0.05994843, 0.04641589, 0.03593814, 0.02782559, - 0.02154435]) + 27825.59, 21544.35, 16681.01, 12915.5, 10000, 7742.637, + 5994.842, 4641.589, 3593.814, 2782.559, + 2154.435, 1668.101, + 1291.55, 1000, 774.2637, 599.4843, 464.1589, 359.3814, + 278.256, 215.4435, 166.8101, 129.155, 100, 77.42637, + 59.94843, 46.41589, 35.93814, 27.82559, 21.54435, + 16.68101, 12.9155, 10, 7.742637, 5.994843, 4.641589, + 3.593814, 2.782559, 2.154435, 1.668101, 1.29155, 1, + 0.7742637, 0.5994843, 0.4641589, 0.3593814, 0.2782559, + 0.2154435, 0.1668101, 0.129155, 0.1, 0.07742637, + 0.05994843, 0.04641589, 0.03593814, 0.02782559, + 0.02154435]) Zr_powersuite = np.array([423929.46, 407724.77, @@ -284,7 +285,6 @@ Z_powersuite = Zr_powersuite + 1j * Zi_powersuite - Zr_VerStu = np.array([55.31571, 56.93847, 58.32154, 59.73283, 60.96293, 62.34844, 63.46056, 64.4969, 65.37202, 66.43731, 67.78217, 68.5193, 69.38809, 70.42213, 72.07207, @@ -300,22 +300,21 @@ 1516.313]) Zi_VerStu = np.array([4.575431, 1.668054, -0.03684627, -1.969503, -2.897054, - -3.826518, -4.245813, -4.721501, -4.980665, -5.291955, - -5.316875, -5.578281, -5.477057, -5.731471, -5.816343, - -5.628813, -5.913171, -6.051136, -6.137753, -6.528912, - -7.033413, -7.800642, -8.996423, -10.57455, -12.52785, - -15.52149, -19.00842, -23.22614, -29.20773, -34.91376, - -43.38998, -53.83748, -66.16342, -81.11567, -99.15878, - -119.0632, -141.2555, -169.2192, -198.209, -230.7009, - -264.5615, -299.5144, -335.2198, -370.0366, -400.9045, - -429.04, -451.8962, -468.4555, -478.3702, -478.1073, - -469.5371, -449.1746, -420.9942, -384.3542, -342.7299, - -299.3539, -257.4971, -215.6761, -181.6588, -150.2267, - -122.8279]) + -3.826518, -4.245813, -4.721501, -4.980665, -5.291955, + -5.316875, -5.578281, -5.477057, -5.731471, -5.816343, + -5.628813, -5.913171, -6.051136, -6.137753, -6.528912, + -7.033413, -7.800642, -8.996423, -10.57455, -12.52785, + -15.52149, -19.00842, -23.22614, -29.20773, -34.91376, + -43.38998, -53.83748, -66.16342, -81.11567, -99.15878, + -119.0632, -141.2555, -169.2192, -198.209, -230.7009, + -264.5615, -299.5144, -335.2198, -370.0366, -400.9045, + -429.04, -451.8962, -468.4555, -478.3702, -478.1073, + -469.5371, -449.1746, -420.9942, -384.3542, -342.7299, + -299.3539, -257.4971, -215.6761, -181.6588, -150.2267, + -122.8279]) Z_VerStu = Zr_VerStu + 1j * Zi_VerStu - f_ZPlot = np.array([3.000000e+05, 2.382985e+05, 1.892872e+05, 1.503562e+05, 1.194321e+05, 9.486833e+04, 7.535659e+04, 5.985787e+04, 4.754680e+04, 3.776776e+04, 3.000000e+04, 2.382985e+04, @@ -332,31 +331,71 @@ 1.892870e+00, 1.503560e+00, 1.194320e+00, 1.000000e+00]) Zr_ZPlot = np.array([147.77, 148.93, 150.48, 151.46, 153.2, 155.62, 158.98, - 164.45, 172.73, 184.99, 203.10, 228.85, 264.03, 309.13, - 362.59, 419.55, 475.02, 523.25, 563.36, 590.31, 613.68, - 626.31, 635.67, 641.11, 645.33, 648.19, 649.75, 650.67, - 652.12, 651.82, 653.25, 652.64, 652.37, 653.05, 651.39, - 653.11, 652.42, 654.90, 653.10, 653.17, 653.14, 653.53, - 652.66, 653.13, 652.79, 652.05, 653.44, 651.58, 650.93, - 653.24, 654.68, 652.33, 652.27, 652.48, 653.25, 654.19]) + 164.45, 172.73, 184.99, 203.10, 228.85, 264.03, 309.13, + 362.59, 419.55, 475.02, 523.25, 563.36, 590.31, 613.68, + 626.31, 635.67, 641.11, 645.33, 648.19, 649.75, 650.67, + 652.12, 651.82, 653.25, 652.64, 652.37, 653.05, 651.39, + 653.11, 652.42, 654.90, 653.10, 653.17, 653.14, 653.53, + 652.66, 653.13, 652.79, 652.05, 653.44, 651.58, 650.93, + 653.24, 654.68, 652.33, 652.27, 652.48, 653.25, 654.19]) Zi_ZPlot = np.array([-1.1335e+01, -1.7302e+01, -2.3653e+01, -3.1301e+01, - -4.0748e+01, -5.2177e+01, -6.5761e+01, -8.2536e+01, - -1.0261e+02, -1.2607e+02, -1.5276e+02, -1.8117e+02, - -2.0876e+02, -2.3205e+02, -2.4704e+02, -2.4885e+02, - -2.3945e+02, -2.1885e+02, -1.9176e+02, -1.6694e+02, - -1.3713e+02, -1.1137e+02, -9.0614e+01, -7.1190e+01, - -5.9297e+01, -4.6257e+01, -3.6456e+01, -3.0742e+01, - -2.3792e+01, -1.8864e+01, -1.2276e+01, -1.1308e+01, - -9.5142e+00, -7.6985e+00, -6.3635e+00, -4.9270e+00, - -4.3839e+00, -1.4622e+00, -2.0900e+00, -1.8532e+00, - -1.7382e+00, -1.4767e+00, -8.4596e-01, -1.3005e+00, - -1.1834e+00, -1.1508e+00, -8.3833e-01, -7.0630e-01, - 8.1795e-02, 6.2940e-01, 1.6343e-01, 5.4773e-01, - -5.1657e-01, 1.6725e+00, -1.2792e-01, 6.4271e-01]) + -4.0748e+01, -5.2177e+01, -6.5761e+01, -8.2536e+01, + -1.0261e+02, -1.2607e+02, -1.5276e+02, -1.8117e+02, + -2.0876e+02, -2.3205e+02, -2.4704e+02, -2.4885e+02, + -2.3945e+02, -2.1885e+02, -1.9176e+02, -1.6694e+02, + -1.3713e+02, -1.1137e+02, -9.0614e+01, -7.1190e+01, + -5.9297e+01, -4.6257e+01, -3.6456e+01, -3.0742e+01, + -2.3792e+01, -1.8864e+01, -1.2276e+01, -1.1308e+01, + -9.5142e+00, -7.6985e+00, -6.3635e+00, -4.9270e+00, + -4.3839e+00, -1.4622e+00, -2.0900e+00, -1.8532e+00, + -1.7382e+00, -1.4767e+00, -8.4596e-01, -1.3005e+00, + -1.1834e+00, -1.1508e+00, -8.3833e-01, -7.0630e-01, + 8.1795e-02, 6.2940e-01, 1.6343e-01, 5.4773e-01, + -5.1657e-01, 1.6725e+00, -1.2792e-01, 6.4271e-01]) Z_ZPlot = Zr_ZPlot + 1j * Zi_ZPlot +f_BioLogic = np.array([1.00032010e+03, 7.70246580e+02, 5.92912840e+02, + 4.56314090e+02, 3.51010830e+02, 2.70432650e+02, + 2.07937190e+02, 1.60256390e+02, 1.23303310e+02, + 9.49088440e+01, 7.30595250e+01, 5.62418140e+01, + 4.32958600e+01, 3.33460240e+01, 2.56652390e+01, + 1.97534770e+01, 1.51994140e+01, 1.16953600e+01, + 9.00057790e+00, 6.93827580e+00, 5.33640620e+00, + 4.11184070e+00, 3.16039590e+00, 2.43531780e+00, + 1.87350060e+00, 1.44355080e+00, 1.10972960e+00, + 8.55695190e-01, 6.58060970e-01, 5.06384430e-01, + 3.89650850e-01, 2.99926970e-01, 2.30783970e-01, + 1.77734550e-01, 1.36859710e-01, 1.05357860e-01, + 8.11772640e-02, 6.24440420e-02, 4.81065180e-02, + 3.70390530e-02, 2.84832470e-02, 2.19452180e-02, + 1.68955400e-02]) + +Zr_BioLogic = np.array([65.470886, 63.611004, 63.786083, 66.016418, 64.581978, + 62.677181, 63.067787, 64.594604, 64.560471, 63.480858, + 62.966324, 57.859802, 63.966675, 65.947289, 63.702545, + 65.081535, 63.539898, 63.876205, 64.856674, 66.270004, + 60.613422, 65.389824, 65.957474, 66.105698, 67.790421, + 68.793274, 70.818695, 73.593681, 77.258682, 81.968651, + 86.686745, 92.175919, 96.659569, 101.35281, 104.87324, + 106.43014, 108.25275, 109.05769, 109.65545, 110.01928, + 110.61794, 110.78029, 110.97003]) + +Zi_BioLogic = np.array([-0.38998979, -1.3082615, 0.49220982, -1.1641068, + 1.2355437, -2.4978859, 1.2588621, -1.8496882, + 3.1567256, -1.6610308, -0.52031708, -0.99445152, + -1.3191714, -0.92110091, -1.7817245, -2.1123164, + -4.5586529, -1.0484103, -2.2519822, -4.8155041, + -7.0270448, -5.1409044, -6.4717007, -8.3983793, + -9.340642, -12.584828, -14.015121, -16.304792, + -18.6082, -20.657204, -21.498911, -21.338537, + -19.389862, -17.685032, -14.734948, -12.445711, + -9.8288803, -7.8290782, -5.8287849, -4.7268991, + -3.7406499, -2.892215, -2.3458567]) + +Z_BioLogic = Zr_BioLogic + 1j * Zi_BioLogic + def test_readFile(): f, Z = readFile('./data/exampleData.csv') @@ -364,6 +403,12 @@ def test_readFile(): assert (f == frequencies).all() and (Z == Z_correct).all() +def test_readBioLogic(): + f, Z = readBioLogic('./data/exampleDataBioLogic.mpt') + + assert (f == f_BioLogic).all() and (Z == Z_BioLogic).all() + + def test_readGamry(): f, Z = readGamry('./data/Chalco-in-buffer-50mV.DTA') @@ -377,14 +422,12 @@ def test_readPowerSuite(): def test_readVersaStudio(): - f, Z = readVersaStudio('./data/exampleDataVersaStudio.par') assert (f == f_VerStu).all() and (Z == Z_VerStu).all() def test_readZPlot(): - f, Z = readZPlot('./data/exampleDataZPlot.z') assert (f == f_ZPlot).all() and (Z == Z_ZPlot).all()