예제 #1
0
t_noflow = 10 # in sec
t_flow = 50 # in sec

binsize = 0.1
current = 8 # in cm/s.


n_animals = 100

# generate data
track_data = {}
track_data['no_ll'] = []
for k in range(0, n_animals):
    ipos = np.array([np.random.uniform(0,.68, 1), np.random.uniform(0,.15,1), np.random.uniform(0,.15,1)]).flatten()
    data = wlk.randwalk(t_noflow, binsize, 0, ipos, latline = False, flow_version = FLOW_DYNAMICS)
    data = wlk.randwalk(t_flow, binsize, current, data, latline = False, flow_version = FLOW_DYNAMICS)
    data['track'] = data['track'] * 100
    track_data['no_ll'].append(data)

track_data['ll'] = []
for k in range(0, n_animals):
    ipos = np.array([np.random.uniform(0,.68, 1), np.random.uniform(0,.15,1), np.random.uniform(0,.15,1)]).flatten()
    data = wlk.randwalk(t_noflow, binsize, 0, ipos, latline = True, flow_version = FLOW_DYNAMICS)
    data = wlk.randwalk(t_flow, binsize, current, data, latline = True, flow_version = FLOW_DYNAMICS)
    data['track'] = data['track'] * 100
    track_data['ll'].append(data)

flow = np.ones(track_data['no_ll'][0]['track'].shape[0],'int') * current
flow[0: (float(t_noflow)/ binsize)] = 0
예제 #2
0
                'lateral_line':np.zeros((TIME/binsize*numfrog)),
                'state':np.zeros((TIME/binsize*numfrog))
                }

    frogData_F = {'time': np.zeros((TIME/binsize*numfrog)),
                'track': np.zeros((TIME/binsize*numfrog,3)),
                'velocity':np.zeros((TIME/binsize*numfrog,3)),
                'orientation':np.zeros((TIME/binsize*numfrog)),
                'lateral_line':np.zeros((TIME/binsize*numfrog)),
                'state':np.zeros((TIME/binsize*numfrog))
                }
    
    for j in range(0,numfrog):
        
        #(SIMLENGTH,BINSIZE,FLOW_SPEED,IPOS,LATLINE,VERSION)  - Version refers to flow dynamics.
        run_data_NF = wlk.randwalk(TIME,binsize,0, np.array([0.34, 0.075, 0.15]),latline = LATLINE,flow_version = FLOW_DYNAMICS)

        # there is likely a more elegant way to pack these data up.
        frogData_NF['time'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_NF['time']
        frogData_NF['track'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_NF['track']
        frogData_NF['velocity'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_NF['velocity']
        frogData_NF['orientation'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_NF['orientation']
        frogData_NF['lateral_line'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_NF['lateral_line']
        frogData_NF['state'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_NF['state']

        frogEndPoint = frogData_NF['track'][-1:,:]
        run_data_F = wlk.randwalk(TIME,binsize, FLOWSPEED, frogEndPoint,latline = LATLINE,flow_version = FLOW_DYNAMICS)

        
        frogData_F['time'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_F['time']
        frogData_F['track'][(j+1)*froglen-froglen:(j+1)*froglen] = run_data_F['track']
예제 #3
0
    frog1_F = frog1_F[index]
    frog1_F = frog1_F[0::DOWNSAMPLE_RATE]

    # reset the simulation length to reflect data
    t_flow = len(frog1_F)*binsize*DOWNSAMPLE_RATE

    # Append data into one structure:
    frog1 = np.append(frog1_NF,frog1_F,axis=0)
    frog1 = {'track': frog1,
             'state': None}
    
    FROG1NAME = 'Observed Data'
else:   
    # generate all data w/ lateral line switched off
    LATLINE = False
    frog1 = wlk.randwalk(t_noflow, binsize, 0, np.array([0.37, 0.075, 0.15]), latline = LATLINE, flow_version = FLOW_DYNAMICS)
    frog1 = wlk.randwalk(t_flow, binsize, current, frog1,latline = LATLINE, flow_version = FLOW_DYNAMICS)
    frog1['track'] = frog1['track']*100
    FROG1NAME = 'NO Lateral Line Model'
    # downsample
    for data in frog1:
        frog1[data] = frog1[data][0::DOWNSAMPLE_RATE]
    
# generate all data w/ lateral line switched on - First compute at high resolution before downsampling
LATLINE = True
frog2 = wlk.randwalk(t_noflow, binsize, 0, np.array([0.34, 0.075, 0.15]), latline = LATLINE, flow_version = FLOW_DYNAMICS)
frog2 = wlk.randwalk(t_flow, binsize, current, frog2,latline = LATLINE, flow_version = FLOW_DYNAMICS)
frog2['track'] = frog2['track']*100

state_colors = ['blue', 'black', 'red']