-`NeuronalBilayerSonophore` defines the **full electromechanical model for any given neuron type**. To do so, it inherits from `BilayerSonophore` and receives a specific `PointNeuron`objectatinitialization.
Allthreeclassescontaina`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.
-`HybridSimulator` inherits from both `PeriodicSimulator`and `PWSimulator`.Itintegratesadifferentialsystemusingahybridschemeinsideeach"ON"or"OFF"period:
```$ python run_astim.py -n RS -a 32 -f 500 -A 100 --tstim 150 --method sonic -p Qm```
Thesimulationresultsaresavedin`.pkl` files. To view these results directly upon simulation completion, you can use the `-p [xxx]` option, where `[xxx]` can be `all` or a given variable name (e.g. `Z` for membrane deflection, `Vm` for membrane potential, `Qm`formembranechargedensity).
Youcanalsoeasilyrunbatchesofsimulationsbyspecifyingmorethanonevalueforanygivenstimulationparameter(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`.
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`).Thisnameisakeywordusedtorefertothemodelfromoutsidetheclass.
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 defining a dictionary of lambda functions that take the membrane potential `Vm` and a states vector `x` as inputs, and return a dictionary of lambda function returning the derivatives of your different state variables (in `<state_unit>/s`). **This method is automatically parsed to generate the equivalent `derEffStates` method used in coarse-grained US simulations. Hence, make sure that all internal calls to functions that depend solely on `Vm`appeardirectlyintheselambdaexpressionsandarenothiddeninsidenestedfunctioncalls.**
8.Modifythe`steadyStates` method defining a dictionary of lambda functions that take a membrane potential value `Vm` as input, and return the steady-state values of your different state variables (in `<state_unit>`).
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 defining a dictionary of lambda functions that take a membrane potential value Vm and a states vector `x` as inputs, and return the different membrane currents of your model (in `mA/m2`).
11.Addtheneuronclasstothepackage,byimportingitinthe`__init__.py` file of the `neurons`sub-folder:
12.Pre-computelookuptablesrequiredtoruncoarse-grainedsimulationsoftheneuronmodeluponultrasonicstimulation.Todoso,gotothe`scripts` directory and run the `run_lookups.py`scriptwiththeneuron'snameascommandlineargument,e.g.: