#run population simulation and collect the data
    pop.run()
    pop.collect_data()

    #object no longer needed
    del pop


####### Postprocess the simulation output ######################################


#reset seed, but output should be deterministic from now on
np.random.seed(SIMULATIONSEED)

#do some postprocessing on the collected data, i.e., superposition
#of population LFPs, CSDs etc
postproc = PostProcess(y = params.y,
                       dt_output = params.dt_output,
                       savefolder = params.savefolder,
                       mapping_Yy = params.mapping_Yy,
                       )

#run through the procedure
postproc.run()

#create tar-archive with output for plotting
postproc.create_tar_archive()

#tic toc
print 'Execution time: %.3f seconds' %  (time() - tic)
    #run population simulation and collect the data
    pop.run()
    pop.collect_data()

    #object no longer needed
    del pop


####### Postprocess the simulation output ######################################


#reset seed, but output should be deterministic from now on
np.random.seed(SIMULATIONSEED)

#do some postprocessing on the collected data, i.e., superposition
#of population LFPs, CSDs etc
postproc = PostProcess(y = params.y,
                       dt_output = params.dt_output,
                       savefolder = params.savefolder,
                       mapping_Yy = params.mapping_Yy,
                       )

#run through the procedure
postproc.run()

#create tar-archive with output for plotting
postproc.create_tar_archive()

#tic toc
print 'Execution time: %.3f seconds' %  (time() - tic)

####### Postprocess the simulation output ######################################


#reset seed, but output should be deterministic from now on
np.random.seed(SIMULATIONSEED)

if properrun:
    #do some postprocessing on the collected data, i.e., superposition
    #of population LFPs, CSDs etc
    postproc = PostProcess(y = PS.X,
                           dt_output = PS.dt_output,
                           savefolder = PS.savefolder,
                           mapping_Yy = PS.mapping_Yy,
                           savelist = PS.savelist,
                           cells_subfolder = os.path.split(PS.cells_path)[-1],
                           populations_subfolder = os.path.split(PS.populations_path)[-1],
                           figures_subfolder = os.path.split(PS.figures_path)[-1]
                           )
    
    #run through the procedure
    postproc.run()
    
    #create tar-archive with output for plotting, ssh-ing etc.
    postproc.create_tar_archive()
    
    
COMM.Barrier()

#tic toc
        #object no longer needed
        del pop


    ####### Postprocess the simulation output ######################################

    #reset seed, but output should be deterministic from now on
    np.random.seed(SIMULATIONSEED)

    #do some postprocessing on the collected data, i.e., superposition
    #of population LFPs, CSDs etc
    postproc = PostProcess(y = PSET['X'],
                           dt_output = PSET['dt_output'],
                           savefolder = output_path,
                           mapping_Yy = PSET['mapping_Yy'],
                           savelist = PSET['pp_savelist'],
                           cells_subfolder = os.path.split(cell_path)[-1],
                           populations_subfolder = os.path.split(population_path)[-1],
                           figures_subfolder = os.path.split(figure_path)[-1],
                           compound_file = '{}_{}sum.h5'.format('kernel', 'LFP')
                           )

    #run through the procedure
    postproc.run()

    COMM.Barrier()

    ## get LFP output and create kernel to be used for LFP predictions
    if RANK == 0:
        with h5py.File(os.path.join(output_path, 'kernel_LFPsum.h5'), 'r') as f:
            lfp = f['data'][()]