@files(params) def score_frame_queue( (dataset_dir, dataset_config_filename, frame_hist_filename), (outfile_wait, outfile_npz), dataset_name, frame, likelihood_i): np.random.seed(0) dataset_dir = os.path.join(FL_DATA, dataset_name) cf = pickle.load(open(dataset_config_filename)) led_params = pickle.load( open(os.path.join(dataset_dir, "led.params.pickle"))) EO = measure.led_params_to_EO(cf, led_params) x_range = np.linspace(0, cf['field_dim_m'][1], X_GRID_NUM) y_range = np.linspace(0, cf['field_dim_m'][0], Y_GRID_NUM) phi_range = np.linspace(0, 2 * np.pi, PHI_GRID_NUM) degrees_from_vertical = 30 radian_range = degrees_from_vertical / 180. * np.pi theta_range = np.linspace(np.pi / 2. - radian_range, np.pi / 2. + radian_range, THETA_GRID_NUM) sv = create_state_vect(y_range, x_range, phi_range, theta_range) # now the input args chunk_size = 80000 chunks = int(np.ceil(len(sv) / float(chunk_size)))
@files(params) def det_run((epoch_dir, epoch_config_filename, region_filename, led_params_filename), outfile, epoch, frame_start, frame_end): np.random.seed(0) cf = pickle.load(open(epoch_config_filename, 'r')) region = pickle.load(open(region_filename, 'r')) env = util.Environmentz(cf['field_dim_m'], cf['frame_dim_pix']) led_params = pickle.load(open(led_params_filename, 'r')) eo_params = measure.led_params_to_EO(cf, led_params) if frame_end > cf['end_f']: frame_end = cf['end_f'] truth = np.load(os.path.join(epoch_dir, 'positions.npy')) truth_interp, missing = measure.interpolate(truth) derived_truth = measure.compute_derived(truth_interp, T_DELTA) frame_pos = np.arange(frame_start, frame_end) # load frames frames = organizedata.get_frames(epoch_dir, frame_pos) FRAMEN = len(frames)
def pf_run((epoch_dir, epoch_config_filename, region_filename, led_params_filename), outfile, epoch, (config_name, config_params), posnoise, velnoise, pix_threshold, PARTICLEN, frame_start, frame_end, diode_scale): np.random.seed(0) cf = pickle.load(open(epoch_config_filename, 'r')) region = pickle.load(open(region_filename, 'r')) env = util.Environmentz(cf['field_dim_m'], cf['frame_dim_pix']) led_params = pickle.load(open(led_params_filename, 'r')) eoparams = enlarge_sep(measure.led_params_to_EO(cf, led_params), amount = diode_scale, front_amount = diode_scale, back_amount = diode_scale) #print "EO PARAMS ARE", eoparams tr = TemplateObj(0.8, 0.4) tr.set_params(*eoparams) le1 = likelihood.LikelihoodEvaluator2(env, tr, similarity='dist', likeli_params = config_params) model_inst = model.CustomModel(env, le1, POS_NOISE_STD=posnoise, VELOCITY_NOISE_STD=velnoise) frame_pos = np.arange(frame_start, frame_end)
@files(params) def pf_run((epoch_dir, epoch_config_filename, region_filename, led_params_filename), outfile, epoch, (config_name, config_params), posnoise, velnoise, pix_threshold, PARTICLEN, frame_start, frame_end, diode_scale): np.random.seed(0) cf = pickle.load(open(epoch_config_filename, 'r')) region = pickle.load(open(region_filename, 'r')) env = util.Environmentz(cf['field_dim_m'], cf['frame_dim_pix']) led_params = pickle.load(open(led_params_filename, 'r')) eoparams = enlarge_sep(measure.led_params_to_EO(cf, led_params), amount=diode_scale, front_amount=diode_scale, back_amount=diode_scale) #print "EO PARAMS ARE", eoparams tr = TemplateObj(0.8, 0.4) tr.set_params(*eoparams) le1 = likelihood.LikelihoodEvaluator2(env, tr, similarity='dist', likeli_params=config_params) model_inst = model.CustomModel(env, le1,
yield (infiles, outfiles, epoch, frame, likelihood_i) @files(params) def score_frame_queue((dataset_dir, dataset_config_filename, frame_hist_filename), (outfile_wait, outfile_npz), dataset_name, frame, likelihood_i): np.random.seed(0) dataset_dir = os.path.join(FL_DATA, dataset_name) cf = pickle.load(open(dataset_config_filename)) led_params = pickle.load(open(os.path.join(dataset_dir, "led.params.pickle"))) EO = measure.led_params_to_EO(cf, led_params) x_range = np.linspace(0, cf['field_dim_m'][1], X_GRID_NUM) y_range = np.linspace(0, cf['field_dim_m'][0], Y_GRID_NUM) phi_range = np.linspace(0, 2*np.pi, PHI_GRID_NUM) degrees_from_vertical = 30 radian_range = degrees_from_vertical/180. * np.pi theta_range = np.linspace(np.pi/2.-radian_range, np.pi/2. + radian_range, THETA_GRID_NUM) sv = create_state_vect(y_range, x_range, phi_range, theta_range) # now the input args chunk_size = 80000 chunks = int(np.ceil(len(sv) / float(chunk_size)))
if pos > MAX: return @files(params) def det_run((epoch_dir, epoch_config_filename, region_filename, led_params_filename), outfile, epoch, frame_start, frame_end): np.random.seed(0) cf = pickle.load(open(epoch_config_filename, 'r')) region = pickle.load(open(region_filename, 'r')) env = util.Environmentz(cf['field_dim_m'], cf['frame_dim_pix']) led_params = pickle.load(open(led_params_filename, 'r')) eo_params = measure.led_params_to_EO(cf, led_params) if frame_end > cf['end_f']: frame_end = cf['end_f'] truth = np.load(os.path.join(epoch_dir, 'positions.npy')) truth_interp, missing = measure.interpolate(truth) derived_truth = measure.compute_derived(truth_interp, T_DELTA) frame_pos = np.arange(frame_start, frame_end) # load frames frames = organizedata.get_frames(epoch_dir, frame_pos) FRAMEN = len(frames) coordinates = []