sollan / alma

Fully automated (rodent) limb motion analysis toolbox for behavioral analysis with bodypart coordinate data, building upon markerless pose estimation.
GNU General Public License v3.0
13 stars 5 forks source link

issue launching alma.py #13

Closed jlb98 closed 3 years ago

jlb98 commented 3 years ago

We are having trouble launching the alma.py file after successfully installing all of the prerequisites. Here is our error code below:

(almaenvironment) C:\Users\ Lab\Documents\ALMA\alma-master>python ./alma.py Traceback (most recent call last): File "./alma.py", line 2, in from Panels import Start, AnalyzeStride, AnalyzeFootfall, RandomForest, PCA File "C:\Users\ Lab\Documents\ALMA\alma-master\Panels\AnalyzeStride.py", line 2, in from Functions import ConfigFunctions, KinematicsFunctions File "C:\Users\ Lab\Documents\ALMA\alma-master\Functions\KinematicsFunctions.py", line 1, in import pandas as pd File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas__init.py", line 50, in from pandas.core.api import ( File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\api.py", line 48, in from pandas.core.groupby import ( File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\groupby\init.py", line 1, in from pandas.core.groupby.generic import ( File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\groupby\generic.py", line 73, in from pandas.core.frame import DataFrame File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\frame.py", line 129, in from pandas.core import ( File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\generic.py", line 141, in from pandas.core.window import ( File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\window\init__.py", line 1, in from pandas.core.window.ewm import ( # noqa:F401 File "C:\Users\ Lab\Documents\ALMA\alma-master\almaenvironment\lib\site-packages\pandas\core\window\ewm.py", line 11, in import pandas._libs.window.aggregations as window_aggregations ImportError: DLL load failed while importing aggregations: The specified module could not be found.

This is the code we run immediately before, to verify the prerequisites are installed:

(almaenvironment) C:\Users\ Lab\Documents\ALMA\alma-master>pip install -r requirements.txt Requirement already satisfied: fastdtw>=0.3.4 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 1)) (0.3.4) Requirement already satisfied: matplotlib>=3.2.1 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 2)) (3.4.2) Requirement already satisfied: numpy>=1.18.2 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 3)) (1.21.1) Requirement already satisfied: opencv-python==4.2.0.34 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 4)) (4.2.0.34) Requirement already satisfied: pandas>=1.0.3 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 5)) (1.3.1) Requirement already satisfied: PyYAML>=5.4 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 6)) (5.4.1) Requirement already satisfied: scikit-learn==0.22.2.post1 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 7)) (0.22.2.post1) Requirement already satisfied: scipy>=1.4.1 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 8)) (1.7.0) Requirement already satisfied: seaborn>=0.10.0 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 9)) (0.11.1) Requirement already satisfied: wxPython==4.1.0 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from -r requirements.txt (line 10)) (4.1.0) Requirement already satisfied: joblib>=0.11 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from scikit-learn==0.22.2.post1->-r requirements.txt (line 7)) (1.0.1) Requirement already satisfied: six in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from wxPython==4.1.0->-r requirements.txt (line 10)) (1.16.0) Requirement already satisfied: pillow in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from wxPython==4.1.0->-r requirements.txt (line 10)) (8.3.1) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from matplotlib>=3.2.1->-r requirements.txt (line 2)) (1.3.1) Requirement already satisfied: python-dateutil>=2.7 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from matplotlib>=3.2.1->-r requirements.txt (line 2)) (2.8.2) Requirement already satisfied: pyparsing>=2.2.1 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from matplotlib>=3.2.1->-r requirements.txt (line 2)) (2.4.7) Requirement already satisfied: cycler>=0.10 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from matplotlib>=3.2.1->-r requirements.txt (line 2)) (0.10.0) Requirement already satisfied: pytz>=2017.3 in c:\users\ lab\documents\alma\alma-master\almaenvironment\lib\site-packages (from pandas>=1.0.3->-r requirements.txt (line 5)) (2021.1)

We have attempted uninstalling and reinstalling pandas, since that is what the error seems to be referring to. The pandas version installed is >=1.0.3.

sollan commented 3 years ago

Hi!

We have installed the same library versions as yours but couldn't replicate the error. Which version of Python are you running?

Maybe this will be helpful as well: https://stackoverflow.com/questions/60767017/importerror-dll-load-failed-while-importing-aggregations-the-specified-module (downgrading pandas is suggested)

jlb98 commented 3 years ago

Hi Annette,

Last night, I started from scratch with the installation and was able to successfully open the GUI. However, I did run into another issue that I was able to solve. Here were my specific steps below:

  1. Opened anaconda prompt and changed directory to folder
  2. Created a virtual environment in the directory with python = 3.8
  3. Activated environment
  4. pip3 insatll -r requirements.txt
  5. Typed python ./alma.py

When I did this, I got a Deprecation error about bools. I no longer have the full error text but it was something along the lines of "DeprecationWarning: "np.bool" is a deprecated alias for the builtin 'bool'. Deprecated in NumPy =1.20. I opened the requirement file and realized that by default it was downloading the most recent version of NumPy (numpy>=1.18.2) into my virtual environment. To solve the issue, I uninstalled NumPy and installed the lowest sufficient version as noted by your requirements. I then was able to open the GUI.

