Example #1
0
    def __init__(self):
        logging.debug('Loading HNN')
        neuron_utils.createProject(name='HNN')
        import run

        self.t_vec = h.Vector()
        self.t_vec.record(h._ref_t)
        neuron_utils.createStateVariable(id='time',
                                         name='time',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.t_vec,
                                             "segment": None
                                         })

        neuron_geometries_utils.extractGeometries()

        logging.debug('HNN loaded')

        self.RunSimButton = neuron_utils.add_button('Run',
                                                    extraData={'commands': []})
        self.StopSimButton = neuron_utils.add_button(
            'Stop', extraData={'commands': []})
        self.SetParams = neuron_utils.add_button('Set Parameters')
        self.BasePanel = neuron_utils.add_panel(
            'HNN Control',
            items=[self.RunSimButton, self.StopSimButton, self.SetParams],
            widget_id='hnnBasePanel')
        self.BasePanel.on_close(self.close)
        self.BasePanel.display()
Example #2
0
    def __init__(self):
        logging.debug('Initializing Cell Builder')

        self.geometry = None
        self.segment = None
        section_diam_panel = neuron_utils.add_text_field_with_label(
            'Section Diam', None)
        section_length_panel = neuron_utils.add_text_field_with_label(
            'Section Length', None)

        segment_diam_panel = neuron_utils.add_text_field_with_label(
            'Segment Diam', None)

        # Get textfields from panels
        self.section_diam = section_diam_panel.items[1]
        self.section_length = section_length_panel.items[1]
        self.segment_diam = segment_diam_panel.items[1]
        self.save_button = neuron_utils.add_button('Save', self.modify_segment)

        self.cellBuilderPanel = neuron_utils.add_panel(
            'Cell Builder',
            items=[
                segment_diam_panel, section_diam_panel, section_length_panel,
                self.save_button
            ],
            widget_id='cellBuilderPanel',
            position_x=955,
            position_y=374,
            width=340,
            height=190)
        self.cellBuilderPanel.register_to_event(
            [GeppettoJupyterModelSync.events_controller._events['Select']],
            self.updateValues)
        self.cellBuilderPanel.on_close(self.close)
        self.cellBuilderPanel.display()
Example #3
0
    def __init__(self):
        logging.debug('Initializing Samples panel')
        self.items = []
        self.items.append(neuron_utils.add_button('Single compartment Hodgkin-Huxley',
                                                  self.loadModule, extraData={'module': 'verysimple_cell', 'model': 'VerySimpleCell'}))
        self.items.append(neuron_utils.add_button('Multi compartments Hodgkin-Huxley',
                                                  self.loadModule, extraData={'module': 'simple_cell', 'model': 'SimpleCell'}))
        #self.items.append(neuron_utils.add_button('Simple network', self.loadModule, extraData = {'module': 'simple_network', 'model':'SimpleNetwork'}))
        self.items.append(neuron_utils.add_button(
            'Ring network', self.loadModule, extraData={'module': 'ring', 'model': 'Ring'}))
        self.items.append(neuron_utils.add_button('CA3 Pyramidal', self.loadModule, extraData={
                          'module': 'CA3_pyramidal', 'model': 'CA3_pyramidal'}))
        self.items.append(neuron_utils.add_button(
            'PT Cell', self.loadModule, extraData={'module': 'PTcell', 'model': 'PTcell'}))

        self.loadModelPanel = neuron_utils.add_panel(
            'Sample NEURON Models', items=self.items, widget_id='loadModelPanel', position_x=108, position_y=125, width=287, properties={"closable":False})
        self.loadModelPanel.on_close(self.close)
        self.loadModelPanel.display()
Example #4
0
 def __init__(self):
     logging.debug('Initializing Analysis panel')
     self.analysis_button = neuron_utils.add_button('Plot',
                                                    self.run_analysis)
     self.analysis_panel = neuron_utils.add_panel(
         'Analysis',
         items=[self.analysis_button],
         widget_id='analysisPanel',
         position_x=90,
         position_y=250)
     self.analysis_panel.display()
