Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stimulus/Response finding function #13

Open
cawarwick opened this issue Jun 1, 2023 · 2 comments
Open

Stimulus/Response finding function #13

cawarwick opened this issue Jun 1, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@cawarwick
Copy link
Collaborator

For stimulations which are somewhat discrete the timing is obvious (e.g. a brush stim) and the window/response is clear, but for others like GRP the response can be somewhat variable. I was thinking it would be useful to implement a function which figures out where the stimulus actually starts, i.e. within a broad window it finds the most common start time as well as the 95% confidence of the onset.

e.g. start times for responses within a broad window from the frame that the knob is turned to ~1-2 minutes after the drug is washed out could be compiled then plot them as a histogram to find the onset time?

Another possibility is to use the spikes in ones/zeros sheet and sum each time point, normalize to the max (e.g. when the max number of cells (e.g. 25) are active, that becomes 100%) and then find the start time which encompasses the 95th percentile?

Open to ideas, I just thought it would help refine the CICADA windows so that we didn't have to spend quite as much time guessing at when each population starts to become active due to the varying depth and kinetics of the drugs.

@cawarwick cawarwick added the enhancement New feature or request label Jun 1, 2023
@cawarwick
Copy link
Collaborator Author

Another super cool addition would be to include those 'population event probabilities' on the graphs such that you could see how the population responds on average. The idea would be is to see whether or not the cell you're examining is in sync with the overall population or is maybe a late responder/spontaneous. Each stim window would have it's own 'normalized to max' type of thing to not dwarf the small populations? Seems useful to me
image

@cawarwick
Copy link
Collaborator Author

cawarwick commented Jun 1, 2023

A later thought, maybe rather than using the Stim sheet we could use a different sheet to include/exclude certain ranges. e.g. maybe you want to average the rate over 2 time period, e.g. GRP initial response vs the later phase and want the normalization to be different than the monolithic stim window?

Some maybe psuedocode:
CopyofSpikesInOnes=SpikesInOnes ##make a copy of the SpikesInOnes to be modified
FiringRate=initialize a new 1d array which is the length of the recording

for each stim window:
Take the start to stop and cut the values out of the SpikesInOnes (remove the data from it)
Paste the 0/1 stim values into a temporary array
For each row (i.e. sum all ROIs)
sum of the 1s so that we have the max number of responses over time
##We now have a 1-D array that is the length of the stim window and has integer values
Take the max of the array
divide all values by that max (or use some normalization function)
#the array now has values ranging from 0 to 1 which indicate the max normalized response to that stim
add the time points back and now it's a 2d array
Concatenate to the FiringRate array

##at the end you have a 2d list of Time points and stim normalized responses with jumps in time between the stimuli.
##now the CopyofSpikesInOnes only contains times which are not included in the stim-window
Do the same thing as above (sum the ones and normalize the data against the max of everything)

Put all the data back together and sort by time

##also would need to add this double graph to plot.py (ugh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant