예제 #1
0
def _get_te(blocks):
    task_entries = []
    for block in blocks:
        if np.iterable(block):
            task_entries.append(CombinedTaskEntry(block))
        else:
            task_entries.append(performance._get_te(block))

    return task_entries
예제 #2
0
def test_block(idx, n_iter=None):
    te = performance._get_te(idx)
    if n_iter == None:
        n_iter = len(te.hdf.root.task)
        
    gen = genfns.sim_target_seq_generator_multi(8, 1000)
    task = tasks.BMIReconstruction(te, n_iter, gen)
    task.init()
        
    error = task.calc_recon_error(verbose=False)
    abs_max_error = np.max(np.abs(error))
    return abs_max_error
def test_block(idx, n_iter=None):
    te = performance._get_te(idx)
    if n_iter == None:
        n_iter = len(te.hdf.root.task)
        
    gen = genfns.sim_target_seq_generator_multi(8, 1000)
    task = tasks.BMIReconstruction(te, n_iter, gen)
    task.init()
        
    error = task.calc_recon_error(verbose=False)
    abs_max_error = np.max(np.abs(error))
    return abs_max_error
예제 #4
0
 def fn(task_entry_model):
     te = performance._get_te(task_entry_model)
     try:
         return te.n_trials >= min_trial_count
     except:
         return False
예제 #5
0
 def _check_decoder(task_entry_model):
     te = performance._get_te(task_entry_model)
     try:
         return (decoder_type in str(te.decoder_type))
     except:
         return False
예제 #6
0
from tasks import performance
import matplotlib.pyplot as plt
from riglib.bmi import robot_arms, assist, train, goal_calculators
from riglib.stereo_opengl import ik
import time

from riglib import mp_calc
reload(mp_calc)

reload(assist)
reload(robot_arms)
reload(goal_calculators)

pi = np.pi

te = performance._get_te(3086)
target = te.hdf.root.task[:]['target']

starting_pos_ws = np.array([5., 0, 5])
shoulder_anchor = np.array([2, 0, -15])

# Generate the list of targets
from tasks import generatorfunctions
target_list = generatorfunctions.centerout_2D_discrete(nblocks=1, ntargets=2)
target_list = target_list.reshape(-1, 3)

n_targets = target_list.shape[0]

# Initialize the kinematic chain
chain = robot_arms.PlanarXZKinematicChain([15, 15, 5, 5])
chain.joint_limits = [(-pi, pi), (-pi, 0), (-pi / 2, pi / 2),
#!/usr/bin/python
'''
Test that the content of the npz file is the same as what is stored in the HDF file
'''
from db import dbfunctions as dbfn
from db.tracker import models
from tasks import performance
import plotutil
import tables
import numpy as np

te = performance._get_te(2440)
print te
te.clda_param_hist
error = np.zeros(len(te.clda_param_hist))

for k, update in enumerate(te.clda_param_hist):
    if update is not None:
        print k
        error[k] = np.max(
            np.abs(te.hdf.root.clda[k]['filt_C'] - update['filt.C']))
print np.max(np.abs(error))
#!/usr/bin/python
'''
Test that the content of the npz file is the same as what is stored in the HDF file
'''
from db import dbfunctions as dbfn
from db.tracker import models
from tasks import performance
import plotutil
import tables
import numpy as np

te = performance._get_te(2440)
print te
te.clda_param_hist;
error = np.zeros(len(te.clda_param_hist))

for k, update in enumerate(te.clda_param_hist):
    if update is not None:
        print k
        error[k] = np.max(np.abs(te.hdf.root.clda[k]['filt_C'] - update['filt.C']))
print np.max(np.abs(error))
#!/usr/bin/python
from db import dbfunctions as dbfn
reload(dbfn)

from tasks import bmimultitasks, performance
import numpy as np

from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--idx", dest="idx", type="int", help="block index to run verification", default=2298)
(options, args) = parser.parse_args()
idx = options.idx

te = performance._get_te(idx)
print te
hdf = te.hdf
dec = te.decoder
bmi_params = te.clda_param_hist

assist_level = hdf.root.task[:]['assist_level'].ravel()
spike_counts = hdf.root.task[:]['spike_counts']
target = hdf.root.task[:]['target']
cursor = hdf.root.task[:]['cursor']

task_msgs = hdf.root.task_msgs[:]
update_bmi_msgs = filter(lambda x: x['msg'] == 'update_bmi', task_msgs)
inds = [x[1] for x in update_bmi_msgs]

T = spike_counts.shape[0]
error = np.zeros(T)
from tasks import performance
import matplotlib.pyplot as plt
from riglib.bmi import robot_arms, assist, train, goal_calculators
from riglib.stereo_opengl import ik
import time

from riglib import mp_calc
reload(mp_calc)

reload(assist)
reload(robot_arms)
reload(goal_calculators)

pi = np.pi

te = performance._get_te(3086)
target = te.hdf.root.task[:]['target']

starting_pos_ws = np.array([5., 0, 5])
shoulder_anchor = np.array([2, 0, -15])

# Generate the list of targets
from tasks import generatorfunctions
target_list = generatorfunctions.centerout_2D_discrete(nblocks=1, ntargets=2)
target_list = target_list.reshape(-1, 3)

n_targets = target_list.shape[0]

# Initialize the kinematic chain
chain = robot_arms.PlanarXZKinematicChain([15, 15, 5, 5])
chain.joint_limits = [(-pi, pi), (-pi, 0), (-pi/2, pi/2), (-pi/2, 10*pi/180)]