Welcome! Log In Create A New Profile

Advanced

Python function to read bhv2 files

Posted by DHaehnke 
Python function to read bhv2 files
April 08, 2020 02:35PM
Hi Jaewon,

would it be possible for you to make function that reads bhv2 files in Python? I think it would be convenient to store it in a pandas DataFrame.

Best,
Daniel
Re: Python function to read bhv2 files
April 09, 2020 04:32PM
Sorry. I don't have time to make an extension for another language. It may work to convert BHV2 to MAT with the bhv2mat function and read the MAT file in Python.
Re: Python function to read bhv2 files
April 20, 2020 02:41PM
Fair enough.

You documented the bhv2 format well, so it should be easy to implement something.
I'll let you know when I have something that works.
Re: Python function to read bhv2 files
March 19, 2021 04:14PM
Did you find a way to be able to read bhv's in python?

Thanks in advance
Re: Python function to read bhv2 files
May 25, 2024 02:17PM
To anyone finding this post, Jaewon's suggestion of first converting bhv2 to mat files and then using scipy.io.loadmat worked for me. Make sure to use the argument 'simplify_cells = True' in the loadmat function because the monkeylogic files are nested structs, otherwise it won't be formatted correctly.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.