Poirazi-Lab / mouse2afc

GNU General Public License v3.0
1 stars 4 forks source link

Create real time plots #4

Open HenryJFlynn opened 1 year ago

HenryJFlynn commented 1 year ago

Background:

In the MATLAB protocol, there are live plots of experimental parameters such as mouse performance No such feature exists with the PyBpod protocol

Goal:

Create plots of experimental parameters similar the functionalities in MATLAB

See https://github.com/HenryJFlynn/mouse2afc/issues/32 for the original issue

stumpychloe commented 4 months ago

To start with this issue I decided the first graph will calculate how much water the mouse receives and will update with each trial. The first task that come with this graph is writing a code that will tally up how many times the mouse receives a reward in a trial.

stumpychloe commented 4 months ago

I successfully was able to create a tally of the mount of times the mouse receives a reward. I plan to use this list to plot the number of trials and the water output. Additionally I would like for the graph to calculate the output the amount of water.

stumpychloe commented 3 months ago

I was able to make a graph but I realized that the code is not correctly counting the times a reward is outputted so I am now working on correcting that. Additionally the data is not saving correctly it only stores the log so that should be fixed as well.

stumpychloe commented 3 months ago

In be able to correct the counter I wanted to find where the current states are being deiced. In this section of the code the current state is a number that relates to the state transition diagram. Then I made it count how many times the current state is the pre stimreward or the center port reward delivery. It seems that by using this method the count is now correct.

image

image

I now plan to make this data graph-able this will have to either take place in the mouse2afc or the pybpod.

stumpychloe commented 3 months ago

I had originally tried to take this data and import it into the run section in mouse2afc but this was not possible so now I am trying to graph this data in the pybpod section.

stumpychloe commented 3 months ago

image

image

This is the correct totals of the values that happen over the trials. I plan to append these values and graph them. I originally tried to do this in the run function in the pybpod section like how I was able to in the mouse2afc. So I am going to do it in the transtion_to_new_state def.

stumpychloe commented 2 months ago

image

by implementing this line of code in the run section in the BbpodBase it allows for the graph to be displayed after the experiment is completed. Now all I need to do is make sure that the data that is plotting is correct and see if there is a way for the amount of water set in the parameters to be calculated into the amount to give an accurate amount of water.

stumpychloe commented 2 months ago

image

by running this the graphs data is correct and running.

stumpychloe commented 2 months ago

image

by creating a plotting def and calling it in the run state machine def it was able to correctly graph the data for how many times a motivator and a reward is given per trial.

stumpychloe commented 2 months ago

Now I plan to make the graph appear at the the beginning and update with each trial

stumpychloe commented 2 months ago

image

After some thought I moved the counting back over to the mouse2afc directory so that I can calculate the total ware with the task parameters. Now that the data is correctly updating I now just need to make it graph. Additionally this is taking place in the data file under CustomData.

stumpychloe commented 2 months ago

image

By updating the code the parameter values can be found and them multiplied by the count to determine the correct amount of water that is dispersed.

image

By multiplying these values the graph is now correctly showing the amount of water that is dispersed over each trial.

stumpychloe commented 2 months ago

Now all I need to do I make this graph in real time. After that is completed I would like to make a graph that shows how long each trial takes.

stumpychloe commented 2 months ago

I was able to make the graph update in real time while the experiment is running by doing these following steps.

image

Initializing the graph in the data file

image

Creating a definition to update the plot

image

Lastly implementing it in the run section int mouse2afc file

stumpychloe commented 2 months ago

Now I would like to see if I could make a second graph but instead of amount of water dispersed over a trial I would like to see how much time it takes per trial.