After I was able to open the GUI, I attempted to upload some DLC spreadsheets into the footfall software. I have a few questions about using the software, if you have the time to answer them.

First, I was wondering how necessary it is to re-create the x and y axes lengths that are used in some of the pictures from your paper (i.e., 0 to 1,000 for y). Our videos have different axes. I presume that by changing parameters about peak prominence/height in the code, this should work? Or would you suggest that instead our videos match the x and y you use.?

Second, we use head-fixed mice walking on a wheel with rungs. How modifiable is the code to account for this, since the code was designed for mice moving forward in x space? I was looking at the code and noticed the section for determining new footfalls and noticed how it made use of the x coordinate when deciding if a fall was valid or not. Would the code still work if the mouse is fixed in x space? The paw will still have some small changes in the x coordinate since it is reaching and retracting in a circular-like motion.

Thank you again for your email -- I appreciate your time and the software is very interesting!

Best, James

On Fri, Jul 30, 2021 at 5:25 AM Annette Z @.***> wrote:

Hi! Which version of Python are you running?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sollan/alma/issues/13#issuecomment-889764349, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVAUL7I3DZEKPWNNQZO2XHLT2JVZNANCNFSM5BHE4CZA .

sollan commented 3 years ago

Hi James! Thanks for your elaborate message. We really appreciate your interest!

Quick answers to your questions about your use case:

  1. It shouldn't be necessary to match the x and y ranges. The slip / footfall identification is based on y-axis peaks and the duration / depth calculations are all relative (if the footfall is starts at e.g., 1500 px and goes until 2000 px, the code will work). One problem might be that the footfalls appear shallower / deeper with different axes ranges and the detection results would be impacted. Then you would need to tweak the parameters you mentioned, and it might be helpful to test the footfall detection separately. (We could share with you our development / testing code as jupyter notebooks if needed.)

  2. Yes, it would work, but you need to make some alterations. We use the x space parameters mainly to filter out multiple footfalls that occur at the same rung, in order to reduce false positive results. So you could simply remove the x coordinate related filtering parameters, otherwise most footfalls would be missing from the results.

We'll look into the other issues and get back to you in more detail later. Have a nice weekend!

jlb98 commented 3 years ago

Hi Annette,

Thank you for quickly getting back to me. Our axes for some test videos were in the 1-10 range, so it wasn't picking up footfalls. I am supposing this is because the prominence values are set to pick up from a minimum of 10 or 45 depending on the detection algorithm. Does this sound right? We would appreciate it if you get the chance to share the development/testing code jupyter notebook.

Regarding the second point, when I tried multiplying all of our values by 100, I was getting a single footfall detection despite there being multiple. I think you are right that this has to do with the x space parameters. I was considering removing it, but worried it might mess up the rest of the code. Thank you for the suggestion.

Have a good weekend!

Best, James

On Fri, Jul 30, 2021 at 12:18 PM Annette Z @.***> wrote:

Hi James! Thanks for your elaborate message. We really appreciate your interest!

Quick answers to your questions about your use case:

1.

It shouldn't be necessary to match the x and y ranges. The slip / footfall identification is based on y-axis peaks and the duration / depth calculations are all relative (if the footfall is starts at e.g., 1500 px and goes until 2000 px, the code will work). One problem might be that the footfalls appear shallower / deeper with different axes ranges and the detection results would be impacted. Then you would need to tweak the parameters you mentioned, and it might be helpful to test the footfall detection separately. (We could share with you our development / testing code as jupyter notebooks if needed.) 2.

Yes, it would work, but you need to make some alterations. We use the x space parameters mainly to filter out multiple footfalls that occur at the same rung, in order to reduce false positive results. So you could simply remove the x coordinate related filtering parameters, otherwise most footfalls would be missing from the results.

We'll look into the other issues and get back to you in more detail later. Have a nice weekend!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sollan/alma/issues/13#issuecomment-889999950, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVAUL7JYRAZJTBCD3VZT363T2LGGBANCNFSM5BHE4CZA .

sollan commented 3 years ago

Hello James,

We have a few suggestions regarding the issue you are facing:

  1. We're not quite sure about your axis range being from 1 to 10 - perhaps it would be helpful to share your recording / DLC file (or screenshots thereof) so we can better understand the problem? It is possible that the footfall depth shown on your axis range doesn't work with the preset prominence values.

  2. It could be that you're using a detection method that requires manually setting the parameters in the config.yaml file (mostly for additional preprocessing of the coordinate data, for specific recording scenarios - see our wiki page or the paper for more detailed description of the usage). We would recommend trying the "deviation" method, which does not require additional parameters and worked best for us so far.

Please also find the development code attached.

Best, Annette

Ladder rung - deviation method testing.zip

jlb98 commented 3 years ago

Hi Annette,

We solved the first issue by re-calibrating our axes. Using axes of roughly 0-376 for x and 0-240 for y, the footfall detection software works for all 3 algorithms and both the forelimb and hindlimb. We will experiment with changing the x parameters because we suspect some slips are being missed if they occur close in time.

Also, we solved the earlier import issue by downgrading pandas, as suggested.

Thank you for the help.

Best, James

sollan commented 3 years ago

Hi James! That's good to hear. Feel free to ask if you run into any other issues. Good luck with your analysis!

Best, Annette