@@ -183,8 +183,8 @@ def _setup_and_check(self, widget, data, title, readonly, **kwargs):
183
183
----------
184
184
widget: QWidget
185
185
Parent widget.
186
- data: dict of Array
187
- Arrays to compare as a {name: Array} dict .
186
+ data: list or tuple of Array or ndarray
187
+ Arrays to compare.
188
188
title: str
189
189
Title.
190
190
readonly: bool
@@ -195,21 +195,16 @@ def _setup_and_check(self, widget, data, title, readonly, **kwargs):
195
195
* atol: int or float
196
196
* nans_equal: bool
197
197
* bg_gradient: str
198
+ * names: list of str
198
199
"""
199
- if isinstance (data , (list , tuple )):
200
- names = kwargs .pop ('names' , [f"Array{ i } " for i in range (len (data ))])
201
- data = dict (zip (names , data ))
202
- warnings .warn ("For ArrayComparator.setup_and_check, using a list or tuple for the data argument, "
203
- "and using the names argument are both deprecated. Please use a dict instead" ,
204
- FutureWarning , stacklevel = 3 )
205
-
206
- assert all (isinstance (s , la .Array ) for s in data .values ())
200
+ arrays = [la .asarray (array ) for array in data if isinstance (array , DISPLAY_IN_GRID )]
201
+ names = kwargs .pop ('names' , [f"Array{ i } " for i in range (len (arrays ))])
207
202
208
203
layout = QVBoxLayout ()
209
204
widget .setLayout (layout )
210
205
211
206
comparator_widget = ComparatorWidget (self , ** kwargs )
212
- comparator_widget .set_data (data . values () , la .Axis (data . keys () , 'array' ))
207
+ comparator_widget .set_data (arrays , la .Axis (names , 'array' ))
213
208
layout .addWidget (comparator_widget )
214
209
215
210
@@ -234,8 +229,8 @@ def _setup_and_check(self, widget, data, title, readonly, **kwargs):
234
229
----------
235
230
widget: QWidget
236
231
Parent widget.
237
- data: dict of Session
238
- Sessions to compare as a {name: Session} dict .
232
+ data: list or tuple of Session
233
+ Sessions to compare.
239
234
title: str
240
235
Title.
241
236
readonly: bool
@@ -246,17 +241,14 @@ def _setup_and_check(self, widget, data, title, readonly, **kwargs):
246
241
* atol: int or float
247
242
* nans_equal: bool
248
243
* bg_gradient: str
244
+ * names: list of str
249
245
"""
250
- if isinstance (data , (list , tuple )):
251
- names = kwargs .pop ('names' , [f"Session{ i } " for i in range (len (data ))])
252
- data = dict (zip (names , data ))
253
- warnings .warn ("For SessionComparator.setup_and_check, using a list or tuple for the data argument, "
254
- "and using the names argument are both deprecated. Please use a dict instead" ,
255
- FutureWarning , stacklevel = 3 )
256
-
257
- assert all (isinstance (s , la .Session ) for s in data .values ())
258
- self .sessions = data .values ()
259
- self .stack_axis = la .Axis (data .keys (), 'session' )
246
+ sessions = data
247
+ names = kwargs .pop ('names' , [f"Session{ i } " for i in range (len (sessions ))])
248
+
249
+ assert all (isinstance (s , la .Session ) for s in sessions )
250
+ self .sessions = sessions
251
+ self .stack_axis = la .Axis (names , 'session' )
260
252
261
253
layout = QVBoxLayout ()
262
254
widget .setLayout (layout )
0 commit comments