Esempio n. 1
0
    def test_create_stimulus_region(self):
        weight_array = numpy.zeros(self.connectivity.number_of_regions)
        region_stimulus_creator = RegionStimulusCreator()

        view_model = region_stimulus_creator.get_view_model_class()()
        view_model.connectivity = UUID(self.connectivity.gid)
        view_model.weight = weight_array
        view_model.temporal = TemporalApplicableEquation()
        view_model.temporal.parameters['a'] = 1.0
        view_model.temporal.parameters['b'] = 2.0

        region_stimulus_index = region_stimulus_creator.launch(view_model)

        assert region_stimulus_index.temporal_equation == 'TemporalApplicableEquation'
        assert json.loads(region_stimulus_index.temporal_parameters) == {'a': 1.0, 'b': 2.0}
        assert region_stimulus_index.connectivity_gid == self.connectivity.gid
Esempio n. 2
0
    def test_create_stimulus_region(self, operation_factory):
        weight_array = numpy.zeros(self.connectivity.number_of_regions)
        region_stimulus_creator = RegionStimulusCreator()

        view_model = region_stimulus_creator.get_view_model_class()()
        view_model.connectivity = self.connectivity.gid
        view_model.weight = weight_array
        view_model.temporal.parameters['T'] = 45.0
        view_model.temporal.parameters['amp'] = 2.0

        operation = operation_factory(test_user=self.test_user, test_project=self.test_project)
        region_stimulus_creator.extract_operation_data(operation)
        region_stimulus_index = region_stimulus_creator.launch(view_model)

        assert region_stimulus_index.temporal_equation == 'PulseTrain'
        assert json.loads(region_stimulus_index.temporal_parameters) == \
               {'T': 45.0, 'amp': 2.0, 'onset': PulseTrain.parameters.default()['onset'],
                'tau': PulseTrain.parameters.default()['tau']}
        assert region_stimulus_index.fk_connectivity_gid == self.connectivity.gid
Esempio n. 3
0
    def test_create_stimulus_region(self, operation_factory):
        weight_array = numpy.zeros(self.connectivity.number_of_regions)
        region_stimulus_creator = RegionStimulusCreator()

        view_model = region_stimulus_creator.get_view_model_class()()
        view_model.connectivity = self.connectivity.gid
        view_model.weight = weight_array
        view_model.temporal = TemporalApplicableEquation()
        view_model.temporal.parameters['a'] = 1.0
        view_model.temporal.parameters['b'] = 2.0

        operation = operation_factory(test_user=self.test_user,
                                      test_project=self.test_project)
        region_stimulus_creator.extract_operation_data(operation)
        region_stimulus_index = region_stimulus_creator.launch(view_model)

        assert region_stimulus_index.temporal_equation == 'TemporalApplicableEquation'
        assert json.loads(region_stimulus_index.temporal_parameters) == {
            'a': 1.0,
            'b': 2.0
        }
        assert region_stimulus_index.fk_connectivity_gid == self.connectivity.gid