Saving session doesn't save current plot correctly

Anything that doesn't fit elsewhere.
Post Reply
sbrich
Posts: 9
Joined: Tue May 08, 2018 2:08 pm

Saving session doesn't save current plot correctly

Post by sbrich » Fri Aug 03, 2018 1:54 pm

Hi all,

I'm doing some work utilizing MRF and am visualizing the various current flows as I do so to help me make informed decisions on my conductance values (the primary variables I'm optimizing over). However, I've recently noticed that when I save my "session" files, even though all the windows and data associated with the MRF is saved appropriately, the details in my current plot are not... i.e. I have to go back through and recreate my current plot from scratch each time I load the session. I wasn't having this issue before when I was doing this with current clamps as opposed to ionic currents, and I also didn't have this issue with any voltage plots I've used in the past. Any idea what may be going awry here?

Thanks in advance for any suggestions and help you may have!

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

Re: Saving session doesn't save current plot correctly

Post by ted » Sun Aug 05, 2018 11:30 am

I'm not sure I understand what you're doing that isn't working the way you expect. Maybe it would be useful to set up a Skype call with screen sharing so you can show me exactly what's going on. We're doing the NEURON course this week, so time will be tight from tomorrow (Monday, Aug. 6) through Sunday, Aug. 12. Best opportunity might be today, between about 2 and 5 PM New York time. Would take maybe 10-15 minutes, and at the least I'd have a better idea of what you're trying to do. Please confirm via email to ted dot carnevale at yale dot edu

sbrich
Posts: 9
Joined: Tue May 08, 2018 2:08 pm

Re: Saving session doesn't save current plot correctly

Post by sbrich » Mon Aug 13, 2018 11:17 am

ted wrote:
Sun Aug 05, 2018 11:30 am
I'm not sure I understand what you're doing that isn't working the way you expect. Maybe it would be useful to set up a Skype call with screen sharing so you can show me exactly what's going on. We're doing the NEURON course this week, so time will be tight from tomorrow (Monday, Aug. 6) through Sunday, Aug. 12. Best opportunity might be today, between about 2 and 5 PM New York time. Would take maybe 10-15 minutes, and at the least I'd have a better idea of what you're trying to do. Please confirm via email to ted dot carnevale at yale dot edu
Hi Ted,
My apologies for not responding to you earlier! I posted this right before I was heading out of town for a conference, and amidst all the craziness of that this completely slipped my mind. I've been working on some other projects since I got back, but once I get back into this work I'll try to get you a better explanation of what's going on, and then figure out whether a Skype call might be a good idea. I very much appreciate the offer!
I'll be in touch. Thanks again for your help, and my apologies for the delay in my response.
Scott

sbrich
Posts: 9
Joined: Tue May 08, 2018 2:08 pm

Re: Saving session doesn't save current plot correctly

Post by sbrich » Fri Aug 17, 2018 12:46 pm

So I'm getting back into this work, and loaded a recent session and it seems like everything loaded correctly, including my current plot. I'm wondering if this was just a weird one-off situation with a particular way I had things set up in a previous setting. If the situation arises again I'll be sure to let you know with additional details.
Thanks again!

sbrich
Posts: 9
Joined: Tue May 08, 2018 2:08 pm

Re: Saving session doesn't save current plot correctly

Post by sbrich » Tue Aug 21, 2018 2:14 pm

