Sleep Wake Cycles Update 4

There were a few bugs in my code that my research professor and I found which prevented the plotting of my graphs last week. One issue was, when I was plotting probability of a bout versus time, my probability array had one fewer element than my time array, an issue I easily fixed by adding a spot to my blank probability array at the beginning of my code. Another issue I encountered was that I used t as a variable twice, once as a variable for time, and also in a for loop I used to calculate probabilities. Fixing these problems finally allowed my plots to show up.

After dealing with these minor issues, we realized a larger one.
The bout lengths were not being measured correctly. After looking at my plots and the code more carefully, I realized that instead of measuring the time each bout took, my code was simply recording the number of times a neuron spiked within each bout. I fixed this issue in the last week by adding another counter that would count each time step in between when a neuron fires, hence counting the total time steps of a bout, not just the number of times the neuron spikes. I then shortened the duration of my runs and carefully made sure inhibition was working correctly and that bout lengths were being calculated correctly (by comparing how approximated bout lengths as shown in the plots and the calculated values generated by my code). I also looked over the code that calculated probability, and, again, compared the values I calculated by looking at the plots of bouts and the values the code generated. I finally was able to graph the log of the probability of the neuron being in a bout versus time, and got the straight line I desired, meaning the data is exponentially distributed, which is what we were aiming for.

Yesterday I met with my research advisor and he looked over my corrections and the probability distributions as well. The next step was to figure out why the run time was so long. For a 10 second interval, my code takes 5 minutes, which is very long, especially because I am aiming for a much longer time interval. We looked over possible inefficiencies in my code. In the coming week, I will switch back to python, in case that helps with the speed. I will also make the bout counting more efficient. Instead of setting up counters, I will simply record the time a neuron fires, and subtract that from the time the other neuron fires.

We also decided that I should start modeling the power-law distribution of wake cycles by adding a new external current (that would be produced by the locus coeruleus in the rat brains we are modeling.) I will explain this more in my next update.