csudre / NMJ_Analyser

Performs analysis of NMJ data
Apache License 2.0
0 stars 1 forks source link

ValueError: unknown distance metric with Mouse_test_Sample #3

Closed anamoralesb closed 7 months ago

anamoralesb commented 10 months ago

I tried processing the mouse samples provided and get this error: X Resolution: "0.277" Z Resolution: "1.5" ID: "sample" threshold: "64" Path to images: "/Users/anamoralesbenitez/Desktop/Image_sample" Path to saved output: "/Users/anamoralesbenitez/Desktop" 17 17 creating threshsize cc create connective support Taking care of 1 out of 41 [0.277, 0.277, 1.5] creating threshsize cc create connective support 1474.1875 714.921875 491.1208953857422 Exception in Tkinter callback Traceback (most recent call last): File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/tkinter/init.py", line 1948, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/nmj_analyzer.py", line 99, in command=(lambda e=ents: fetch_and_process(e))) ^^^^^^^^^^^^^^^^^^^^ File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/nmj_analyzer.py", line 14, in fetch_and_process process_subject(dict_arg['path_images'], dict_arg['path_save'] , dict_arg['name'], thresh=thresh, pixdim=pixdim) File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 209, in process_subject = study_subject(label_filled,img_red,img_green,subject_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 122, in study_subject = study_component(l, label, red, green,pixdim) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 71, in study_component results_red.fill_value() File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/utils/pairwise_measures.py", line 580, in fill_value result = self.m_dict[key][0]() ^^^^^^^^^^^^^^^^^^^^^ File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/nmj_analyzer/utils/pairwise_measures.py", line 493, in dist_cc dist_array.append(np.mean(dist.cdist(indices_l, ^^^^^^^^^^^^^^^^^^^^^ File "/Users/anamoralesbenitez/anaconda3/lib/python3.11/site-packages/scipy/spatial/distance.py", line 3016, in cdist raise ValueError('Unknown Distance Metric: %s' % mstr) ValueError: Unknown Distance Metric: wminkowski

alanmejiamaza commented 10 months ago

Hi, This is unusual. Can you confirm you have installed all dependencies? if did so, tell me the scikit-learn version and system used (mac, windows,etc) Alan

JA-Rodier commented 8 months ago

Hi Ana and Alan,

I have the same issue here. Have you resolved the problem?

X Resolution: "0.277" Z Resolution: "1.5" ID: "run1" threshold: "64" Path to images: "/Users/me/Downloads/NMJ_Analyser-master/MouseTest_sample/Image_sample" Path to saved output: "/Users/me/Downloads/NMJ_Analyser-master/MouseTest_sample/Image_sample" 17 17 creating threshsize cc create connective support Taking care of 1 out of 41 [0.277, 0.277, 1.5] creating threshsize cc create connective support 1474.1875 714.921875 491.1208953857422 Exception in Tkinter callback Traceback (most recent call last): File "/Users/me/anaconda3/lib/python3.11/tkinter/init.py", line 1948, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/nmj_analyzer.py", line 99, in command=(lambda e=ents: fetch_and_process(e))) ^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/nmj_analyzer.py", line 14, in fetch_and_process process_subject(dict_arg['path_images'], dict_arg['path_save'] , dict_arg['name'], thresh=thresh, pixdim=pixdim) File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 207, in process_subject = study_subject(label_filled,img_red,img_green,subject_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 120, in study_subject = study_component(l, label, red, green,pixdim) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 70, in study_component results_red.fill_value() File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/utils/pairwise_measures.py", line 580, in fill_value result = self.m_dict[key][0]() ^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/utils/pairwise_measures.py", line 493, in dist_cc dist_array.append(np.mean(dist.cdist(indices_l, ^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/scipy/spatial/distance.py", line 3016, in cdist raise ValueError('Unknown Distance Metric: %s' % mstr) ValueError: Unknown Distance Metric: wminkowski

I work on a mac M3 chip OS Sonoma 14.2.1

anamoralesb commented 7 months ago

I was not able to solve the issue. I installed all dependencies and meet system requirements

alanmejiamaza commented 7 months ago

Hi Ana and Alan,

I have the same issue here. Have you resolved the problem?

X Resolution: "0.277" Z Resolution: "1.5" ID: "run1" threshold: "64" Path to images: "/Users/me/Downloads/NMJ_Analyser-master/MouseTest_sample/Image_sample" Path to saved output: "/Users/me/Downloads/NMJ_Analyser-master/MouseTest_sample/Image_sample" 17 17 creating threshsize cc create connective support Taking care of 1 out of 41 [0.277, 0.277, 1.5] creating threshsize cc create connective support 1474.1875 714.921875 491.1208953857422 Exception in Tkinter callback Traceback (most recent call last): File "/Users/me/anaconda3/lib/python3.11/tkinter/init.py", line 1948, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/nmj_analyzer.py", line 99, in command=(lambda e=ents: fetch_and_process(e))) ^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/nmj_analyzer.py", line 14, in fetch_and_process process_subject(dict_arg['path_images'], dict_arg['path_save'] , dict_arg['name'], thresh=thresh, pixdim=pixdim) File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 207, in process_subject = study_subject(label_filled,img_red,img_green,subject_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 120, in study_subject = study_component(l, label, red, green,pixdim) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/Processing.py", line 70, in study_component results_red.fill_value() File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/utils/pairwise_measures.py", line 580, in fill_value result = self.m_dict[key]0 ^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/nmj_analyzer/utils/pairwise_measures.py", line 493, in dist_cc dist_array.append(np.mean(dist.cdist(indices_l, ^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/anaconda3/lib/python3.11/site-packages/scipy/spatial/distance.py", line 3016, in cdist raise ValueError('Unknown Distance Metric: %s' % mstr) ValueError: Unknown Distance Metric: wminkowski

  • I have all the dependencies. I have scikit-learn 1.2.2 Requirement already satisfied: scikit-learn in ./anaconda3/lib/python3.11/site-packages (1.2.2)

I work on a mac M3 chip OS Sonoma 14.2.1

Can you try on a different MacOSX version (downgrade). I can run a small tutorial in a week or so.

alanmejiamaza commented 7 months ago

aise ValueError('Unknown Distance Metric: %s' % mstr)

The issue here as for @ JA-Rodier is the spicy version used. Please, try to use an older version, and stick to the version I said in the manual. I can run a small tutorial in a week or so.

alanmejiamaza commented 7 months ago

Please email here for a tutorial.

amejiamaza@mgh.harvard.edu

Thanks

anamoralesb commented 7 months ago

Thank you so much. I actually got it to work by using the correct scipy version