cci-MaLab / Calcium-Transient-Analysis

GNU General Public License v3.0
0 stars 0 forks source link

Make Calculation of Missed Cell Signal more efficient. #4

Closed GrowlingM1ke closed 7 months ago

GrowlingM1ke commented 7 months ago

Currently on a good machine. For a missed cell the calculation of the trace takes around 30 seconds. I've made it so that if the calculation was already done it won't be repeated. However, there is a way to make this approach significantly faster but it would require some refactoring:

  1. Create a copy of the cleaned video xarray but rechunk it to keep the frames intact but the height and width should be segmented into pieces.
  2. Then we can use the mask to select the correct range of indices for height and width and we can therefore avoid loading in 90% of the video for no reason.
cci-MaLab commented 7 months ago

Sounds great!!! Thank you for this update..- ym

From: Michal A Lange @.> Sent: Thursday, February 29, 2024 1:47 PM To: cci-MaLab/Cell_Clustering_Tool @.> Cc: Subscribed @.***> Subject: [External] [cci-MaLab/Cell_Clustering_Tool] Make Calculation of Missed Cell Signal more efficient. (Issue #4)

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

Currently on a good machine. For a missed cell the calculation of the trace takes around 5-7 seconds. I've made it so that if the calculation was already done it won't be repeated. However, there is a way to make this approach significantly faster but it would require some refactoring:

  1. Create a copy of the cleaned video xarray but rechunk it to keep the frames intact but the height and width should be segmented into pieces.
  2. Then we can use the mask to select the correct range of indices for height and width and we can therefore avoid loading in 90% of the video for no reason.

— Reply to this email directly, view it on GitHubhttps://github.com/cci-MaLab/Cell_Clustering_Tool/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3VZG6LYE5QQCKZ76PFITJ3YV53SVAVCNFSM6AAAAABEAO4YFKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3DCOBYGY4TKNY. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

GrowlingM1ke commented 7 months ago

Fixed as of this commit: https://github.com/cci-MaLab/Cell_Clustering_Tool/commit/c8ff1b3a5490c1963ccd79eac4eff0f7b16488bb

Minian actually does save a rechunked version of the processed file called Y_hw_chk, which I replaced for Y_fm_chk. By indexing the sections associated with the mask values the Raw Signal gets extracted in less than a second as opposed to 30s to a minute as it was before.