@@ -291,27 +291,46 @@ def _buildDataFrame(self):
291291 logger .error (f'error getting x/y allSpinesDf is: { type (allSpinesDf )} ' )
292292 print (allSpinesDf )
293293
294- allSpinesDf ['roiType' ] = 'spineROI'
295294 allSpinesDf .insert (0 ,'index' , allSpinesDf .index ) # index is first column (use this as row label)
295+
296+ addTheseColumns = ['roiType' , 'markerColor' , 'mplMarker' ]
297+ for aColumn in addTheseColumns :
298+ allSpinesDf [aColumn ] = None
299+
300+ # logger.info('allSpinesDf is:')
301+ # print(allSpinesDf.columns)
302+ # print(allSpinesDf.index)
303+ # print(allSpinesDf)
304+
305+ allSpinesDf ['roiType' ] = 'spineROI'
306+
307+ if len (allSpinesDf ) > 0 :
308+ allSpinesDf ['markerColor' ] = 'm'
309+ try :
310+ _notAcceptRowLabels = allSpinesDf [ ~ allSpinesDf ['accept' ] ]
311+ # logger.warning(f'_notAcceptRowLabels:{_notAcceptRowLabels}')
312+ # ValueError: The truth value of a Series is ambiguous.
313+ # Use a.empty, a.bool(), a.item(), a.any() or a.all().
314+ if len (_notAcceptRowLabels )> 0 :
315+ allSpinesDf .loc [_notAcceptRowLabels .index , 'markerColor' ] = 'w'
316+ except (KeyError ) as e :
317+ logger .error (f'{ e } ' )
318+ logger .error (f'available columns are: { allSpinesDf .columns } ' )
319+ logger .info ('_notAcceptRowLabels is:' )
320+ print (_notAcceptRowLabels )
321+ logger .error ('allSpinesDf is:' )
322+ print (allSpinesDf )
296323
297- # if len(allSpinesDf) > 0:
298- # TODO make this work
299- # marker color
300- # allSpinesDf['markerColor'] = 'm'
301- # try:
302- # _notAcceptRowLabels = allSpinesDf[ not allSpinesDf['accept'] ]
303- # allSpinesDf.loc[_notAcceptRowLabels, 'markerColor'] = 'w'
304- # except (KeyError) as e:
305- # logger.error(f'{e}')
306- # logger.error(f'available columns are: {allSpinesDf.columns}')
307-
308- # TODO make this work
309- # _userTypeMarkers = getUserTypeMarkers_mpl()
310- # allSpinesDf['mplMarker'] = 'o'
311- # for userType in range(10):
312- # # 10 user types
313- # _userTypeRowLabels = allSpinesDf[ allSpinesDf['userType'] == userType]
314- # allSpinesDf.loc[_userTypeRowLabels, 'mplMarker'] = _userTypeMarkers[userType]
324+ _userTypeMarkers = getUserTypeMarkers_mpl ()
325+ # logger.info(f'_userTypeMarkers:{_userTypeMarkers}')
326+ allSpinesDf ['mplMarker' ] = 'o'
327+ for userType in range (10 ):
328+ # 10 user types
329+ _userTypeRowLabels = allSpinesDf [ allSpinesDf ['userType' ] == userType ]
330+ # logger.info(f'userType:{userType}')
331+ # logger.info('_userTypeRowLabels.index:')
332+ # print(_userTypeRowLabels.index)
333+ allSpinesDf .loc [_userTypeRowLabels .index , 'mplMarker' ] = _userTypeMarkers [userType ]
315334
316335 self ._df = allSpinesDf
317336
0 commit comments