55import unittest
66
77import numpy as np
8- import pandas as pd
98
109from syncropatch_export .trace import Trace
1110from syncropatch_export .voltage_protocols import VoltageProtocol
@@ -89,10 +88,6 @@ def test_protocol_get_ramps(self):
8988 def test_get_QC (self ):
9089 QC_values = self .trace .get_onboard_QC_values ()
9190 self .assertGreater (len (QC_values ), 0 )
92- df = self .trace .get_onboard_QC_df ()
93-
94- self .assertGreater (df .shape [0 ], 0 )
95- self .assertGreater (df .shape [1 ], 0 )
9691
9792 def test_get_traces (self ):
9893 v = self .trace .get_voltage ()
@@ -119,47 +114,6 @@ def test_get_traces(self):
119114 self .assertRaisesRegex (ValueError , 'Invalid sweep selection' ,
120115 self .trace .get_trace_sweeps , [- 3 ])
121116
122- '''
123- # plot test output
124- if False:
125- d = 'test_output'
126- if not os.path.exists(d):
127- os.makedirs(d)
128-
129- import matplotlib.pyplot as plt
130- fig, (ax1, ax2) = plt.subplots(2, 1)
131- ax1.set_title('Example Sweeps')
132- some_sweeps = self.trace.get_trace_sweeps([0])['A01']
133-
134- ax1.plot(ts, np.transpose(some_sweeps), color='grey', alpha=0.5)
135- ax1.set_ylabel('Current')
136- ax1.set_xlabel('Time')
137- ax2.set_title('Voltage Protocol')
138- ax2.plot(ts, v)
139- ax2.set_ylabel('Voltage')
140- ax2.set_xlabel('Time')
141- plt.tight_layout()
142- plt.savefig(os.path.join(d, 'example_trace'))
143- plt.close(fig)
144- '''
145-
146- def test_qc_df (self ):
147- dfs = [self .trace .get_onboard_QC_df (sweeps = [0 ]),
148- self .trace .get_onboard_QC_df (sweeps = None )]
149- for res in dfs :
150- # Check res is a pd.DataFrame
151- self .assertIsInstance (res , pd .DataFrame )
152-
153- # Check it contains data (number of rows>0)
154- self .assertGreater (res .shape [0 ], 0 )
155-
156- # Check it contains all quality control parameters
157- for qcParam in ['Rseal' , 'Cm' , 'Rseries' , 'well' , 'sweep' ]:
158- self .assertIn (qcParam , res )
159-
160- # Check restricting number of sweeps returns less data
161- self .assertLess (dfs [0 ].shape [0 ], dfs [1 ].shape [0 ])
162-
163117
164118if __name__ == '__main__' :
165119 unittest .main () # pragma: no cover
0 commit comments