for roi_i, roi_row in s2_df.iterrows():

            print('\t s2 receptive fields, {}, {} / {} ...'.format(roi_row['roi_n'], roi_i + 1, len(s2_df)))

            if response_dir == 'pos':
                _, _, _, srf_on, srf_off, _, _, _, _, _, _, _, _, \
                _ = dt.get_everything_from_axon(nwb_f=nwb_f,
                                                clu_f=clu_f,
                                                plane_n=plane_n,
                                                axon_n=roi_row['roi_n'],
                                                params=analysis_params)

                _, rf_on_new = dt.get_rf_properties(srf=srf_on,
                                                    polarity='positive',
                                                    sigma=analysis_params['gaussian_filter_sigma_rf'],
                                                    interpolate_rate=analysis_params['interpolate_rate_rf'],
                                                    z_thr_abs=analysis_params['rf_z_thr_abs'],
                                                    z_thr_rel=analysis_params['rf_z_thr_rel'])

                _, rf_off_new = dt.get_rf_properties(srf=srf_off,
                                                     polarity='positive',
                                                     sigma=analysis_params['gaussian_filter_sigma_rf'],
                                                     interpolate_rate=analysis_params['interpolate_rate_rf'],
                                                     z_thr_abs=analysis_params['rf_z_thr_abs'],
                                                     z_thr_rel=analysis_params['rf_z_thr_rel'])

            elif response_dir == 'neg':
                _, _, _, _, _, srf_on, srf_off, _, _, _, _, _, _, \
                _ = dt.get_everything_from_axon(nwb_f=nwb_f,
                                                clu_f=clu_f,
                                                plane_n=plane_n,
Exemple #2
0
            curr_strf = dt.get_strf(nwb_f=nwb_f,
                                    plane_n=roi_row['plane_n'],
                                    roi_ind=int(roi_row['roi_n'][-4:]),
                                    trace_type='sta_'+sheet_name)
            curr_strf_dff = curr_strf.get_local_dff_strf(is_collaps_before_normalize=True,
                                                         add_to_trace=add_to_trace)
            curr_srf, _ = curr_strf_dff.get_zscore_receptive_field(timeWindow=response_window)
            if response_dir == 'pos':
                polarity = 'positive'
            elif response_dir == 'neg':
                polarity = 'negative'
            else:
                raise ValueError('polarity ({}) should be either "pos" or "neg".')
            _, _, _, rf_mask = dt.get_rf_properties(srf=curr_srf,
                                                     polarity=polarity,
                                                     sigma=gaussian_filter_sigma,
                                                     interpolate_rate=interpolate_rate,
                                                     z_thr=rf_peak_z_thr)
            roi_grp = local_grp.create_group(name=roi_row['roi_n'])
            ia.WeightedROI(mask=rf_mask).to_h5_group(roi_grp)
            if 'alts_deg' not in local_grp.attrs:
                local_grp.attrs['alts_deg'] = curr_srf.altPos
            if 'azis_deg' not in local_grp.attrs:
                local_grp.attrs['alts_deg'] = curr_srf.aziPos
        else:
            print('\t\t\tAlready exists. Skip.')


    # ====================================OFF========================================================
    localdfoff = localdf[localdf['rf_{}_off_peak_z'.format(response_dir)] >= rf_peak_z_thr].reset_index()
    print('\n\tnumber of rois with significant OFF RFs: {}'.format(len(localdfoff)))