def produce_restingVm(self, roi, **kwargs): """ roi, region of interest is a string, i.e, 1 key in chosenmodel.regions kwargs = { "parameters": dictionary with keys, "stimparameters": dictionary with keys "type" and "stimlist", "onmodel": instantiated model } """ print("Sim produce_" + roi + "_restingVm starting ...") ec = ExecutiveControl() # only works when in ~/cerebmodels model = ec.launch_model(parameters=kwargs["parameters"], stimparameters=kwargs["stimparameters"], stimloc=kwargs["stimloc"], onmodel=kwargs["onmodel"], capabilities={ "model": "produce_voltage_response", "vtest": ProducesElectricalResponse }, mode="capability") nwbfile = rm.load_nwbfile(model.fullfilename) orderedepochs = rm.order_all_epochs_for_region(nwbfile=nwbfile, region=roi) timestamps_over_epochs = [ rm.timestamps_for_epoch(orderedepochs[i]) for i in range(len(orderedepochs)) ] data_over_epochs = [ rm.data_for_epoch(orderedepochs[i]) for i in range(len(orderedepochs)) ] baseVms = spm.distill_baseVm_pre_epoch( timestamps=timestamps_over_epochs, datavalues=data_over_epochs) setattr(model, "prediction", baseVms) print("Simulation produce_" + roi + "_restingVm Done.") return model
def produce_soma_spikeheight(self, **kwargs): """ kwargs = { "parameters": dictionary with keys, "stimparameters": dictionary with keys "type" and "stimlist", "onmodel": instantiated model } """ print("Sim produce_soma_spikeheight starting ...") ec = ExecutiveControl() # only works when in ~/cerebmodels model = ec.launch_model(parameters=kwargs["parameters"], stimparameters=kwargs["stimparameters"], stimloc=kwargs["stimloc"], onmodel=kwargs["onmodel"], capabilities={ "model": "produce_voltage_response", "vtest": ProducesElectricalResponse }, mode="capability") #self.fullfilename # already saved by invoking produce_voltage_response above #print("Signal Processing ...") nwbfile = rm.load_nwbfile(model.fullfilename) orderedepochs = rm.order_all_epochs_for_region(nwbfile=nwbfile, region="soma v") timestamps_over_epochs = [ rm.timestamps_for_epoch(orderedepochs[i]) for i in range(len(orderedepochs)) ] data_over_epochs = [ rm.data_for_epoch(orderedepochs[i]) for i in range(len(orderedepochs)) ] baseVm = spm.distill_baseVm_pre_epoch( timestamps=timestamps_over_epochs, datavalues=data_over_epochs) try: peakVms = spm.distill_peakVm_from_spikes( timestamps=timestamps_over_epochs, datavalues=data_over_epochs) except: peakVms = baseVm #print("Signal Processing Done.") setattr(model, "prediction", peakVms[0] - baseVm[0]) print("Simulation produce_soma_spikeheight Done.") return model