calderast / Hex-maze

Code to generate, plot, and calculate info about hex maze configurations and optimal barrier change sequences for the hex maze behavioral task used by the Berke Lab at UCSF.
1 stars 2 forks source link

Why do I get this issue when I try to read the "training_maze_database.pkl" but not "maze_configuration_database.pkl"?! #23

Open j2figuer opened 1 month ago

j2figuer commented 1 month ago

See?

image

It also happens for "barrier_sequence_database"😠😠😠

image

calderast commented 1 month ago

This is a numpy version issue - the numpy version you are using to load the database isn't playing nicely with the numpy version I used to create it.

Easiest thing to do is just update your numpy to version 2.0.0 and everything should work.

If you like the current numpy version you're using for other projects, you can make a separate virtual environment for the hex maze project where everything has the correct versions (recommended anyway, instructions below)


I like having a separate virtual environment for each project to dependencies don't clash:

  1. Navigate to the Hex-Maze project folder (you're probably already inside it)

  2. To create the virtual environment, run python -m venv name_of_my_env

(Make name_of_my_env whatever you want to name it. Do this only once, now the environment is created forever and you should see a folder name_of_my_env in the folder you created the environment in)

  1. To activate the virtual environment: source name_of_my_env/bin/activate (on MacOS or Linux) or name_of_my_env\Scripts\activate (on Windows)

(You should now see (name_of_my_env) appear in your terminal prompt, which indicates that the virtual environment is active)

  1. Install dependencies (like numpy 2.0.0)

When you first create an environment it doesn't have anything in it yet, so you'll need to re-install dependencies for this project. You can use the requirements.txt folder to install everything at once.

  1. Deactivate the environment when you're done working on hex maze things: deactivate

(You should see (name_of_my_env) no longer appears in your terminal prompt, which indicates that the virtual environment is not active)

Any time you want to work on the hex maze project, just re-run the command from 3. in the project folder to reactivate your environment! Make sure to select your virtual environment for your kernel in VSCode or whatever other IDE you're using


You can also load the csv version of the databases if you just want to be able to visually read them

Because spyglass only works with numpy <=1.24 (I think) I'll eventually create some subfolders for the maze databases like numpy2.0/ and numpy1.24/ so we have the databases for both versions.