Esempio n. 1
0
    if args.align_algo in ['pica', 'ppca']:
        new_niter_lh = new_niter_rh = 10
    #elif args.align_algo in ['ha_sm_retraction','ha_syn','ha_syn_noagg']:
    #  new_niter_lh = new_niter_rh = 0

    # load transformation matrices
    if args.align_algo != 'noalign':
        workspace_lh = np.load(options['working_path'] + args.align_algo +
                               '_lh_' + str(new_niter_lh) + '.npz')
        workspace_rh = np.load(options['working_path'] + args.align_algo +
                               '_rh_' + str(new_niter_rh) + '.npz')
        # load transformation matrices into transform_lrh for projecting testing data
        if args.loo == None:
            (transform_lh,
             transform_rh) = form_transformation_matrix.transform(
                 args, workspace_lh, workspace_rh, nsubjs)
        else:
            (transform_lh,
             transform_rh) = form_transformation_matrix_loo.transform(
                 args, workspace_lh, workspace_rh, align_data_lh,
                 align_data_rh, nsubjs)
    else:
        new_niter_lh = new_niter_rh = 10
        (transform_lh,
         transform_rh) = form_transformation_matrix_noalign.transform(
             args, nsubjs)

    # transformed mkdg data with learned transformation matrices
    transformed_data = np.zeros((args.nfeature * 2, nTR_pred, nsubjs))

    for m in range(nsubjs):
Esempio n. 2
0
    if args.loo == None:
      new_niter = algo.align(align_data, options, args, '')
    else:
      new_niter = algo.align(align_data_loo, options, args, '')
    # make sure right and left brain alignment are working at the same iterations

  if args.align_algo in ['pica','ppca']:
    new_niter = 10

  # load transformation matrices
  if args.align_algo != 'noalign' :
    workspace = np.load(options['working_path']+args.align_algo+'__'+str(new_niter)+'.npz')
    workspace2 = np.load(options['working_path']+args.align_algo+'__'+str(new_niter)+'.npz')
    # load transformation matrices into transform_lrh for projecting testing data
    if args.loo == None:
      (transform, tmp) = form_transformation_matrix.transform(args,
                                     workspace, workspace2, nsubjs)
    else:
      (transform, tmp) = form_transformation_matrix_loo.transform(args,
                                     workspace, workspace2,
                                     align_data, copy.deepcopy(align_data), nsubjs)
    workspace.close()
    workspace2.close()
  else:
    new_niter = 10
    (transform, tmp) = form_transformation_matrix_noalign.transform(args, nsubjs)


  # transformed mkdg data with learned transformation matrices
  transformed_data = np.zeros((args.nfeature , nTR_pred ,nsubjs))

  for m in range(nsubjs):
Esempio n. 3
0
      new_niter_lh = algo.align(align_data_lh_loo, options, args, 'lh')
      new_niter_rh = algo.align(align_data_rh_loo, options, args, 'rh')
    # make sure right and left brain alignment are working at the same iterations
    assert new_niter_lh == new_niter_rh


  if args.align_algo in ['pica','ppca']:
    new_niter_lh = new_niter_rh = 10

  # load transformation matrices
  if args.align_algo != 'noalign' :
    workspace_lh = np.load(options['working_path']+args.align_algo+'_lh_'+str(new_niter_lh)+'.npz')
    workspace_rh = np.load(options['working_path']+args.align_algo+'_rh_'+str(new_niter_rh)+'.npz')
    # load transformation matrices into transform_lrh for projecting testing data
    if args.loo == None:
      (transform_lh, transform_rh) = form_transformation_matrix.transform(args, 
                                     workspace_lh, workspace_rh, nsubjs)
    else:
      (transform_lh, transform_rh) = form_transformation_matrix_loo.transform(args, 
                                     workspace_lh, workspace_rh, 
                                     align_data_lh, align_data_rh, nsubjs)
  else:
    new_niter_lh = new_niter_rh = 10
    (transform_lh, transform_rh)=form_transformation_matrix_noalign.transform(args,nsubjs)

  # transformed mkdg data with learned transformation matrices
  transformed_data = np.zeros((args.nfeature*2 , nTR_pred ,nsubjs))

  for m in range(nsubjs):
    trfed_lh_tmp = transform_lh[:,:,m].T.dot(pred_data_lh[:,:,m])
    trfed_rh_tmp = transform_rh[:,:,m].T.dot(pred_data_rh[:,:,m])
    transformed_data[:,:,m] = stats.zscore( np.vstack((trfed_lh_tmp,trfed_rh_tmp)).T ,axis=0, ddof=1).T