def testComparisonFailureAddingEpsilon2(self): """Load and complex .swc file, and change each [x, y, z, r] value in the vertices matrix individually, to check that it is not the same. """ testSrcsPath = LocMgr().get_test_srcs_path() srcSWCFile = Join(testSrcsPath, "swc_srcs/28o_spindle20aFI.CNG.swc") m = MorphologyArray.fromSWC(srcSWCFile) MFRandom.seed(0) for i in range(len(m)): print i, len(m) for j in range(4): # Only test 2% of cases: if not np.random.rand() < 0.02: continue m1 = MorphologyArray.fromSWC(srcSWCFile) m1._vertices[i, j] = m1._vertices[i, j] + 0.01 assert MorphArrayComparison.are_same(m, m1, max_node_distance=0.02) assert not MorphArrayComparison.are_same( m, m1, max_node_distance=0.005)
def testComparisonFailureAddingEpsilon2(self): """Load and complex .swc file, and change each [x, y, z, r] value in the vertices matrix individually, to check that it is not the same. """ testSrcsPath = LocMgr().get_test_srcs_path() srcSWCFile = Join(testSrcsPath, "swc_srcs/28o_spindle20aFI.CNG.swc") m = MorphologyArray.fromSWC(srcSWCFile) MFRandom.seed(0) for i in range(len(m)): print i, len(m) for j in range(4): # Only test 2% of cases: if not np.random.rand() < 0.02: continue m1 = MorphologyArray.fromSWC(srcSWCFile) m1._vertices[i, j] = m1._vertices[i, j] + 0.01 assert MorphArrayComparison.are_same(m, m1, max_node_distance= 0.02) assert not MorphArrayComparison.are_same(m, m1, max_node_distance= 0.005)
def build_hoc(self, hocfile_obj): cell = self.cell_location.cell section = self.cell_location.morphlocation.section syn_name_post = self.synapse.get_name() + 'Post' cell_hoc = hocfile_obj[MHocFileData.Cells][cell] data = { 'synnamepost': syn_name_post, 'cell': cell, 'cellname': cell_hoc['cell_name'], 'sectionindex': cell_hoc['section_indexer'][section], 'sectionpos': self.cell_location.morphlocation.sectionpos, 'tau_open': self.tau_open, 'tau_close': self.tau_close, 'e_rev': self.e_rev, 'pOpening': self.popening, 'random_seed': MFRandom.get_seed(), } hocfile_obj.add_to_section(MHOCSections.InitSynapsesChemPost, Template(exp2HOCTmpl, data).respond()) hocfile_obj[MHocFileData.Synapses][self.synapse] = {} hocfile_obj[MHocFileData.Synapses][self.synapse]['POST'] = data
def build_hoc(self, hocfile_obj): cell = self.cell_location.cell section = self.cell_location.morphlocation.section syn_name_post = self.synapse.get_name() + 'Post' cell_hoc = hocfile_obj[MHocFileData.Cells][cell] data = { "synnamepost": syn_name_post, "cell": cell, "cellname": cell_hoc['cell_name'], "sectionindex": cell_hoc['section_indexer'][section], "sectionpos": self.cell_location.morphlocation.sectionpos, "tau_open": self.tau_open, "tau_close": self.tau_close, "e_rev": self.e_rev, "pOpening": self.popening, 'random_seed': MFRandom.get_seed(), } hocfile_obj.add_to_section(MHOCSections.InitSynapsesChemPost, Template(exp2HOCTmpl, data).respond()) hocfile_obj[MHocFileData.Synapses][self.synapse] = {} hocfile_obj[MHocFileData.Synapses][self.synapse]['POST'] = data