Пример #1
0
        def test():
            from blenderneuron.quick import bn

            with Blender(keep=False):

                from neuron import h
                h.load_file(test_hoc_file)
                tc = h.TestCell()

                ic = h.IClamp(0.5, sec=tc.soma)
                ic.delay = 1
                ic.dur = 3
                ic.amp = 0.5

                bn.prepare_for_collection()
                h.run()
                bn.to_blender()

                bn.run_command("bpy.data.scenes['Scene'].frame_current = 1;")
                self.assertTrue(
                    bn.run_command(
                        "return_value = bpy.data.materials['TestCell[0].dendrites[9][0]'].emit"
                    ) == 0.0)

                bn.run_command("bpy.data.scenes['Scene'].frame_current = 7;")
                self.assertTrue(
                    bn.run_command(
                        "return_value = bpy.data.materials['TestCell[0].dendrites[9][0]'].emit"
                    ) == 2.0)
Пример #2
0
        def test():
            from blenderneuron.quick import bn

            with Blender(keep=False):

                from neuron import h
                h.load_file(test_hoc_file)
                tc1 = h.TestCell()
                tc2 = h.TestCell()

                ic = h.IClamp(0.5, sec=tc1.soma)
                ic.delay = 1
                ic.dur = 3
                ic.amp = 0.5

                bn.prepare_for_collection()
                bn.groups["all"]["3d_data"]["interaction_level"] = "Section"
                bn.groups["all"]["3d_data"]["color_level"] = "Segment"

                h.run()

                bn.to_blender()

                self.assertTrue(
                    bn.run_command(
                        "return_value = 'TestCell[0].soma' in bpy.data.objects"
                    ))
                self.assertTrue(
                    bn.run_command(
                        "return_value = 'TestCell[1].soma' in bpy.data.objects"
                    ))

                self.assertTrue(
                    bn.run_command(
                        "return_value = 'TestCell[0].soma[0]' in bpy.data.materials"
                    ))
                self.assertTrue(
                    bn.run_command(
                        "return_value = 'TestCell[1].soma[0]' in bpy.data.materials"
                    ))

                bn.run_command("bpy.data.scenes['Scene'].frame_current = 0")
                self.assertEqual(
                    bn.run_command(
                        "return_value = bpy.data.materials['TestCell[0].soma[0]'].emit"
                    ), 0.0)
                self.assertEqual(
                    bn.run_command(
                        "return_value = bpy.data.materials['TestCell[1].soma[0]'].emit"
                    ), 0.0)

                bn.run_command("bpy.data.scenes['Scene'].frame_current = 7")
                self.assertEqual(
                    bn.run_command(
                        "return_value = bpy.data.materials['TestCell[0].soma[0]'].emit"
                    ), 2.0)
                self.assertEqual(
                    bn.run_command(
                        "return_value = bpy.data.materials['TestCell[1].soma[0]'].emit"
                    ), 0.0)