diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9633b3..df7b7a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ All notable changes to NRV are sumed up in this file. - progress bars are now handled with [rich.progress](https://rich.readthedocs.io/en/stable/progress.html) ### Fixed - +- ``axon.__init__``'s ``kwargs``: all parameters can now be set at the instantiation of the axon ### Removed diff --git a/nrv/nmod/_axons.py b/nrv/nmod/_axons.py index f58ecdcc..711adea7 100644 --- a/nrv/nmod/_axons.py +++ b/nrv/nmod/_axons.py @@ -285,7 +285,11 @@ def __init__( self.Nsec = 0 self.Nseg = 0 self.myelinated = "" - ## stims + + self.set_parameters(**kwargs) + + ## Contexts + # Intra stims self.intra_current_stim = [] self.intra_current_stim_positions = [] self.intra_current_stim_starts = [] @@ -294,6 +298,8 @@ def __init__( self.intra_voltage_stim = None self.intra_voltage_stim_position = [] self.intra_voltage_stim_stimulus = None + + # Extra stims self.extra_stim = None self.footprints = None ## recording mechanism diff --git a/nrv/nmod/_fascicles.py b/nrv/nmod/_fascicles.py index 90f2d896..edcb848c 100644 --- a/nrv/nmod/_fascicles.py +++ b/nrv/nmod/_fascicles.py @@ -180,8 +180,11 @@ def __init__(self, diameter=None, ID=0, **kwargs): super().__init__(**kwargs) # to add to a fascicle/nerve common mother class - self.save_path = "" - self.verbose = False + + #:str: path where the simulation results should be saved + self.save_path:str = "" + #:str: value: False: verbosity mainly for pbars. Tests more comment + self.verbose = False self.return_parameters_only = False self.loaded_footprints = False self.save_results = False diff --git a/tests/unitary_tests/094_test_rec_all.py b/tests/unitary_tests/094_test_rec_all.py index 8c3dd48a..06706540 100644 --- a/tests/unitary_tests/094_test_rec_all.py +++ b/tests/unitary_tests/094_test_rec_all.py @@ -2,45 +2,38 @@ import matplotlib.pyplot as plt if __name__ == "__main__": - gnafbar_mrg = 3.0 # S.cm-2 - gnapbar_mrg = 0.01 # S.cm-2 - gksbar_mrg = 0.08 # S.cm-2 - gl_mrg = 0.007 # S.cm-2 - cm=1 * 1e-6 # F - - ## Test1 - - - y = 0 - z = 0 - d = 6 - L = nrv.get_length_from_nodes(d, 15) - - axon1 = nrv.myelinated(y,z,d,L,dt=0.001,rec='all') - #print(axon1.rec_position_list) - total = 0 - for positions in axon1.rec_position_list: - total += len(positions) - #print(total) - print(total == len(axon1.x_rec)) - - t_start = 2 - duration = 0.1 - amplitude = 2 - axon1.insert_I_Clamp_node(2, t_start, duration, amplitude) - - t_sim=15 - results = axon1.simulate(t_sim=t_sim, record_I_mem=True) - del axon1 - - - plt.figure() - map = plt.pcolormesh(results['t'], results['x_rec'], results['V_mem'] ,shading='auto') - plt.xlabel('time (ms)') - plt.ylabel('position (µm)') - cbar = plt.colorbar(map) - cbar.set_label('membrane voltage (mV)') - plt.savefig('./unitary_tests/figures/94_A.png') + + ## Test1 + y = 0 + z = 0 + d = 6 + L = nrv.get_length_from_nodes(d, 15) + + axon1 = nrv.myelinated(y,z,d,L,dt=0.001,rec='all') + #print(axon1.rec_position_list) + total = 0 + for positions in axon1.rec_position_list: + total += len(positions) + #print(total) + print(total == len(axon1.x_rec)) + + t_start = 2 + duration = 0.1 + amplitude = 2 + axon1.insert_I_Clamp_node(2, t_start, duration, amplitude) + + t_sim=15 + results = axon1.simulate(t_sim=t_sim, record_I_mem=True) + del axon1 + + + plt.figure() + map = plt.pcolormesh(results['t'], results['x_rec'], results['V_mem'] ,shading='auto') + plt.xlabel('time (ms)') + plt.ylabel('position (µm)') + cbar = plt.colorbar(map) + cbar.set_label('membrane voltage (mV)') + plt.savefig('./unitary_tests/figures/94_A.png')