set up simple cell simulation with LFPs in the plane

def run_sim(morphology='patdemo/cells/j4a.hoc',
            cell_rotation=dict(x=4.99, y=-4.33, z=3.14),
            closest_idx=dict(x=-200., y=0., z=800.)):
    '''set up simple cell simulation with LFPs in the plane'''

    # Create cell
    cell = LFPy.Cell(morphology=morphology, **cell_parameters)
    # Align cell
    cell.set_rotation(**cell_rotation)
    
    # Define synapse parameters
    synapse_parameters = {
        'idx' : cell.get_closest_idx(**closest_idx),
        'e' : 0.,                   # reversal potential
        'syntype' : 'ExpSynI',       # synapse type
        'tau' : 0.5,                 # synaptic time constant
        'weight' : 0.0878,            # synaptic weight
        'record_current' : True,    # record synapse current
    }
    
    # Create synapse and set time of synaptic input
    synapse = LFPy.Synapse(cell, **synapse_parameters)
    synapse.set_spike_times(np.array([1.]))

    
    # Create electrode object
    
    # Run simulation, electrode object argument in cell.simulate
    print "running simulation..."
    cell.simulate(rec_imem=True,rec_isyn=True)
    
    grid_electrode = LFPy.RecExtElectrode(cell,**grid_electrode_parameters)
    point_electrode = LFPy.RecExtElectrode(cell,**point_electrode_parameters)
    
    grid_electrode.calc_lfp()
    point_electrode.calc_lfp()
    
    print "done"
    
    return cell, synapse, grid_electrode, point_electrode