예제 #1
0
  SceneObject::SceneObject(const std::string name, const std::string modelPath,
			   const int numFrames,
			   const std::string boundingBoxSetPath) :
    offset(0,0,0), rotation(0,0,0), boundingBoxSet(boundingBoxSetPath) {
    
    initLogger();
    this->name = name;
    animating = false;
    framesWaited = 0;
    frameDelay = 1;
    currentFrame = 0;
    this->numFrames = numFrames;

    if (numFrames > 1) {
      LOGINFO("Loading " + name + " animated model (this may take a while):");
      for (int idx = 0; idx < numFrames; ++idx) {
        std::stringstream lss;
        lss << "Frame " << idx + 1 << " of " << numFrames << "...";
        LOGINFO(lss.str());
        std::stringstream ss;
        ss << std::setfill('0') << std::setw(6) << idx + 1;
        std::string frameNum = ss.str();
        Model model1(modelPath + "_" + frameNum + ".obj");
        model.push_back(model1);
      }
    }
    else {
      Model model1(modelPath);
      model.push_back(model1);
    }
  }
예제 #2
0
void abcAncError::print(funkyPars *pars){

  if(doAncError==0)
    return;

  ///  if(doAncError==2){
  // model2(pars);
  //} else if(doAncError==1) {
    


  model1(pars);
  if(currentChr==-1)
    currentChr=pars->refId;
  if(currentChr!=pars->refId){
    fprintf(outfile2,"Chr: \t %s\n",header->target_name[currentChr]);
    for(int i=0;i<nInd;i++){
      for(int j=0;j<125;j++)
	fprintf(outfile2,"%lu\t",alleleCountsChr[i][j]);
      fprintf(outfile2,"\n");
    }
    for(int i=0;i<nInd;i++)
      for(int j=0;j<256;j++)
	alleleCountsChr[i][j]=0;
    currentChr=pars->refId;
  }
    //}
   
}
예제 #3
0
int main()
{
	tc_matrix efm, output, params;
	copasi_model m1, m2;
	
	m1 = model1();
    //m1 = cReadSBMLFile("model1.sbml");
    
	output = cSimulateDeterministic(m1, 0, 10, 100);  //model, start, end, num. points
	printf("rows = %i\n",output.rows);
	tc_printMatrixToFile("output.tab", output);
	tc_deleteMatrix(output);
	//printf("%s\n",m1.errorMessage);
	/*params = tc_createMatrix(3,3);
	tc_setRowName(params,0,"k1");
	tc_setRowName(params,1,"k2");
	tc_setRowName(params,2,"k3");
	tc_setMatrixValue(params, 0, 0, 1);
	tc_setMatrixValue(params, 0, 1, 0.0);
	tc_setMatrixValue(params, 0, 2, 5.0);
	tc_setMatrixValue(params, 1, 0, 1);
	tc_setMatrixValue(params, 1, 1, 0.0);
	tc_setMatrixValue(params, 1, 2, 5.0);
	tc_setMatrixValue(params, 2, 0, 1);
	tc_setMatrixValue(params, 2, 1, 0.0);
	tc_setMatrixValue(params, 2, 2, 5.0);
	
	cSetValue(m1,"k1",2.0);
	cSetValue(m1,"k2",1.0);
	cSetValue(m1,"k3",1.0);*/
	
	//cSetOptimizerIterations(10);
	//output = cOptimize(m1, "output.tab", params);
	//tc_printMatrixToFile("params.out", output);
	//tc_deleteMatrix(output);

	//cleanup	
	cRemoveModel(m1);
	copasi_end();
	return 0;
}
예제 #4
0
void MultiMinTest::testChol2D() {
	valarray<double> data(0.5 , 2);
	valarray<bool> mask(true, 2);
	valarray<double> weights(1.0, 2);
	valarray<double> model1(2);
	valarray<double> model2(2);

	model1[0] = 0.0;
	model1[1] = 1.0;
	model2[0] = 1.0;
	model2[1] = 0.0;

	valarray<double> c(2);
	valarray<double> b(2);
	valarray<valarray<double> > a(b, 2);

	MultiMin::chol2D(c, b, a, data, 0, 2, mask, weights, model1, model2);

	CPPUNIT_ASSERT(c[0] == 0.5);
	CPPUNIT_ASSERT(c[1] == 0.5);
}
예제 #5
0
파일: model.cpp 프로젝트: ALPSCore/ALPSCore
TEST(var1_test, same)
{
    Eigen::VectorXd phi0(2), veps_one(2), veps_two(2);
    Eigen::MatrixXd phi1(2,2);
    phi0 << 2, 3;
    phi1 << .90, 0, 0, .30;
    veps_one << 1.0, 0.25;
    veps_two << 2.0, 3.25;

    alps::alea::util::var1_model<double> model1(phi0, phi1, veps_one);
    alps::alea::util::var1_model<double> model2(phi0, phi1, veps_two);

    std::cerr << "EXACT MEAN=" << model1.mean().transpose() << "\n";

    alps::alea::autocorr_acc<double> acc1(2), acc2(2);
    fill(model1, acc1, 400000);
    fill(model2, acc2, 400000);

    alps::alea::autocorr_result<double> res1 = acc1.finalize();
    print_result(std::cerr, res1);

    alps::alea::autocorr_result<double> res2 = acc2.finalize();
    print_result(std::cerr, res2);

    // perform T2 test manually
    alps::alea::var_result<double> diff = alps::alea::internal::pool_var(res1, res2);
    print_result(std::cerr, diff);
    alps::alea::t2_result t2 = alps::alea::t2_test(diff.mean(), diff.var(),
                                                   diff.observations(), 1, 1e-10);
    print_t2(std::cerr, t2);
    ASSERT_GE(t2.pvalue(), 0.01);

    // Perform T2 test automatically
    t2 = alps::alea::test_mean(res1, res2);
    ASSERT_GE(t2.pvalue(), 0.01);
}