Exemple #1
0
def loadsimdat(name=None, getactmap=True):
    # load simulation data
    global totalDur, tstepPerAction
    name = getsimname(name)
    print('loading data from', name)
    conf.dconf = conf.readconf('backupcfg/' + name + 'sim.json')
    simConfig = pickle.load(open('data/' + name + 'simConfig.pkl', 'rb'))
    dstartidx = {
        p: simConfig['net']['pops'][p]['cellGids'][0]
        for p in simConfig['net']['pops'].keys()
    }  # starting indices for each population
    dendidx = {
        p: simConfig['net']['pops'][p]['cellGids'][-1]
        for p in simConfig['net']['pops'].keys()
    }  # ending indices for each population
    pdf = readinweights(name)
    actreward = pd.DataFrame(
        np.loadtxt('data/' + name + 'ActionsRewards.txt'),
        columns=['time', 'action', 'reward', 'proposed', 'hit'])
    dnumc = {
        p: dendidx[p] - dstartidx[p] + 1
        for p in simConfig['net']['pops'].keys()
    }
    spkID = np.array(simConfig['simData']['spkid'])
    spkT = np.array(simConfig['simData']['spkt'])
    dspkID, dspkT = {}, {}
    for pop in simConfig['net']['pops'].keys():
        dspkID[pop] = spkID[(spkID >= dstartidx[pop])
                            & (spkID <= dendidx[pop])]
        dspkT[pop] = spkT[(spkID >= dstartidx[pop]) & (spkID <= dendidx[pop])]
    InputImages = loadInputImages(dconf['sim']['name'])
    ldflow = loadMotionFields(dconf['sim']['name'])
    totalDur = int(dconf['sim']['duration'])
    tstepPerAction = dconf['sim'][
        'tstepPerAction']  # time step per action (in ms)
    dact = None
    lpop = ['ER', 'EV1', 'EV4', 'EMT', 'IR', 'IV1', 'IV4', 'IMT',\
            'EV1DW','EV1DNW', 'EV1DN', 'EV1DNE','EV1DE','EV1DSW', 'EV1DS', 'EV1DSE',\
            'EMDOWN','EMUP']
    if getactmap: dact = getdActMap(totalDur, tstepPerAction, lpop)
    return simConfig, pdf, actreward, dstartidx, dendidx, dnumc, dspkID, dspkT, InputImages, ldflow, dact
Exemple #2
0
import fileio as fio
import paramrw as paramrw
from paramrw import usingOngoingInputs
import plotfn as plotfn
import specfn as specfn
import pickle
from dipolefn import Dipole
from conf import readconf
from L5_pyramidal import L5Pyr
from L2_pyramidal import L2Pyr
from L2_basket import L2Basket
from L5_basket import L5Basket
from lfp import LFPElectrode
from morphology import shapeplot, getshapecoords

dconf = readconf()

# data directory - ./data
dproj = dconf['datdir']  # fio.return_data_dir(dconf['datdir'])
debug = dconf['debug']
pc = h.ParallelContext()
pcID = int(pc.id())
f_psim = ''
ntrial = 1
testLFP = dconf['testlfp']
testlaminarLFP = dconf['testlaminarlfp']
lelec = []  # list of LFP electrodes

# reads the specified param file
foundprm = False
for i in range(len(sys.argv)):
from elasticsearch import Elasticsearch
import json
import sys
from datetime import datetime
from dateutil import tz
from dateutil import parser
import conf

conf.readconf()
ip = conf.settings.ip
port = int(conf.settings.port)
folder = conf.settings.folder

indexname = sys.argv[1]
starttime = sys.argv[2]
endtime = sys.argv[3]

from_zone = tz.tzutc()
to_zone = tz.tzlocal()

starttime = '2018-09-16T00:28:18.097Z'
endtime = '2018-09-16T23:54:18.097Z'

start = datetime.strptime(starttime, '%Y-%m-%dT%H:%M:%S.%fZ')
end = datetime.strptime(endtime, '%Y-%m-%dT%H:%M:%S.%fZ')
start = start.replace(tzinfo=to_zone)
end = end.replace(tzinfo=to_zone)

es = Elasticsearch([{'host': ip, 'port': port}])
score = 0
# TODO: Make the path in the function to lowercase so it wouldnt matter..