-`NeuronalBilayerSonophore` defines the **full electromechanical model for any given neuron type**. To do so, it inherits from `BilayerSonophore` and receives a specific `PointNeuron`objectatinitialization.
Allmodelclassescontaina`simulate` method to simulate the underlying model's behavior for a given set of stimulation and physiological parameters. The `NeuronalBilayerSonophore.simulate` method contains an additional `method` argument defining whether to perform a detailed (`full`), coarse-grained (`sonic`) or hybrid (`hybrid`)integrationofthedifferentialsystem.
-`HybridSolver` inherits from both `PeriodicSolver`and `EventDrivenSolver`.Itintegratesadifferentialsystemusingahybridschemeinsideeach"ON"or"OFF"period:
```python run_astim.py -n RS -a 32 -f 500 -A 100 --tstim 150 --method sonic -p Qm```
Additionally,youcanrunbatchesofsimulationsbyspecifyingmorethanonevalueforanygivenstimulationparameter(e.g.`-A 100 200` for sonication with 100 and 200 kPa respectively). These batches can be parallelized using multiprocessing to optimize performance, with the extra argument `--mpi`.
Toviewresultsdirectlyuponsimulationcompletion,youcanusethe`-p [xxx]` option, where `[xxx]` can be `all` (to plot all resulting variables) or a given variable name (e.g. `Z` for membrane deflection, `Vm` for membrane potential, `Qm`formembranechargedensity).
Tosavesimulationresultsinbinary`.pkl` files, you can use the `-s` option. You will be prompted to choose an output directory, unless you also specify it with the `-o <output_directory>`option.Outputfilesareautomaticallynamedfrommodelandsimulationparameterstoavoidambiguity.
Tovisualizeresults,usethe`plot_timeseries.py` script. You will be prompted to select the output files containing the simulation(s) results. By default, separate figures will be created for each simulation, showing the time profiles of all resulting variables. Here again, you can choose to show only a subset of variables using the `-p [xxx]` option. Moreover, if you select a subset of variables, you can visualize resulting profiles across simulations in comparative figures wih the `--compare`option.
1.Createanewfile,andsaveitinthe`neurons` sub-folder, with an explicit name (e.g. `my_neuron.py`).
2.Copy-pastethecontentofthe`template.py` file (also located in the `neurons`sub-folder)intoyourfile.
3.Inyourfile,changethe**classname**from`TemplateNeuron` to something more explicit (e.g. `MyNeuron`), and change the **neuron name** accordingly (e.g. `myneuron`). This name is a keyword used to refer to the model from outside the class. Also, comment out the `addSonicFeatures`decoratortemporarily.
4.Modify/add**biophysicalparameters**ofyourmodel(restingparameters,reversalpotentials,channelconductances,ionicconcentrations,temperatures,diffusionconstants,etc...)asclassattributes.Ifsomeparametersarenotfixedandmustbecomputed,assignthemtotheclassinsidea`__new__` method, taking the class (`cls`)assoleattribute.
6.Modify/add**gatingstateskinetics**(`alphax` and `betax` methods) that define the voltage-dependent activation and inactivation rates of the different ion channnels gates of your model. Those methods take the membrane potential `Vm` as input and return a rate in `s-1`. Alternatively, your can use steady-state open-probabilties (`xinf`) and adaptation time constants (`taux`)methods.
7.Modifythe`derStates` method that defines the **derivatives of your different state variables**. These derivatives are defined inside a dictionary, where each state key is paired to a lambda function that takes the membrane potential `Vm` and a states vector `x` as inputs, and returns the associated state derivative (in `<state_unit>/s`).
8.Modifythe`steadyStates` method that defines the **steady-state values of your different state variables**. These steady-states are defined inside a dictionary, where each state key is paired to a lambda function that takes the membrane potential `Vm` as only input, and returns the associated steady-state value (in `<state_unit>`).Ifsomesteady-statesdependonthevaluesofother-steadystates,youcanproceedasfollows:
-adddependentsteady-statefunctionstothedictionary,calling`lambda_dict[k](Vm)` for each state `k`whosevalueisrequired.
9.Modify/add**membranecurrents**(`iXX` methods) of your model. Those methods take relevant gating states and the membrane potential `Vm` as inputs, and must return a current density in `mA/m2`.**Youalsoneedtomodifythedocstringaccordingly,asthisinformationisusedbythepackage**.
10.Modifythe`currents` method that defines the **membrane currents of your model**. These currents are defined inside a dictionary, where each current key is paired to a lambda function that takes the membrane potential `Vm` and a states vector `x` as inputs, and returns the associated current (in `mA/m2`).
11.Addtheneuronclasstothepackage,byimportingitinthe`__init__.py` file of the `neurons`sub-folder:
13.Uncommentthe`addSonicFeatures` decorator on top of your class. **This decorator will automatically parse the `derStates`, `steadyStates` and `currents`methodsinordertoadaptyourneuronmodeltoUSstimulation.Forthistowork,youneedtomakesureto**:
14.Pre-computelookuptablesrequiredtoruncoarse-grainedsimulationsoftheneuronmodeluponultrasonicstimulation.Todoso,gotothe`scripts` directory and run the `run_lookups.py`scriptwiththeneuron'snameascommandlineargument,e.g.: