Adjusting Exp2Syn() weight after restoration by SaveState()

Anything that doesn't fit elsewhere.
Post Reply
Jaekyung Kim
Posts: 9
Joined: Thu Aug 16, 2012 8:41 pm

Adjusting Exp2Syn() weight after restoration by SaveState()

Post by Jaekyung Kim » Wed Feb 24, 2016 3:47 am

I am trying to repeat simulation only after specific time keeping same state before that time. When I run simulation from 0 s to 10 s and I should repeat many times this period, I would like to repeat only from 5 s to 10 s. In other words, I would like to save time to repeat from 0 s to 5 s. I simulated conductances using Exp2Syn(). There are many activated conductances at 5 s. While keeping all the conductances activated before the time point of 5 s, I would like see voltage by adding or removing conductances activated after 5 s. In order to do it, I used SaveState(). I saved state at 5 s by “stateh.save()” at t = 5000. After finishing one simulation, I restored state saved in “stateh” by “stateh.restore()” and run simulation from restored time and voltage. I could reproduce exactly same voltage response from 5 s to 1 s as I saw at the first simulation. However the problem I faced was that I could not change the weight of Exp2Syn after 5 s. Only I can reproduce the voltage and conductance as exactly same as I saw at the first simulation. I would like to keep the state before 5 s and change conductances after 5 s as I want. What is the problem in my case?

Even though I inserted new Exp2Syn() into the cell after restoration from “stateh”, this new Exp2Syn() did not work et all. If I use SaveState(), the only thing I can is reproducing exactly same full trace and I cannot change, remove, and add conductance using the restored state?

...
stateh = new SaveState()
...
if (t==5000) stateh.save()
...
after finishing whole simulation
...
stateh.restore()
...
I just run from t=5000 and voltage at this time
...

Please give me advice. Thank you!!

ted
Site Admin
Posts: 5593
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Adjusting Exp2Syn() weight after restoration by SaveStat

Post by ted » Wed Feb 24, 2016 10:53 am

Initialization from saved state will fail if the structure of the model equations has been changed (e.g. adding or deleting sections, changing nseg, inserting or uninserting mechanisms) or if any objects have been created or destroyed. Suggest you set up _all_ synaptic connections BEFORE doing the "warmup" run (initialization run) and calling SaveState.save. If there are some synapses that must be silent during the initialization run, then before you execute the initialization run just make sure to use NetCon.active(0) to inactivate every NetCon that drives them. Then when it comes time to do a "test" run, use a custom proc init() that reactivates those NetCons. For example, suppose the NetCons that drive your special synapses have been appended to a List called silentncs. Then to generate the SaveState object, you do this

Code: Select all

for i=0,silentncs.count()-1 silentncs.o(i).active(0) // read about NetCon class's active() method
. . . next come statements that execute the initialization run, call SaveState.save, and save the SaveState object for future use
Now let's say that you want to run simulations that use the saved states.
You have read the saved states into a SaveState object called svstate.
You will need to use this custom proc init:

Code: Select all

proc init() {
  finitialize(v_init)
  svstate.restore()
  t = 0
  for i=0,silentncs.count()-1 silentncs.o(i).active(1)
  if (cvode.active()) {
    cvode.re_init()
  } else {
    fcurrent()
  }
  frecord_init()
}

Jaekyung Kim
Posts: 9
Joined: Thu Aug 16, 2012 8:41 pm

Re: Adjusting Exp2Syn() weight after restoration by SaveStat

Post by Jaekyung Kim » Mon Feb 29, 2016 2:46 am

Thank you!! I removed some redundant objects and I succeed in runing simulation from the saved state. I think redundant objects appeared to be changed after saving state. Thank you for your help. Now I can run simulation from saved state well.

Post Reply