AllenInstitute / AllenSDK

code for reading and processing Allen Institute for Brain Science data
https://allensdk.readthedocs.io/en/latest/
Other
333 stars 149 forks source link

Error-when using session.stimulus_presentations #2637

Closed mohamadamin-fjz closed 1 year ago

mohamadamin-fjz commented 1 year ago

Hi everybody I m using Allen SDK to access brain observatory data. I try to load the stimulus presentation data frame with asession.stimulus_presentations command but I get error:values should be boolean NumPy array. Use the ‘pd.array’ function instead I will happy if anyone helps me to resolve the issue

aamster commented 1 year ago

@mohamadamin-fjz please provide a stack trace. Thanks.

mohamadamin-fjz commented 1 year ago

i use these codes and google colab !pip install allensdk

import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache

output_dir = '/local1/ecephys_cache_dir/'

manifest_path = os.path.join(output_dir, "manifest.json")

cache = EcephysProjectCache.from_warehouse(manifest=manifest_path)

print(cache.get_all_session_types())

sessions=cache.get_session_table() brain_obs_session=sessions[sessions['session_type']=='brain_observatory_1.1'] session_id=715093703 session=cache.get_session_data(715093703)

session.stimulus_presentations ###this line of code cause bellow error ERROR: values should be boolean numpy array. Use the 'pd.array' function instead

@aamster

mohamadamin-fjz commented 1 year ago

I think that it is because of the latest updates of allensdk , I was using 2.14.1 version but this problem resolved when I use 2.13.6 version. @aamster

mohamadamin-fjz commented 1 year ago

Should I report it as a bug or I am missing the point? @aamster

aamster commented 1 year ago

Please try updating pandas version by using

pip install pandas --upgrade
mohamadamin-fjz commented 1 year ago

thanks it works:)

slcalgin commented 1 year ago

@aamster Hi, I'm having the same error when calling get_stimulus_table() on a brain observatory session. Pandas version is 1.3.5 and upgrading it doesn't seem to resolve the issue ("Requirement already satisfied"). allensdk version is 2.15.1. Any ideas of what the issue might be? Thanks!

aamster commented 1 year ago

pandas 1.3.5 is not the latest. Try starting from a fresh environment. Sorry, I'm not able to help further.

slcalgin commented 1 year ago

@aamster Thanks. I've reinstalled multiple times. One question: which python version do you recommend installing with? It is not stated in the installation guide: https://allensdk.readthedocs.io/en/latest/install.html. I have been using python=3.7 based on this file https://github.com/AllenInstitute/AllenSDK/blob/master/.readthedocs.yml, but do you recommend another version? Thanks.

aamster commented 1 year ago

3.7 - 3.9 are supported in the 2.15.1 release on pypi https://pypi.org/project/allensdk/ if you look on the left side of the page

slcalgin commented 1 year ago

@aamster Okay perfect. With python 3.8, I've resolved the error, and the pandas version is 1.5.3. I couldn't seem to upgrade pandas past 1.3.5 with python=3.7. Thank you for your help!