def expt_tau(specimen_id): #print(chr(27) + "[2J") # To clear terminal screen #print "START EXPT_TAU" + str(specimen_id) expt_taus = [] data_set = expt_data_set(specimen_id) long_square_sweeps = lims_utils.get_sweeps_of_type("C1LSCOARSE", specimen_id, passed_only=True) #print "expt specimen id= " + str(specimen_id) for sweep in long_square_sweeps: print str(specimen_id) + " expt_sweep_number: " + str(sweep) if (data_set.get_sweep_metadata(sweep)["aibs_stimulus_amplitude_pa"] < 0): v, i, t = lims_utils.get_sweep_v_i_t_from_set(data_set, sweep) sweep_feat = EphysSweepFeatureExtractor( t, v) # Get time and voltage of each hyperpolarizing sweep try: sweep_feat.estimate_time_constant( ) # Try statement included because estimate_time_constant errors on some sweeps ("could not find interval for time constant estimate") except: continue else: expt_taus.append(sweep_feat.estimate_time_constant( )) # Append time constant of each sweep to list mean_expt_tau = np.nanmean(expt_taus) # Mean time constant for this cell #print "mean_expt_tau= " + str(mean_expt_tau) return mean_expt_tau
def ve_tau(specimen_id, ve_path): #print(chr(27) + "[2J") # To clear terminal screen print "START VE_TAU " + str(specimen_id) + " " + str(ve_path) expt_taus = [] data_set = NwbDataSet(ve_path) long_square_sweeps = lims_utils.get_sweeps_of_type("C1LSCOARSE", specimen_id, passed_only=True) print "ve specimen id= " + str(specimen_id) for sweep in long_square_sweeps: #print "ve_sweep_number: " + str(sweep) #print(data_set.get_sweep_metadata(sweep)) try: (data_set.get_sweep_metadata(sweep)["aibs_stimulus_amplitude_pa"]) except: continue else: if (data_set.get_sweep_metadata(sweep) ["aibs_stimulus_amplitude_pa"] < 0): v, i, t = lims_utils.get_sweep_v_i_t_from_set(data_set, sweep) sweep_feat = EphysSweepFeatureExtractor( t, v) # Get time and voltage of each hyperpolarizing sweep if np.isnan(sweep_feat): continue else: expt_taus.append(sweep_feat.estimate_time_constant( )) # Append time constant of each sweep to list mean_expt_tau = np.nanmean(expt_taus) # Mean time constant for this cell print "mean_ve_tau= " + str(mean_expt_tau) return mean_expt_tau