Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration metrics do not exclude bad frames #1144

Open
samupicard opened this issue Sep 5, 2024 · 1 comment
Open

Registration metrics do not exclude bad frames #1144

samupicard opened this issue Sep 5, 2024 · 1 comment

Comments

@samupicard
Copy link

samupicard commented Sep 5, 2024

As far as I understand, the registration metrics do not exclude any of the 'bad frames' at the moment: the PCA is performed on an equally subsampled set of frames from the registered movie. This leads to really high metrics on sessions where there were artefacts e.g. the signal dropping suddenly (I've attached a screenshot from the GUI as an example). This approach makes sense for the automatically computed bad frames as you would otherwise underestimate potential registration errors, but surely it would be good to at least take into account the user-defined bad_frames.npy array for these metrics?

It seems that this would be relatively easy fix in this part of the main pipeline code...

suite2p/suite2p/run_s2p.py

Lines 148 to 163 in c88e1ba

# compute metrics for registration
if ops.get("do_regmetrics", True) and n_frames >= 1500:
t0 = time.time()
# n frames to pick from full movie
nsamp = min(2000 if n_frames < 5000 or Ly > 700 or Lx > 700 else 5000,
n_frames)
inds = np.linspace(0, n_frames - 1, nsamp).astype("int")
mov = f_reg[inds]
mov = mov[:, ops["yrange"][0]:ops["yrange"][-1],
ops["xrange"][0]:ops["xrange"][-1]]
ops = registration.get_pc_metrics(mov, ops)
plane_times["registration_metrics"] = time.time() - t0
print("Registration metrics, %0.2f sec." %
plane_times["registration_metrics"])
if ops.get("ops_path"):
np.save(ops["ops_path"], ops)

@samupicard
Copy link
Author

reg_metrics_suite2p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant