def render(self): rec = self._context.recording res = self._context.sorting_result rows = [] rows.append(vd.tr(vd.th('Study'), vd.td(rec.study().name()))) rows.append(vd.tr(vd.th('Recording'), vd.td(rec.name()))) rows.append(vd.tr(vd.th('Directory'), vd.td(rec.directory()))) true_units = rec.trueUnitsInfo(format='json') rows.append( vd.tr(vd.th('Num. true units'), vd.td('{}'.format(len(true_units))))) RX = rec.recordingExtractor() rows.append( vd.tr(vd.th('Num. channels'), vd.td('{}'.format(len(RX.getChannelIds()))))) rows.append( vd.tr(vd.th('Samplerate'), vd.td('{}'.format(RX.getSamplingFrequency())))) recording_file_is_local = rec.recordingFileIsLocal() if recording_file_is_local: elmt = 'True' else: elmt = vd.span( 'False', ' ', vd.a('(download)', onclick=self._on_download_recording_file)) rows.append(vd.tr(vd.th('raw.mda is downloaded'), vd.td(elmt))) firings_true_file_is_local = rec.firingsTrueFileIsLocal() if firings_true_file_is_local: elmt = 'True' else: elmt = vd.span( 'False', ' ', vd.a('(download)', onclick=self._on_download_firings_true_file)) rows.append(vd.tr(vd.th('firings_true.mda is downloaded'), vd.td(elmt))) if res: rows.append(vd.tr(vd.th('Sorting result'), vd.td(res.sorterName()))) sorting = res.sorting() rows.append( vd.tr(vd.th('Num. sorted units'), vd.td('{}'.format(len(sorting.getUnitIds()))))) table = vd.table(rows, style={ 'text-align': 'left', 'width': 'auto', 'font-size': '13px' }, class_='table') return ScrollArea(vd.div(table), size=self._size)
def render(self): self._checkboxes = [] rows = [] elmts = [vd.th(val) for val in self._column_labels] if self._selection_mode == 'multiple': elmts = [vd.th('')] + elmts rows.append(vd.tr(elmts)) for row in self._rows: elmts = [vd.td(str(val)) for val in row['values']] if self._selection_mode == 'multiple': elmts = [vd.td(row['checkbox'])] + elmts rows.append(vd.tr(elmts)) table = vd.table(rows, class_='table') return ScrollArea(vd.div(table), size=self._size)
def render(self): rows = [] rows.append( vd.tr(vd.th('Unit ID'), vd.th('SNR'), vd.th('Peak channel'), vd.th('Num. events'), vd.th('Firing rate'))) if self._true_units_info: for unit in self._true_units_info: rows.append( vd.tr(vd.td(str(unit['unit_id'])), vd.td(str(unit['snr'])), vd.td(str(unit['peak_channel'])), vd.td(str(unit['num_events'])), vd.td(str(unit['firing_rate'])))) else: print('WARNING: true units info not found.') table = vd.table(rows, class_='table') return vd.div(ScrollArea(vd.div(table), height=400))
def render(self): # row info for the table rr = [] sdkeys = self._context.sorterDefinitionKeys() for sdkey in sdkeys: sdef = self._context.sorterDefinition(sdkey) rr.append( dict(label=sdkey, value=vd.pre(json.dumps(sdef, indent=4)))) rows = [] for r in rr: rows.append(vd.tr(vd.th(r['label']), vd.td(r['value']))) table = vd.table(rows, style={ 'text-align': 'left', 'width': 'auto', 'font-size': '13px' }, class_='table') return vd.components.ScrollArea( vd.div(vd.h2('Sorter definitions for analysis: {}'.format( self._context.analysisName())), table, height=self._size[1]))
def render(self): rows = [] rows.append(vd.tr( *[vd.th(c['label']) for c in self._columns] )) for index, record in enumerate(self._records): rows.append(vd.tr( *[vd.td(record.get(c['name'], '')) for c in self._columns], class_='tablewidget_row', id='{}'.format(index) )) table = vd.table(*rows, class_='table tablewidget', id='table-' + self.componentId()) if self._height: return vd.div(ScrollArea(table, height=self._height)) else: return table
def _to_table(X, column_names): rows = [] rows.append(vd.tr([vd.th(cname) for cname in column_names])) for x in X: elmts = [] for cname in column_names: tmp = x.get(cname) if tmp: if 'callback' in tmp: elmt = vd.a(tmp['text'], onclick=tmp['callback']) else: elmt = vd.span(str(tmp.get('text'))) else: elmt = vd.span('N/A') elmts.append(elmt) rows.append(vd.tr([vd.td(elmt) for elmt in elmts])) return vd.table(rows, class_='table')
def render(self): rows = [] rows.append(vd.tr( vd.th('Study'), vd.td(self._context.studyName()) )) rows.append(vd.tr( vd.th('Recording'), vd.td(self._context.recordingName()) )) rows.append(vd.tr( vd.th('Directory'), vd.td(self._context.recordingDirectory()) )) RX = self._context.recordingExtractor() rows.append(vd.tr( vd.th('Num. channels'), vd.td('{}'.format(len(RX.get_channel_ids()))) )) rows.append(vd.tr( vd.th('Samplerate'), vd.td('{}'.format(RX.get_sampling_frequency())) )) a = RX.get_num_frames() / RX.get_sampling_frequency() rows.append(vd.tr( vd.th('Duration (s)'), vd.td('{}'.format(a)) )) a = ', '.join(self._context.sortingResultNames()) rows.append(vd.tr( vd.th('Sorting results'), vd.td('{}'.format(a)) )) sc_true = self._context.trueSortingContext() if sc_true: SX_true = sc_true.sortingExtractor() true_unit_ids = SX_true.get_unit_ids() rows.append(vd.tr( vd.th('Num. true units'), vd.td('{}'.format(len(true_unit_ids))) )) table = vd.table(rows, style={ 'text-align': 'left', 'width': 'auto', 'font-size': '13px'}, class_='table') return vd.div( vd.h2('{}/{}'.format(self._context.studyName(), self._context.recordingName())), table )
def render(self): rows = [] rows.append( vd.tr(vd.th('Unit ID'), vd.th('Accuracy'), vd.th('Best unit'), vd.th('Matched unit'), vd.th('Num. matches'), vd.th('False negative rate'), vd.th('False positive rate'))) for ii in self._comparison_info: unit = self._comparison_info[ii] rows.append( vd.tr(vd.td(str(unit['unit_id'])), vd.td(str(unit['accuracy'])), vd.td(str(unit['best_unit'])), vd.td(str(unit['matched_unit'])), vd.td(str(unit['num_matches'])), vd.td(str(unit['f_n'])), vd.td(str(unit['f_p'])))) table = vd.table(rows, class_='table') return vd.div(ScrollArea(vd.div(table), height=400))
def render(self): # row info for the table rr = [] rr.append( dict(label='Recording groups', value=', '.join(self._context.recordingGroups()))) rr.append( dict(label='Sorters to run', value=', '.join(self._context.sorterKeys()))) rr.append(dict(label='Output path', value=self._context.outputPath())) rr.append( dict(label='Download from', value=', '.join(self._context.downloadFrom()))) rr.append( dict(label='Job timeout (sec)', value=self._context.jobTimeout())) rr.append( dict(label='Compute resources', value=', '.join(self._context.computeResourceKeys()))) rr.append( dict(label='Sorter definition keys', value=', '.join(self._context.sorterDefinitionKeys()))) rows = [] for r in rr: rows.append(vd.tr(vd.th(r['label']), vd.td(r['value']))) table = vd.table(rows, style={ 'text-align': 'left', 'width': 'auto', 'font-size': '13px' }, class_='table') return vd.components.ScrollArea( vd.div(vd.h2('Analysis: {}'.format(self._context.analysisName())), table, height=self._size[1]))
def render(self): if not self._recording: return vd.div('---') rec = self._recording rows = [] rows.append(vd.tr(vd.th('Study'), vd.td(rec.study().name()))) rows.append(vd.tr(vd.th('Recording'), vd.td(rec.name()))) rows.append(vd.tr(vd.th('Directory'), vd.td(rec.directory()))) true_units = rec.trueUnitsInfo(format='json') if true_units: rows.append( vd.tr(vd.th('Num. true units'), vd.td('{}'.format(len(true_units))))) RX = rec.recordingExtractor() rows.append( vd.tr(vd.th('Num. channels'), vd.td('{}'.format(len(RX.getChannelIds()))))) rows.append( vd.tr(vd.th('Samplerate'), vd.td('{}'.format(RX.getSamplingFrequency())))) recording_file_is_local = self._recording.recordingFileIsLocal() if recording_file_is_local: elmt = 'True' else: elmt = vd.span( 'False', ' ', vd.a('(download)', onclick=self._on_download_recording_file)) rows.append(vd.tr(vd.th('raw.mda is downloaded'), vd.td(elmt))) firings_true_file_is_local = self._recording.firingsTrueFileIsLocal() if firings_true_file_is_local: elmt = 'True' else: elmt = vd.span( 'False', ' ', vd.a('(download)', onclick=self._on_download_firings_true_file)) rows.append(vd.tr(vd.th('firings_true.mda is downloaded'), vd.td(elmt))) res = None if self._sorting_result_name: res = self._recording.sortingResult(self._sorting_result_name) if res: rows.append( vd.tr(vd.th('Sorting result'), vd.td(self._sorting_result_name))) sorting = res.sorting() rows.append( vd.tr(vd.th('Num. sorted units'), vd.td('{}'.format(len(sorting.getUnitIds()))))) table = vd.table(rows, style={ 'text-align': 'left', 'width': 'auto', 'font-size': '13px' }, class_='table') button_bar = ButtonBar([ ('View timeseries', self._on_view_timeseries), ('View electrode geometry', self._on_view_geometry), ('View true unit table', self._on_view_true_units), ('View true unit waveforms', self._on_view_true_unit_waveforms), ('View true unit autocorrelograms', self._on_view_true_unit_autocorrelograms) ]) elmts = [table, button_bar] if res: button_bar_result = ButtonBar([ ('View comparison with truth table', self._on_view_comparison_with_truth_table), ('View sorted unit waveforms', self._on_view_sorted_unit_waveforms) ]) elmts.append(button_bar_result) if self._view: elmts.append(self._view) return vd.div(elmts)