Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def render(self):
        if self._current_window:
            return vd.div(vd.a('home', onclick=self._on_home),
                          self._current_window)

        elmts = [
            vd.a(item['label'],
                 onclick=lambda item=item: self._open_item(item))
            for item in self._contents
        ]
        rows = [vd.tr(vd.td(elmt)) for elmt in elmts]
        table = vd.table(rows)
        return vd.div(table, style=dict(padding='30px'))
Exemplo n.º 3
0
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')
Exemplo n.º 4
0
    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)