nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
58 stars 15 forks source link

Explanation for warning message #263

Closed zhouyi0812 closed 6 months ago

zhouyi0812 commented 7 months ago

Hello! I wonder could you please guide me about why this warning occur and what is the parameters related to? Because when I run my other movies they are fine, but with this warning the kernel died. Thank you!

WARNING:root:NaN values detected for space correlation in [ 48 159 310 609 658 733 1392 1724 2014 2065 3772 3802 3946 4171 4807 5118 5233 5480 5599 5703 6389 7343 7544 7687 8135 8253 8503 8805 8885 9693 9694]. Changing their value to -1.

kushalkolar commented 7 months ago

I don't think that would cause the kernel to die, it's probably either the movie or the params. Is this movie larger than other ones that work? @EricThomson any thoughts?

zhouyi0812 commented 7 months ago

No, actually this movie is smaller because I cropped it. the parameter I used for cnmfe is

Running a3fbb361-152f-4a49-8cfe-c74097abb730 with local backend cnmfe params: {'main': {'method_init': 'corr_pnr', 'K': None, 'gSig': (7, 7), 'gSiz': (29, 29), 'merge_thr': 0.7, 'p': 1, 'tsub': 1, 'ssub': 1, 'rf': 40, 'stride': 20, 'only_init': True, 'nb': 0, 'nb_patch': 0, 'method_deconvolution': 'oasis', 'low_rank_background': None, 'update_background_components': True, 'normalize_init': False, 'center_psf': True, 'ssub_B': 1, 'ring_size_factor': 1.4, 'del_duplicates': True, 'bas_nonneg': True, 'min_corr': 0.7994245886802673, 'min_pnr': 7.22298526763916}} making memmap Performing CNMFE evaluating components GPU run not requested, disabling use of GPUs USING MODEL (keras API): C:\Users\yyizhou\caiman_data\model\cnn_model.json 162/162 [==============================] - 9s 55ms/step WARNING:root:NaN values detected for space correlation in [ 546 925 1271 1477 1792 1907 2065 2651 3978 4752 4896]. Changing their value to -1.

kushalkolar commented 7 months ago

From here and the previous message it looks like you're picking up 5,000-10,000+ components which is probably way too many unless you're doing some sort of fancy mesoscope imaging, are you sure the min_corr and min_pnr are high enough? Given the number of components and the kernel dieing, my guess is you're running out of RAM.

zhouyi0812 commented 7 months ago

I checked the ram when visualizing, it only took 19% of the computer's memory. And I set min_corr: 0.7994245886802673 min_pnr: 7.22298526763916 And also I have a question, I choose not to downsample my data so each time there are many candidate components were identified and weighted less accepted. If all of my movie have 5000+ components identified, it is means that they probably will cause kernel die too? Thank you!

EricThomson commented 7 months ago

Corr coeff will give an nan if a variable's values are all the same (so the variance is zero) -- that is my guess as to what is happening here. I have seen that happen a few times but with this many components I'm not surprised.

Once again so. many. components. 😄 Something smells off.

zhouyi0812 commented 7 months ago

I wonder in addition to adjust the threshold for pnr and corr, what else I can do to decrease the number of candidate components? As I think it is already reasonable? Thank you!

kushalkolar commented 6 months ago

You need to perform component evaluation, I think you've gotten the hang of this now though?