class SurfaceStimulusCreatorModel(ViewModel, StimuliSurface): spatial = Attr(field_type=FiniteSupportEquation, label="Spatial Equation", default=Sigmoid()) temporal = Attr(field_type=TemporalApplicableEquation, label="Temporal Equation", default=PulseTrain()) surface = DataTypeGidAttr(linked_datatype=CorticalSurface, label=StimuliSurface.surface.label)
class RegionStimulusCreatorModel(ViewModel, StimuliRegion): temporal = Attr(field_type=TemporalApplicableEquation, label="Temporal Equation", default=PulseTrain()) connectivity = DataTypeGidAttr(field_type=uuid.UUID, linked_datatype=Connectivity, label="Connectivity") display_name = Str(label='Display name', required=False)
def create_stimulus(self, connectivity): """ :param connectivity: Connectivity to create stimuli for its regions :return: persisted region Stimuli instance """ operation, _, storage_path = self.__create_operation() stimuli_region = StimuliRegion(storage_path=storage_path) stimuli_region.connectivity = connectivity stimuli_region.weight = numpy.random.random((connectivity.number_of_regions, 1)).tolist() stimuli_region.temporal = PulseTrain() adapter_instance = StoreAdapter([stimuli_region]) OperationService().initiate_prelaunch(operation, adapter_instance, {}) return stimuli_region