コード例 #1
0
    def test_create_stimulus_surface_with_operation(self):
        surface_stimulus_creator = SurfaceStimulusCreator()

        view_model = surface_stimulus_creator.get_view_model_class()()
        view_model.surface = self.surface.gid
        view_model.focal_points_triangles = numpy.array([1, 2, 3])
        view_model.spatial = SpatialEquationsEnum.SIGMOID.instance
        view_model.spatial.parameters['radius'] = 5.5
        view_model.spatial.parameters['offset'] = 0.1
        view_model.spatial_amp = 1.0
        view_model.spatial_sigma = 1.0
        view_model.spatial_offset = 0.0
        view_model.temporal = TemporalEquationsEnum.ALPHA.instance
        view_model.temporal.parameters['alpha'] = 15.0
        view_model.temporal.parameters['beta'] = 40.0

        OperationService().fire_operation(surface_stimulus_creator, self.test_user, self.test_project.id,
                                          view_model=view_model)
        surface_stimulus_index = TestFactory.get_entity(self.test_project, StimuliSurfaceIndex)

        assert surface_stimulus_index.spatial_equation == 'Sigmoid'
        assert surface_stimulus_index.temporal_equation == 'Alpha'
        assert surface_stimulus_index.fk_surface_gid == self.surface.gid

        spatial_eq_params = json.loads(surface_stimulus_index.spatial_parameters)
        assert spatial_eq_params['radius'] == 5.5
        assert spatial_eq_params['offset'] == 0.1

        temporal_eq_params = json.loads(surface_stimulus_index.temporal_parameters)
        assert temporal_eq_params['alpha'] == 15.0
        assert temporal_eq_params['beta'] == 40.0
コード例 #2
0
    def test_create_stimulus_surface(self, operation_factory):
        surface_stimulus_creator = SurfaceStimulusCreator()

        view_model = surface_stimulus_creator.get_view_model_class()()
        view_model.surface = self.surface.gid
        view_model.focal_points_triangles = numpy.array([1, 2, 3])
        view_model.spatial = SpatialEquationsEnum.MEXICAN_HAT.instance
        view_model.spatial.parameters['amp_1'] = 0.75
        view_model.spatial.parameters['amp_2'] = 1.25
        view_model.spatial_amp = 1.0
        view_model.spatial_sigma = 1.0
        view_model.spatial_offset = 0.0
        view_model.temporal = TemporalEquationsEnum.SINUSOID.instance
        view_model.temporal.parameters['amp'] = 1.1
        view_model.temporal.parameters['frequency'] = 0.025

        operation = operation_factory(test_user=self.test_user, test_project=self.test_project)
        surface_stimulus_creator.extract_operation_data(operation)
        surface_stimulus_index = surface_stimulus_creator.launch(view_model)

        assert surface_stimulus_index.spatial_equation == 'DoubleGaussian'
        assert surface_stimulus_index.temporal_equation == 'Sinusoid'
        assert surface_stimulus_index.fk_surface_gid == self.surface.gid

        spatial_eq_params = json.loads(surface_stimulus_index.spatial_parameters)
        assert spatial_eq_params['amp_1'] == 0.75
        assert spatial_eq_params['amp_2'] == 1.25

        temporal_eq_params = json.loads(surface_stimulus_index.temporal_parameters)
        assert temporal_eq_params['amp'] == 1.1
        assert temporal_eq_params['frequency'] == 0.025
コード例 #3
0
    def test_create_stimulus_surface(self):
        surface_stimulus_creator = SurfaceStimulusCreator()

        view_model = surface_stimulus_creator.get_view_model_class()()
        view_model.surface = UUID(self.surface.gid)
        view_model.focal_points_triangles = numpy.array([1, 2, 3])
        view_model.spatial = FiniteSupportEquation()
        view_model.spatial_amp = 1.0
        view_model.spatial_sigma = 1.0
        view_model.spatial_offset = 0.0
        view_model.temporal = TemporalApplicableEquation()
        view_model.temporal.parameters['a'] = 1.0
        view_model.temporal.parameters['b'] = 0.0

        surface_stimulus_index = surface_stimulus_creator.launch(view_model)

        assert surface_stimulus_index.spatial_equation == 'FiniteSupportEquation'
        assert surface_stimulus_index.temporal_equation == 'TemporalApplicableEquation'
        assert surface_stimulus_index.surface_gid == self.surface.gid
コード例 #4
0
    def test_create_stimulus_surface_with_operation(self):
        surface_stimulus_creator = SurfaceStimulusCreator()

        view_model = surface_stimulus_creator.get_view_model_class()()
        view_model.surface = UUID(self.surface.gid)
        view_model.focal_points_triangles = numpy.array([1, 2, 3])
        view_model.spatial = FiniteSupportEquation()
        view_model.spatial_amp = 1.0
        view_model.spatial_sigma = 1.0
        view_model.spatial_offset = 0.0
        view_model.temporal = TemporalApplicableEquation()
        view_model.temporal.parameters['a'] = 1.0
        view_model.temporal.parameters['b'] = 0.0

        FlowService().fire_operation(surface_stimulus_creator, self.test_user, self.test_project.id,
                                     view_model=view_model)
        surface_stimulus_index = TestFactory.get_entity(self.test_project, StimuliSurfaceIndex)

        assert surface_stimulus_index.spatial_equation == 'FiniteSupportEquation'
        assert surface_stimulus_index.temporal_equation == 'TemporalApplicableEquation'
        assert surface_stimulus_index.surface_gid == self.surface.gid
コード例 #5
0
    def test_create_stimulus_surface(self, operation_factory):
        surface_stimulus_creator = SurfaceStimulusCreator()

        view_model = surface_stimulus_creator.get_view_model_class()()
        view_model.surface = self.surface.gid
        view_model.focal_points_triangles = numpy.array([1, 2, 3])
        view_model.spatial = FiniteSupportEquation()
        view_model.spatial_amp = 1.0
        view_model.spatial_sigma = 1.0
        view_model.spatial_offset = 0.0
        view_model.temporal = TemporalApplicableEquation()
        view_model.temporal.parameters['a'] = 1.0
        view_model.temporal.parameters['b'] = 0.0

        operation = operation_factory(test_user=self.test_user,
                                      test_project=self.test_project)
        surface_stimulus_creator.extract_operation_data(operation)
        surface_stimulus_index = surface_stimulus_creator.launch(view_model)

        assert surface_stimulus_index.spatial_equation == 'FiniteSupportEquation'
        assert surface_stimulus_index.temporal_equation == 'TemporalApplicableEquation'
        assert surface_stimulus_index.fk_surface_gid == self.surface.gid