Unable to provide fast (eg dt=0.1) timestamps for amplitude injection
Hi there,
I am new to using BMTK, and I am trying to run a model where I inject a noisy current step using the IClamp module. I want this current injection to be a time varying stimulus with 0.1 ms steps. However, when I try to provide this resolution of time steps I get an error "Exception: IClampMod: csv timestamps column (timestamps) must have a consistent intervals." I think I have narrowed it down to how Python is representing floating points, and that there is an accumulation of errors across the timestamps vector such that when you run np.unique(np.diff(timestamps)), there are several different "interval" values. If I make my timestamps vector in increments of 1 (so dt=1ms), then I don't have this issue.
Ideally, I would inject a time varying stimulus defined by smaller timestamps than 1ms, though. Is there any way to allow for this functionality with the current set up?
Thank you!
Hi @renniek
Thanks for catching this! It looks like the issue is with how pandas exports and imports floating point values from a csv file, which actually too precise such that some timestep values are can't technically be represented as a factor of 0.1 ms. The good news is that BMTK will run iclamp simulations with changes in steps of arbitrary values (as long as it's equal or greater than the dt of the simulation). The bad news is that BMTK is seeing these insignificant precision differences and throwing an error.
To fix this I changed the functionality so that BMTK will not throw an error, and instead give a warning (which in your case you can ignore) and continue on with the simulation. It only involves a small change in bmtk/simulator/bionet/modules/iclamp.py replacing log_exception() with log_warning(). You can update the code yourself or do a git pull develop, or if you installed BMTK with either pip/conda will are hoping to do a new release before the end of the week.
Thanks, Kael
Hi @kaeldai,
Thank you so much for your quick response and for this easy to implement fix! I was able to change the exception to a warning, and now my provided file with 0.1 ms time steps is working (with just a warning showing up). I appreciate your help!
Best, Rennie