-
Notifications
You must be signed in to change notification settings - Fork 61
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
[MRG] Simulate spikes / action potentials #259
Conversation
This func can be used with scipys curve_fit to fit isolated APs from real data (bycycle-tools/bycycle#100). The resulting 8 params could be useful (i.e. dimensionality reduction for APs) and included in df_features returned from bycycle.Spikes.fit(). |
This looks super cool! I had a quick scan of the code, left a coupe comments, and here's a couple quick "higher-level" questions:
Between the two comments, I think it's possible it might be a cleaner split to put some stuff in transients, that might work well for generating APs, but might not be quite the same as what one wants for a cycle? What do you think? |
I've update the code here based on the review. I also update the ap func to take iterables for simulation parameters. This is because 3 gaussians may desired in some cases (i.e. the sum of conductive, sodium and potassium currents). Despite this, 3 currents can be created with only 2 gaussians (where the positive portion has a wide std). The 3 current model is from this paper. Third column plot: from neurodsp.sim.cycles import sim_ap_cycle
import matplotlib.pyplot as plt
cycle = sim_ap_cycle(1, 100, (.5, .3, .6), (.1, .1, .1), (0, -1, 1), (-5, 1, 2.5))
plt.plot(cycle) |
@TomDonoghue I made a final round of updates. There have been several changes since the last time you reviewed, but it should be ready to merge. Let me know if you'd like to look over the changes, otherwise I'll merge. |
Edit: hey @ryanhammonds, this looks great! Very cool addition! Everything looks good to me - you can go ahead and merge when you're ready! |
This adds action potential cycles as the sum of two inverted asymmetrical gaussians: