Questions tagged «neuroscience»

13
具有太多参数的类:更好的设计策略?
我正在使用神经元模型。我正在设计的一个类是细胞类,它是神经元(连接在一起的几个隔室)的拓扑描述。它有很多参数,但是它们都是相关的,例如: 轴突节段数,根尖分叉,体长,体径,根尖长,分支随机性,分支长度等……总共约有15个参数! 我可以将所有这些设置为某个默认值,但我的类看起来有些疯狂,其中包含几行参数。这种事情也必须偶尔在其他人身上发生,是否有一些明显的更好的设计方法或者我做对了? 更新: 正如您中的一些人所要求的那样,我已经在该类的代码中附加了代码,您可以看到该类具有大量参数(> 15),但是它们都被使用,并且对于定义单元格的拓扑结构是必需的。本质上,问题在于它们创建的物理对象非常复杂。我已经附上了由此类产生的对象的图像表示。有经验的程序员将如何以不同的方式执行此操作,以避免定义中包含如此多的参数? class LayerV(__Cell): def __init__(self,somatic_dendrites=10,oblique_dendrites=10, somatic_bifibs=3,apical_bifibs=10,oblique_bifibs=3, L_sigma=0.0,apical_branch_prob=1.0, somatic_branch_prob=1.0,oblique_branch_prob=1.0, soma_L=30,soma_d=25,axon_segs=5,myelin_L=100, apical_sec1_L=200,oblique_sec1_L=40,somadend_sec1_L=60, ldecf=0.98): import random import math #make main the regions: axon=Axon(n_axon_seg=axon_segs) soma=Soma(diam=soma_d,length=soma_L) main_apical_dendrite=DendriticTree(bifibs= apical_bifibs,first_sec_L=apical_sec1_L, L_sigma=L_sigma,L_decrease_factor=ldecf, first_sec_d=9,branch_prob=apical_branch_prob) #make the somatic denrites somatic_dends=self.dendrite_list(num_dends=somatic_dendrites, bifibs=somatic_bifibs,first_sec_L=somadend_sec1_L, first_sec_d=1.5,L_sigma=L_sigma, branch_prob=somatic_branch_prob,L_decrease_factor=ldecf) #make oblique dendrites: oblique_dends=self.dendrite_list(num_dends=oblique_dendrites, bifibs=oblique_bifibs,first_sec_L=oblique_sec1_L, first_sec_d=1.5,L_sigma=L_sigma, branch_prob=oblique_branch_prob,L_decrease_factor=ldecf) #connect axon to soma: axon_section=axon.get_connecting_section() …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.