ted wrote:
Sun Aug 05, 2018 11:30 am
I'm not sure I understand what you're doing that isn't working the way you expect. Maybe it would be useful to set up a Skype call with screen sharing so you can show me exactly what's going on. We're doing the NEURON course this week, so time will be tight from tomorrow (Monday, Aug. 6) through Sunday, Aug. 12. Best opportunity might be today, between about 2 and 5 PM New York time. Would take maybe 10-15 minutes, and at the least I'd have a better idea of what you're trying to do. Please confirm via email to ted dot carnevale at yale dot edu
Hi Ted,
So this issue seems to have reared its head again. If I could upload images to this post (which I can't seem to figure out how to do) I could show you very quickly what's going on. But to give it another go: while working with the MRF, I also have up a "current axis" graph with which I'm tracking a variety of ionic currents' influence on my model neuron. When I save a session file, I have four variables plotted in that window. However, when I load the same session window, the graph is empty, and I have to manually remake the graph.
Obviously this isn't a huge issue, just a minor inconvenience, but it feels like something odd is happening here given how powerful saving .ses files is, and how I've never had this issue with, say, a "voltage axis" window. Any help would be much appreciated!
Scott

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

Re: Saving session doesn't save current plot correctly

Post by ted » Tue Aug 21, 2018 4:58 pm

Screen sharing would be the fastest way for me to see exactly what you're doing and determine what is causing the problem.

sbrich
Posts: 9
Joined: Tue May 08, 2018 2:08 pm

Re: Saving session doesn't save current plot correctly

Post by sbrich » Tue Aug 21, 2018 4:59 pm

OK, I'll e-mail you to set something up.

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

Re: Saving session doesn't save current plot correctly

Post by ted » Thu Aug 23, 2018 11:10 am

For the benefit of others who may read this thread:

The model sbrich was trying to reuse had been implemented in a program that appeared to execute normally. It didn't launch a simulation--wasn't supposed to--but it did recreate all GUI tools, including a Multiple Run Fitter. However, sbrich discovered that if he added a new graph to plot some variables of particular interest, then saved that graph to a session file, the graph wouldn't be recreated properly the next time he used NEURON to execute the model--instead, the graph had a blank canvas. Hidden behind the many GUI windows was the terminal where NEURON reported error messages, and sure enough, there was a message that one of the many biophysical mechanisms (e.g. ion channels) used by the model (and referenced by sbrich's graph) was not present. topology() confirmed that the model's branched architecture existed, but checking the graph's Plot what? tool revealed that sections had only a few properties that could be plotted--cm, diam, i_cap, v.

And yet clicking on the RunControl panel's Init & Run button launched a simulation in which the model cell did what it was supposed to do. Furthermore, sbrich discovered that after that first run, creating a new Graph and checking its Plot what? menu revealed that now the sections had their full complement of ion channels. How could this happen?

To understand what's going on here, it is necessary to know something about how programs are organized. The recommended strategy for organizing a program in NEURON follows this outline:

1. Optional: declaration of symbolic constants, e.g. statements like
MAX_GNABAR = 0.12
NUMBER_OF_CELLS = 10
2. Model setup code, which specifies model topology (creating and connecting sections), defines subsets of sections, assigns biophysical properties, and specifies spatial discretization (nseg). If this is a network model, setup code also connects the cells with synapses and/or gap junctions.
3. Instrumentation code, e.g. for attaching signal sources (current and/or voltage clamps, synapses used to implement afferent projections), setting up Vector record and/or stimulation, recording of spike times, extracellular recording, file i/o, etc..
4. Simulation flow control code. The basic task of simulation flow control code is to initialize and launch simulations; that's what the standard run system's run() does (h.run() for all you pythonistas). However, user-written simulation flow control code can be as complicated as an elaborate event-driven virtual experimental protocol that perturbs model parameters in the course of a simulation (e.g. to represent temperature changes, or implement changes of extracellular ionic concentrations, localized or bath application of neurotransmitters or channel blockers, photostimulation, or extracellular electrical stimulation).
5. User interface code, e.g. graphs to display simulation results on the fly, procedures and/or graphical tools for adjusting model parameters, graphical tools for launching simulations.

It is best to avoid mixing different kinds of code. Model setup code, instrumentation code, simulation flow control code, user interface code--these should all be kept separate from each other. This is called modularity. A program that adheres to modularity is much easier to develop and debug than a program that mixes different kinds of code.

Apparently, the code that sbrich is trying to reuse violates modularity by burying key components of model setup code inside of code that is used to initialize simulations. The principal task of initialization code is to ensure that state variables are initialized to the correct starting values. Initialization code isn't the right place for statements that affect the structure of a model--statements that set up its anatomical structure of a model, or specify the equations that are to be solved in the course of a simulation, are model setup code and should be placed in the same block of code as all of the other model setup code.

sbrich's task now is to figure out how to reorganize the program in a modular way without breaking it.

Post Reply