Example #5
0
    def __init__(self):
        logging.debug('Initializing Point Process')

        # self.point_processes = None
        self.current_point_process = None

        drop_down_panel = neuron_utils.add_drop_down_with_label(
            'Current Clamps', [{
                'id': 'noSelection',
                'value': 'No segment selected'
            }])
        delay_panel = neuron_utils.add_text_field_with_label('Delay', None)
        duration_panel = neuron_utils.add_text_field_with_label(
            'Duration', None)
        amplitude_panel = neuron_utils.add_text_field_with_label(
            'Amplitude', None)
        i_panel = neuron_utils.add_text_field_with_label('i', None)
        self.drop_down = drop_down_panel.items[1]
        self.drop_down.on_change(self.update_drop_down_selection)
        self.delay = delay_panel.items[1]
        self.duration = duration_panel.items[1]
        self.amplitude = amplitude_panel.items[1]
        self.i = i_panel.items[1]
        self.save_button = neuron_utils.add_button('Save',
                                                   self.create_current_clamp)

        self.pointProcessPanel = neuron_utils.add_panel(
            'Point Process',
            items=[
                drop_down_panel, delay_panel, duration_panel, amplitude_panel,
                i_panel, self.save_button
            ],
            widget_id='pointProcessPanel',
            position_x=955,
            position_y=69,
            width=340,
            height=277)
        self.pointProcessPanel.register_to_event(
            [GeppettoJupyterModelSync.events_controller._events['Select']],
            self.updateValues)
        self.pointProcessPanel.on_close(self.close)
        self.pointProcessPanel.display()
Example #6
0
    def __init__(self):
        logging.debug('Initializing Run Control')
        self.initPanel = neuron_utils.add_text_field_and_button(
            "Init",
            'v_init',
            True,
            self.execute_neuron_command,
            extraData={'commands': ['h.stdinit()']})

        self.initRunButton = neuron_utils.add_button(
            'Init & Run',
            self.execute_neuron_command,
            extraData={
                'commands': [
                    'GeppettoJupyterModelSync.events_controller.triggerEvent("spin_logo")',
                    'GeppettoJupyterModelSync.current_experiment.status = "RUNNING"',
                    'h.run()',
                    'GeppettoJupyterModelSync.current_experiment.status = "COMPLETED"',
                    'import time;time.sleep(1.5);',
                    'GeppettoJupyterModelSync.events_controller.triggerEvent("experiment:doPlay")',
                    'GeppettoJupyterModelSync.events_controller.triggerEvent("stop_spin_logo")'
                ]
            })

        self.stopButton = neuron_utils.add_button('Stop')
        self.stopButton.on_click(['h.stoprun = 1'])

        self.continueTilPanel = neuron_utils.add_text_field_and_button(
            "Continue til",
            'runStopAt',
            True,
            self.execute_neuron_command,
            extraData={
                'commands': ['h.continuerun(runStopAt)', 'h.stoprun=1']
            })

        self.continueForPanel = neuron_utils.add_text_field_and_button(
            "Continue for",
            'runStopIn',
            True,
            self.execute_neuron_command,
            extraData={
                'commands': ['h.continuerun(t + runStopIn)', 'h.stoprun=1']
            })

        self.singleStepButton = neuron_utils.add_button(
            'Single Step',
            self.execute_neuron_command,
            extraData={
                'commands': [
                    'h.steprun()',
                    'GeppettoJupyterModelSync.events_controller.triggerEvent("experiment:doPlay")',
                    'GeppettoJupyterModelSync.events_controller.triggerEvent("experiment:update")'
                ]
            })

        self.timePanel = neuron_utils.add_text_field_and_button(
            "t",
            't',
            False,
            self.execute_neuron_command,
            extraData={'commands': []})

        self.stopPanel = neuron_utils.add_text_field_and_button(
            "Tstop",
            'tstop',
            True,
            self.execute_neuron_command,
            extraData={'commands': ['h.tstop_changed()']})

        self.dtPanel = neuron_utils.add_text_field_and_button(
            "dt",
            'dt',
            True,
            self.execute_neuron_command,
            extraData={'commands': ['h.setdt()']})

        self.pointsPlottedPanel = neuron_utils.add_text_field_and_button(
            "Points plotted/ms",
            'steps_per_ms',
            True,
            self.execute_neuron_command,
            extraData={'commands': ['h.setdt()']})

        self.scrnUpdateInvlPanel = neuron_utils.add_text_field_and_button(
            "Scrn update invl",
            'screen_update_invl',
            True,
            self.execute_neuron_command,
            extraData={'commands': []})

        self.realTimePanel = neuron_utils.add_text_field_and_button(
            "Real Time",
            'realtime',
            False,
            self.execute_neuron_command,
            extraData={'commands': []})

        self.runControlPanel = neuron_utils.add_panel(
            'Run Control',
            items=[
                self.initPanel, self.initRunButton, self.stopButton,
                self.continueTilPanel, self.continueForPanel,
                self.singleStepButton, self.timePanel, self.stopPanel,
                self.dtPanel, self.pointsPlottedPanel,
                self.scrnUpdateInvlPanel, self.realTimePanel
            ],
            widget_id='runControlPanel',
            position_x=700,
            position_y=150)
        self.runControlPanel.on_close(self.close)
        self.runControlPanel.display()