alihaydaroglu / suite3d

Fast, accurate, volumetric cell detection. Developed for Light Beads Microscopy, usable for other volumetric 2P. In development
6 stars 0 forks source link

implement better npil subtraction #50

Open alihaydaroglu opened 1 year ago

alihaydaroglu commented 1 year ago

something like this:

ratio_pct = n.percentile(F, 50,-1)/n.percentile(Fn, 50,-1)

# ratio = (F/Fn).mean(axis=-1)
ratio = ratio_pct
ratio[ratio<0.1] = 0.7
ratio[ratio>5.0] = 0.7

from suite2p.extraction import dcnv
F_sub = F - Fn * ratio[:,n.newaxis]
dcnv_baseline = job.params.get('dcnv_baseline','maximin')
dcnv_win_baseline = job.params.get('dcnv_win_baseline',60)
dcnv_sig_baseline = job.params.get('dcnv_sig_baseline',10)
dcnv_prctile_baseline = job.params.get('dcnv_prctile_baseline',8)
dcnv_batchsize = job.params.get('dcnv_batchsize',3000)
tau = job.params.get('tau',1.3)
F_sub = dcnv.preprocess(F_sub, dcnv_baseline, dcnv_win_baseline,
             dcnv_sig_baseline, job.params['fs'],dcnv_prctile_baseline)
spks_x = dcnv.oasis(F_sub, batch_size = dcnv_batchsize, tau=tau,
                 fs=job.params['fs'])