def launch(self, view_model): # type: (DualBrainViewerModel) -> dict time_series_index = self.load_entity_by_gid(view_model.time_series) self.surface_index = None shell_surface_index = None if view_model.projection_surface: self.surface_index = self.load_entity_by_gid(view_model.projection_surface) if view_model.shell_surface: shell_surface_index = self.load_entity_by_gid(view_model.shell_surface) if isinstance(time_series_index, TimeSeriesSEEGIndex): shell_surface_index = ensure_shell_surface(self.current_project_id, shell_surface_index, CORTICAL) params = BrainViewer.compute_parameters(self, time_series_index, shell_surface_index) eeg_monitor = EegMonitor() eeg_monitor.storage_path = self.storage_path params.update(eeg_monitor.compute_parameters(time_series_index, is_extended_view=True)) params['isOneToOneMapping'] = False params['brainViewerTemplate'] = 'view.html' if isinstance(time_series_index, TimeSeriesSEEGIndex): params['brainViewerTemplate'] = "internal_view.html" # Mark as None since we only display shell face and no point to load these as well params['urlVertices'] = None params['isSEEG'] = True return self.build_display_result("brain/extendedview", params, pages=dict(controlPage="brain/extendedcontrols", channelsPage="commons/channel_selector.html"))
def test_launch(self, time_series_index_factory): """ Check that all required keys are present in output from EegMonitor launch. """ time_series_index = time_series_index_factory() viewer = EegMonitor() view_model = viewer.get_view_model_class()() view_model.input_data = time_series_index.gid result = viewer.launch(view_model) expected_keys = ['tsNames', 'groupedLabels', 'tsModes', 'tsStateVars', 'longestChannelLength', 'label_x', 'entities', 'page_size', 'number_of_visible_points', 'extended_view', 'initialSelection', 'ag_settings', 'ag_settings'] for key in expected_keys: assert key in result, "key not found %s" % key expected_ag_settings = ['channelsPerSet', 'channelLabels', 'noOfChannels', 'translationStep', 'normalizedSteps', 'nan_value_found', 'baseURLS', 'pageSize', 'nrOfPages', 'timeSetPaths', 'totalLength', 'number_of_visible_points', 'extended_view', 'measurePointsSelectionGIDs'] ag_settings = json.loads(result['ag_settings']) for key in expected_ag_settings: assert key in ag_settings, "ag_settings should have the key %s" % key
def test_launch(self): """ Check that all required keys are present in output from BrainViewer launch. """ zip_path = os.path.join(os.path.dirname(sensors_dataset.__file__), 'eeg_unitvector_62.txt.bz2') TestFactory.import_sensors(self.test_user, self.test_project, zip_path, 'EEG Sensors') sensors = TestFactory.get_entity(self.test_project, SensorsEEG()) time_series = self.datatypeFactory.create_timeseries(self.connectivity, 'EEG', sensors) viewer = EegMonitor() result = viewer.launch(time_series) expected_keys = ['tsNames', 'groupedLabels', 'tsModes', 'tsStateVars', 'longestChannelLength', 'label_x', 'entities', 'page_size', 'number_of_visible_points', 'extended_view', 'initialSelection', 'ag_settings', 'ag_settings'] for key in expected_keys: self.assertTrue(key in result, "key not found %s" % key) expected_ag_settings = ['channelsPerSet', 'channelLabels', 'noOfChannels', 'translationStep', 'normalizedSteps', 'nan_value_found', 'baseURLS', 'pageSize', 'nrOfPages', 'timeSetPaths', 'totalLength', 'number_of_visible_points', 'extended_view', 'measurePointsSelectionGIDs'] ag_settings = json.loads(result['ag_settings']) for key in expected_ag_settings: self.assertTrue(key in ag_settings, "ag_settings should have the key %s" % key)
def launch(self, time_series, projection_surface=None, shell_surface=None): self.surface_index = projection_surface if isinstance(time_series, TimeSeriesSEEGIndex) and shell_surface is None: shell_surface = dao.try_load_last_surface_of_type( self.current_project_id, CORTICAL) params = BrainViewer.compute_parameters(self, time_series, shell_surface) eeg_monitor = EegMonitor() eeg_monitor.storage_path = self.storage_path params.update( eeg_monitor.compute_parameters(time_series, is_extended_view=True)) params['isOneToOneMapping'] = False params['brainViewerTemplate'] = 'view.html' if isinstance(time_series, TimeSeriesSEEGIndex): params['brainViewerTemplate'] = "internal_view.html" # Mark as None since we only display shelf face and no point to load these as well params['urlVertices'] = None params['isSEEG'] = True return self.build_display_result( "brain/extendedview", params, pages=dict(controlPage="brain/extendedcontrols", channelsPage="commons/channel_selector.html"))
def test_launch(self): """ Check that all required keys are present in output from BrainViewer launch. """ zip_path = os.path.join(os.path.dirname(sensors_dataset.__file__), 'EEG_unit_vectors_BrainProducts_62.txt.bz2') TestFactory.import_sensors(self.test_user, self.test_project, zip_path, 'EEG Sensors') sensors = TestFactory.get_entity(self.test_project, SensorsEEG()) time_series = self.datatypeFactory.create_timeseries( self.connectivity, 'EEG', sensors) viewer = EegMonitor() result = viewer.launch(time_series) expected_keys = [ 'tsStateVars', 'tsModes', 'translationStep', 'total_length', 'title', 'timeSetPaths', 'number_of_visible_points', 'normalizedSteps', 'noOfChannels', 'labelsForCheckBoxes', 'label_x', 'graphLabels', 'entities', 'channelsPage' ] for key in expected_keys: self.assertTrue(key in result)
def launch(self, surface_activity, eeg_cap=None): """ Overwrite Brain Visualizer launch and extend functionality, by adding a Monitor set of parameters near. """ self.eeg_cap = eeg_cap params = BrainViewer.compute_parameters(self, surface_activity) params.update(EegMonitor().compute_parameters(surface_activity)) params['extended_view'] = True params['isOneToOneMapping'] = False return self.build_display_result("brain/extendedview", params, pages=dict(controlPage="brain/extendedcontrols", channelsPage="commons/channel_selector.html"))
def test_launch(self): """ Check that all required keys are present in output from BrainViewer launch. """ zip_path = os.path.join(os.path.dirname(sensors_dataset.__file__), 'EEG_unit_vectors_BrainProducts_62.txt.bz2') TestFactory.import_sensors(self.test_user, self.test_project, zip_path, 'EEG Sensors') sensors = TestFactory.get_entity(self.test_project, SensorsEEG()) time_series = self.datatypeFactory.create_timeseries( self.connectivity, 'EEG', sensors) viewer = EegMonitor() result = viewer.launch(time_series) expected_keys = [ 'tsNames', 'groupedLabels', 'tsModes', 'tsStateVars', 'longestChannelLength', 'label_x', 'entities', 'page_size', 'number_of_visible_points', 'extended_view', 'initialSelection', 'ag_settings', 'ag_settings' ] for key in expected_keys: self.assertTrue(key in result, "key not found %s" % key) expected_ag_settings = [ 'channelsPerSet', 'channelLabels', 'noOfChannels', 'translationStep', 'normalizedSteps', 'nan_value_found', 'baseURLS', 'pageSize', 'nrOfPages', 'timeSetPaths', 'totalLength', 'number_of_visible_points', 'extended_view', 'measurePointsSelectionGIDs' ] ag_settings = json.loads(result['ag_settings']) for key in expected_ag_settings: self.assertTrue(key in ag_settings, "ag_settings should have the key %s" % key)
def launch(self, time_series, projection_surface=None, shell_surface=None): self.surface = projection_surface params = BrainViewer.compute_parameters(self, time_series, shell_surface) params.update(EegMonitor().compute_parameters(time_series, is_extended_view=True)) params['isOneToOneMapping'] = False params['brainViewerTemplate'] = 'view.html' if isinstance(time_series, TimeSeriesSEEG): params['brainViewerTemplate'] = "internal_view.html" # Mark as None since we only display shelf face and no point to load these as well params['urlVertices'] = None params['isSEEG'] = True return self.build_display_result( "brain/extendedview", params, pages=dict(controlPage="brain/extendedcontrols", channelsPage="commons/channel_selector.html"))