mne-tools / mne-nirs

Process Near-Infrared Spectroscopy Data in MNE
https://mne.tools/mne-nirs/
BSD 3-Clause "New" or "Revised" License
79 stars 35 forks source link

'Annotations' object has no attribute 'rename' #333

Closed laoqingshuqiang closed 3 years ago

laoqingshuqiang commented 3 years ago

READ THIS FIRST: If you are having trouble getting MNE-Python to work with your own data, you should ask for help on one of our other channels:

Our GitHub issue tracker is only used to report bugs and suggest improvements to MNE-Python. For any other questions, please use the email list or Gitter. Usage questions that are posted as GitHub issues are usually closed without being answered. See the FAQ entry on filing bug reports for more guidance. If you're pretty sure your problem is a bug in MNE-Python, please delete this section and fill in the headings below, replacing the placeholder text with your own responses. Surround any code samples with triple backticks above and below the code block (see the GitHub guide to markdown for help with issue formatting). Alternatively, you can put your MWE in a public gist and link to it in this issue.

Describe the bug

Replace this text with a description of the bug.

Steps to reproduce

Replace this text with a code snippet or minimal working example MWE to replicate your problem, using one of the built-in datasets, preferably the one called sample. If you can't replicate on a built-in dataset, provide also a link to a small, anonymized portion of your data that does yield the error.

Expected results

Replace this text with a description of what you expected to happen.

Actual results

Replace this text with the actual output, traceback, screenshot, or other description of the results.

Additional information

Replace this text with the output of mne.sys_info().

rob-luke commented 3 years ago

Hi @laoqingshuqiang, this may be due to not using the latest development version of MNE. Could you please report mne.sys_info() as requested in the text above. And generally please try and fill in the report above.

laoqingshuqiang commented 3 years ago

嗨@laoqingshuqiang,这可能是由于没有使用最新的MNE开发版本。能否请您mne.sys_info()按照上述文本中的要求进行报告。一般请尝试填写上面的报告。

Platform: Windows-10-10.0.19041-SP0 Python: 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] Executable: E:\anconda_install\python.exe CPU: Intel64 Family 6 Model 126 Stepping 5, GenuineIntel: 8 cores Memory: 15.8 GB

mne: 0.23.0 numpy: 1.20.1 {blas=mkl_rt, lapack=mkl_rt} scipy: 1.6.2 matplotlib: 3.3.4 {backend=Qt5Agg}

sklearn: 0.24.1 numba: 0.53.1 nibabel: 3.2.1 nilearn: 0.7.1 dipy: Not found cupy: Not found pandas: 1.2.4 mayavi: 4.7.3 pyvista: 0.30.1 {OpenGL 4.5.0 - Build 27.20.100.8729 via Intel(R) Iris(R) Plus Graphics} vtk: 9.0.1 PyQt5: 5.9.2

laoqingshuqiang commented 3 years ago

raw_intensity.annotations.rename({'1.0': 'Control', '2.0': 'Tapping/Left', '3.0': 'Tapping/Right'}) raw_intensity.annotations.delete(raw_intensity.annotations.description == '15.0') raw_intensity.annotations.set_durations(5)

rob-luke commented 3 years ago

Thanks for the info.

You are currently using version 0.23 of MNE-Python. You need the latest release. Try running the following then restarting.

pip install --upgrade --no-deps https://github.com/mne-tools/mne-python/archive/main.zip
rob-luke commented 3 years ago

Please let me know if this fixes your problem.

laoqingshuqiang commented 3 years ago

Thank you very much. It fixed my problem when I installed 0.24mne by your way. However, I meet another problem when I run Group Level GLM Analysis example code : bids_path = BIDSPath(subject=ID, task="tapping",root=fnirs_motor_group.data_path(), datatype="nirs", suffix="nirs", extension=".snirf") The ValueError: datatype (nirs) is not valid. Should be one of ['meg', 'eeg', 'ieeg', 'anat', 'beh'] The version of my mne_bids is 0.8. I really want to use MNE-nirs. Thank you for helping me!

rob-luke commented 3 years ago

Thank you for trying to use MNE-BIDS and reporting your experience. Together we can try and improve the installation process. Based on your errors I will update the documentation.

The ValueError: datatype (nirs) is not valid. Should be one of ['meg', 'eeg', 'ieeg', 'anat', 'beh']

I think this means you need the NIRS version of the MNE-BIDS library. See

image

so you need to run

pip install --upgrade --no-deps https://github.com/rob-luke/mne-bids/archive/main.zip

please let me know if this works, and I can try to update the website to make installation easier for other users.

I greatly appreciate you providing this helpful feedback.

rob-luke commented 3 years ago

@laoqingshuqiang have you had any luck with this?