Closed vigneswaran-chandrasekaran closed 3 years ago
only have xlabel on last tile
please add a docstring to the function
Added some stylistic changes and used bin edges for histogram plotting to improve readability
The current version will give an output plot similar to,
@Vigneswaran-Chandrasekaran awesome! Is it ready for me to take a look?
I've added Normal distribution plot but I am not sure that is the right way to do it! Other than the distribution part, I think now the PR is ready for your review :)
Now the plot along with the distribution subplot looks like,
As the data points are close to uniform across, the bell curve is not very good looking
@Vigneswaran-Chandrasekaran getting the smoothed curve is pretty tricky. You actually want to convolve a a gaussian over the average spike train for the trial group. If that's too tricky, I think a PSTH is fine, but this bottom graph isn't really right.
Could you set the default number of bins to 30, and the default start and stop times to -0.5 and 1.0 seconds?
Added a simple GUI interface to plot. The interface looks something similar to,
@Vigneswaran-Chandrasekaran this looks great! Would you be able to allow group_by to be optional, and if it is missing do not group the trials at all and have them all be black?
@Vigneswaran-Chandrasekaran this looks great! Would you be able to allow group_by to be optional, and if it is missing do not group the trials at all and have them all be black?
Sure, currently the y axis is trials, in no group_by
will the y axis be simply stacking of all group_by
variables in all trials?
@Vigneswaran-Chandrasekaran yes, that's right
I applied Gaussian filter with sigma = 0.05
and got some satisfactory curves 😃 but I am not sure whether it is correct?
The main doubt, I have is should the time axis be,
linspace(start_time, stop_time, num_bins)
or linspace(start_time, stop_time, sampling_rate)
, currently I used mid-points of bin edges
@Vigneswaran-Chandrasekaran this looks great!
Thank you very much for your comments :) I made the changes and now the output figures look something similar to,
I made n_bins
as equal to time points for applying Gaussian filter 🤔 and added a condition that n_bins
should be more than 50
to plot Gaussians. Is this the right way? or I will have default (like equal to 1000) or get from the user?
Please increase the number of timepoints for the Gaussian to 1000
Thanks for your comment! I have made the timepoints as 1000
Some sample output plots,
Can you make it so the standard deviation is expressed in seconds, not samples?
Are you getting roughly the same values for the convolution compared to the histogram approach?
Are you getting roughly the same values for the convolution compared to the histogram approach?
No, the values in the gaussian smoothed will be much lesser. I thought it is correct as histogram bins will be broader. Is that correct?
If you are getting very different values then you are probably doing the gaussian blur incorrectly
Thanks for your reply
The gaussian blur curve and histograms come closer as number of bins is closer to 1000 (gaussian blur's default time points)
histogram with 30 bins
histogram with 500 bins
histogram with 1000 bins
Am I making any sense? If not kindly mention, I will try to check the gaussian smoothing function
The average rate should not change when you change the bin width of our histogram. I think you are calculating firing rate incorrectly. Are you properly dividing by the bin width in seconds?
What about if there are not many bins? Like what if there are 30 bins?
The firing rate is larger compared to the gaussian (the first figure in previous comment)
The average rate should not change when you change the bin width of our histogram. I think you are calculating firing rate incorrectly. Are you properly dividing by the bin width in seconds?
Yes, I divide the bin widths properly (linspace(before_time, after_time, 1000)
for gaussian blur), I will check once where I am going wrong
I modified the layout of the subplots and now the plots look something similar to,
Please let me know if any changes need to be done
@Vigneswaran-Chandrasekaran can you please resolve the merge conflicts?
I've resolved all the merge conflicts and it is ready for review
Function for plotting PSTH
Sample usecase:
will give an output plot,
closes #6