def open_fan_plot(self, cell_specimen_id=None, include_labels=False, cell_index=None): cell_index = self.row_from_cell_id(cell_specimen_id, cell_index) df = self.mean_sweep_response[str(cell_index)] st = self.data_set.get_stimulus_table('static_gratings') mask = st.dropna(subset=['orientation']).index data = df.values cmin = self.response[0, 0, 0, cell_index, 0] cmax = data.mean() + data.std() * 3 fp = cplots.FanPlotter.for_static_gratings() fp.plot(r_data=st.spatial_frequency.ix[mask].values, angle_data=st.orientation.ix[mask].values, group_data=st.phase.ix[mask].values, data=df.ix[mask].values, clim=[cmin, cmax]) fp.show_axes(closed=False) if include_labels: fp.show_r_labels() fp.show_angle_labels()
def open_star_plot(self, cell_specimen_id=None, include_labels=False, cell_index=None): cell_index = self.row_from_cell_id(cell_specimen_id, cell_index) df = self.mean_sweep_response[str(cell_index)] st = self.data_set.get_stimulus_table('drifting_gratings') mask = st.dropna(subset=['orientation']).index data = df.values cmin = self.response[0,0,cell_index,0] cmax = max(cmin, data.mean() + data.std()*3) fp = cplots.FanPlotter.for_drifting_gratings() fp.plot(r_data=st.temporal_frequency.ix[mask].values, angle_data=st.orientation.ix[mask].values, data=df.ix[mask].values, clim=[cmin, cmax]) fp.show_axes(closed=True) if include_labels: fp.show_r_labels() fp.show_angle_labels()
lambda el: el[0] if el[1:] == el[:-1] else None) df.set_index('network', inplace=True) stats = pd.concat([stats, df]) stats = stats.applymap(np.array) #stats[stats.isnull()] = np.NaN stats.sort_index(inplace=True) try: stats['hidden_neurons_total'] = stats.pop( 'hidden_neurons').to_frame().applymap(np.sum) stats['l2_norm_weighted'] = stats.pop('l2_norm') / stats.pop( 'hidden_neurons_total') stats['l2'] = stats.pop('l2_norm_weighted') except KeyError: pass stats.dropna(axis='columns', how='all', inplace=True) #'no_pop_frac', 'no_thresh_frac', 'pop_abs_mis_95width', # 'pop_abs_mis_median', 'rms_test', 'thresh_rel_mis_95width', # 'thresh_rel_mis_median', 'l2_norm_weighted' #print(stats.max()) #print(stats.min()) #print(stats.mean()) #print(stats.abs().mean()) del stats['pop_abs_mis_95width'] del stats['thresh_rel_mis_95width'] stats['rms'] = stats.pop('rms') stats['thresh'] = stats.pop('thresh_rel_mis_median').abs().apply(np.max) stats['no_thresh_frac'] = stats.pop('no_thresh_frac').apply(np.max) stats['pop'] = (14 - stats.pop('pop_abs_mis_median').abs()).apply(np.max) if 'wobble_tot' in stats.keys(): stats['wobble_tot'] = stats.pop('wobble_tot').apply(np.max)