def test_launch_EEG(self):
        """
        Check that all required keys are present in output from EegSensorViewer launch.
        """
        ## Import Sensors
        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__), 'eeg_unitvector_62.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path, Sensors_Importer.EEG_SENSORS)
        sensors = TestFactory.get_entity(self.test_project, SensorsEEG())

        ## Import EEGCap
        cap_path = os.path.join(os.path.dirname(tvb_data.obj.__file__), 'eeg_cap.obj')
        TestFactory.import_surface_obj(self.test_user, self.test_project, cap_path, EEG_CAP)
        eeg_cap_surface = TestFactory.get_entity(self.test_project, EEGCap())

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id

        ## Launch with EEG Cap selected
        result = viewer.launch(sensors, eeg_cap_surface)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result)
        for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']:
            self.assertIsNotNone(result[key], "Value at key %s should not be None" % key)

        ## Launch without EEG Cap
        result = viewer.launch(sensors)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result)
        for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']:
            self.assertTrue(not result[key] or result[key] == "[]",
                            "Value at key %s should be None or empty, but is %s" % (key, result[key]))
Ejemplo n.º 2
0
    def test_launch_eeg(self):
        """
        Check that all required keys are present in output from EegSensorViewer launch.
        """
        ## Import Sensors
        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__),
                                'eeg_unitvector_62.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path,
                                   Sensors_Importer.EEG_SENSORS)
        sensors = TestFactory.get_entity(self.test_project, SensorsEEG())

        ## Import EEGCap
        cap_path = os.path.join(os.path.dirname(tvb_data.obj.__file__),
                                'eeg_cap.obj')
        TestFactory.import_surface_obj(self.test_user, self.test_project,
                                       cap_path, EEG_CAP)
        eeg_cap_surface = TestFactory.get_entity(self.test_project, EEGCap())

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id

        ## Launch with EEG Cap selected
        result = viewer.launch(sensors, eeg_cap_surface)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result)
        for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']:
            assert result[
                key] is not None, "Value at key %s should not be None" % key

        ## Launch without EEG Cap
        result = viewer.launch(sensors)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result)
        for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']:
            assert not result[key] or result[key] == "[]", "Value at key %s should be None or empty, " \
                                                           "but is %s" % (key, result[key])
Ejemplo n.º 3
0
    def test_launch_eeg(self):
        """
        Check that all required keys are present in output from EegSensorViewer launch.
        """
        # Import Sensors
        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__),
                                'eeg_unitvector_62.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path,
                                   SensorTypesEnum.TYPE_EEG)
        field = FilterChain.datatype + '.sensors_type'
        filters = FilterChain('', [field], [SensorTypesEnum.TYPE_EEG.value],
                              ['=='])
        sensors_index = TestFactory.get_entity(self.test_project, SensorsIndex,
                                               filters)

        # Import EEGCap
        cap_path = os.path.join(os.path.dirname(tvb_data.obj.__file__),
                                'eeg_cap.obj')
        TestFactory.import_surface_obj(self.test_user, self.test_project,
                                       cap_path,
                                       SurfaceTypesEnum.EEG_CAP_SURFACE)
        field = FilterChain.datatype + '.surface_type'
        filters = FilterChain('', [field],
                              [SurfaceTypesEnum.EEG_CAP_SURFACE.value], ['=='])
        eeg_cap_surface_index = TestFactory.get_entity(self.test_project,
                                                       SurfaceIndex, filters)

        viewer = SensorsViewer()
        view_model = viewer.get_view_model_class()()
        view_model.sensors = sensors_index.gid
        viewer.current_project_id = self.test_project.id

        # Launch without EEG Cap
        result = viewer.launch(view_model)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result)

        # Launch with EEG Cap selected
        view_model.shell_surface = eeg_cap_surface_index.gid
        result = viewer.launch(view_model)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_EEG, result)
        for key in ['urlVertices', 'urlTriangles', 'urlLines', 'urlNormals']:
            assert result[
                key] is not None, "Value at key %s should not be None" % key
    def test_launch_internal(self):
        """
        Check that all required keys are present in output from InternalSensorViewer launch.
        """
        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__), 'seeg_39.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path, Sensors_Importer.INTERNAL_SENSORS)
        sensors = TestFactory.get_entity(self.test_project, SensorsInternal())

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id

        result = viewer.launch(sensors)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_INTERNAL, result)
Ejemplo n.º 5
0
    def test_launch_MEG(self):
        """
        Check that all required keys are present in output from MEGSensorViewer launch.
        """

        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__), 'meg_channels_reg13.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path, Sensors_Importer.MEG_SENSORS)
        sensors = TestFactory.get_entity(self.test_project, SensorsMEG())

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id

        result = viewer.launch(sensors)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_MEG, result)
Ejemplo n.º 6
0
    def test_launch_internal(self):
        """
        Check that all required keys are present in output from InternalSensorViewer launch.
        """
        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__),
                                'internal_39.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path,
                                   Sensors_Importer.INTERNAL_SENSORS)
        sensors = TestFactory.get_entity(self.test_project, SensorsInternal())

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id

        result = viewer.launch(sensors)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_INTERNAL, result)
Ejemplo n.º 7
0
    def test_launch_MEG(self):
        """
        Check that all required keys are present in output from MEGSensorViewer launch.
        """

        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__),
                                'meg_channels_reg13.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path,
                                   Sensors_Importer.MEG_SENSORS)
        sensors = TestFactory.get_entity(self.test_project, SensorsMEG())

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id

        result = viewer.launch(sensors)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_MEG, result)
Ejemplo n.º 8
0
    def test_launch_internal(self):
        """
        Check that all required keys are present in output from InternalSensorViewer launch.
        """
        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__),
                                'seeg_39.txt.bz2')
        sensors_index = TestFactory.import_sensors(
            self.test_user, self.test_project, zip_path,
            SensorsImporterModel.OPTIONS['Internal Sensors'])
        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id
        view_model = viewer.get_view_model_class()()
        view_model.sensors = sensors_index.gid

        result = viewer.launch(view_model)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_INTERNAL, result)
Ejemplo n.º 9
0
    def test_launch_meg(self):
        """
        Check that all required keys are present in output from MEGSensorViewer launch.
        """

        zip_path = os.path.join(os.path.dirname(tvb_data.sensors.__file__),
                                'meg_151.txt.bz2')
        TestFactory.import_sensors(self.test_user, self.test_project, zip_path,
                                   SensorsImporterModel.OPTIONS['MEG Sensors'])

        field = FilterChain.datatype + '.sensors_type'
        filters = FilterChain('', [field], [MEG_POLYMORPHIC_IDENTITY], ['=='])
        sensors_index = TestFactory.get_entity(self.test_project, SensorsIndex,
                                               filters)

        viewer = SensorsViewer()
        viewer.current_project_id = self.test_project.id
        view_model = viewer.get_view_model_class()()
        view_model.sensors = sensors_index.gid

        result = viewer.launch(view_model)
        self.assert_compliant_dictionary(self.EXPECTED_KEYS_MEG, result)