void  CoaBusinessObject::initialize()
{
   BEGIN;
   if (m_isInitialized == true) return;

   initWorkspace();
   createMainMenu();

   m_isInitialized = true;
   emit isInitialized();
}
Esempio n. 2
0
void Matrix::rotate90(bool clockwise)
{
	initWorkspace(numRows()*numCols());
	if (!d_workspace)
		return;

	if (clockwise)
		d_undo_stack->push(new MatrixSymmetryOperation(d_matrix_model, RotateClockwise, tr("Rotate 90°")));
	else
		d_undo_stack->push(new MatrixSymmetryOperation(d_matrix_model, RotateCounterClockwise, tr("Rotate -90°")));
}
void LogisticFit::init()
{
	setObjectName(tr("Logistic"));
    d_f = logistic_f;
    d_df = logistic_df;
	d_fdf = logistic_fdf;
	d_fsimplex = logistic_d;
	d_param_explain << tr("init value") << tr("final value") << tr("center") << tr("power");
	d_param_names << "A1" << "A2" << "x0" << "p";
	d_explanation = tr("Logistic Fit");
	d_formula = "A2+(A1-A2)/(1+(x/x0)^p))";
	d_p = 4;    
	initWorkspace(d_p);
}
Esempio n. 4
0
void GaussAmpFit::init()
{
	setObjectName(tr("GaussAmp"));
	d_f = gauss_f;
	d_df = gauss_df;
	d_fdf = gauss_fdf;
	d_fsimplex = gauss_d;
	d_p = 4;
    initWorkspace(d_p);
	d_param_explain << tr("offset") << tr("amplitude") << tr("center") << tr("width");
	d_param_names << "y0" << "A" << "xc" << "w";
	d_explanation = tr("GaussAmp Fit");
	d_formula = "y0+A*exp(-(x-xc)^2/(2*w^2))";
}
void ThreeExpFit::init()
{
	setObjectName(tr("ExpDecay3"));
	d_f = expd3_f;
	d_df = expd3_df;
	d_fdf = expd3_fdf;
	d_fsimplex = expd3_d;
	d_p = 7;
    initWorkspace(d_p);
	d_param_names << "A1" << "t1" << "A2" << "t2" << "A3" << "t3" << "y0";
	d_explanation = tr("Exponential decay");
	d_formula = "A1*exp(-x/t1)+A2*exp(-x/t2)+A3*exp(-x/t3)+y0";
	d_param_explain << tr("first amplitude") << tr("first lifetime") << tr("second amplitude") << tr("second lifetime") << tr("third amplitude") << tr("third lifetime") << tr("offset");
}
Esempio n. 6
0
File: app.cpp Progetto: speakman/qlc
void App::initView(void)
{
  initSettings();

  setIcon(QPixmap(QString(PIXMAPS) + QString("/Q.xpm")));

  initWorkspace();

  initMenuBar();
  initStatusBar();
  initToolBar();
  
  m_lastPath = QString(FIXTURES);
}
Esempio n. 7
0
File: app.cpp Progetto: speakman/qlc
void App::initView(void)
{
	setIcon(QPixmap(QString(PIXMAPS) + QString("/qlc-fixtureeditor.png")));

	initWorkspace();

	initMenuBar();
	initStatusBar();
	initToolBar();

	m_lastPath = QString(FIXTURES);

	resize(800, 600);
}
void PolynomialFit::setOrder(int order)
{
	d_order = order;
	d_p = d_order + 1;

	freeWorkspace();
	initWorkspace(d_p);

	d_formula = generateFormula(d_order);
	d_param_names = generateParameterList(d_order);

	d_param_explain.clear();
	for (int i=0; i<d_p; i++)
		d_param_explain << "";
}
Esempio n. 9
0
void MultiPeakFit::setNumPeaks(int n)
{
	d_peaks = n;
	if (d_profile == Gauss)
		d_explanation = tr("Gauss Fit");
	else
		d_explanation = tr("Lorentz Fit");
	if (d_peaks > 1)
		d_explanation += "(" + QString::number(d_peaks) +") " + tr("multi-peak");

	freeWorkspace();
	d_p = 3*d_peaks + 1;
	initWorkspace(d_p);

	d_param_names = generateParameterList(d_peaks);
	d_param_explain = generateExplanationList(d_peaks);
	d_formula = generateFormula(d_peaks, d_profile);
}
void ExponentialFit::init()
{
	d_f = exp_f;
	d_df = exp_df;
	d_fdf = exp_fdf;
	d_fsimplex = exp_d;
	d_p = 3;
	initWorkspace(d_p);

	d_param_names << "A" << "t" << "y0";

	if (is_exp_growth) {
		setObjectName(tr("ExpGrowth"));
		d_explanation = tr("Exponential growth");
		d_formula = "y0+A*exp(x/t)";
		d_param_explain << tr("amplitude") << tr("lifetime") << tr("offset");
	} else {
		setObjectName(tr("ExpDecay1"));
		d_explanation = tr("Exponential decay");
		d_formula = "y0+A*exp(-x/t)";
		d_param_explain << tr("amplitude") << tr("e-folding time") << tr("offset");
	}
}
Esempio n. 11
0
bool PluginFit::load(const QString& pluginName)
{
	if (!QFile::exists (pluginName)){
		QMessageBox::critical((ApplicationWindow *)parent(), tr("MantidPlot - File not found"),
				tr("Plugin file: <p><b> %1 </b> <p>not found. Operation aborted!").arg(pluginName));
		return false;
	}

	QLibrary lib(pluginName);
	lib.setAutoUnload(false);

	d_fsimplex = (fit_function_simplex) lib.resolve( "function_d" );
	if (!d_fsimplex){
		QMessageBox::critical((ApplicationWindow *)parent(), tr("MantidPlot - Plugin Error"),
				tr("The plugin does not implement a %1 method necessary for simplex fitting.").arg("function_d"));
		return false;
	}

	d_f = (fit_function) lib.resolve( "function_f" );
	if (!d_f){
		QMessageBox::critical((ApplicationWindow *)parent(), tr("MantidPlot - Plugin Error"),
				tr("The plugin does not implement a %1 method necessary for Levenberg-Marquardt fitting.").arg("function_f"));
		return false;
	}

	d_df = (fit_function_df) lib.resolve( "function_df" );
	if (!d_df){
		QMessageBox::critical((ApplicationWindow *)parent(), tr("MantidPlot - Plugin Error"),
				tr("The plugin does not implement a %1 method necessary for Levenberg-Marquardt fitting.").arg("function_df"));
		return false;
	}

	d_fdf = (fit_function_fdf) lib.resolve( "function_fdf" );
	if (!d_fdf){
		QMessageBox::critical((ApplicationWindow *)parent(), tr("MantidPlot - Plugin Error"),
				tr("The plugin does not implement a %1 method necessary for Levenberg-Marquardt fitting.").arg("function_fdf"));
		return false;
	}

	f_eval = (fitFunctionEval) lib.resolve("function_eval");
	if (!f_eval)
		return false;

	typedef char* (*fitFunc)();
	fitFunc fitFunction = (fitFunc) lib.resolve("parameters");
	if (fitFunction){
		d_param_names = QString(fitFunction()).split(",", QString::SkipEmptyParts);
		d_p = (int)d_param_names.count();
        initWorkspace(d_p);
	} else
		return false;

	fitFunc fitExplain = (fitFunc) lib.resolve("explanations");
	if (fitExplain)
		d_param_explain = QString(fitExplain()).split(",", QString::SkipEmptyParts);
	else
		for (int i=0; i<d_p; i++)
			d_param_explain << "";

	fitFunction = (fitFunc) lib.resolve( "name" );
	setObjectName(QString(fitFunction()));

	fitFunction = (fitFunc) lib.resolve( "function" );
	if (fitFunction)
		d_formula = QString(fitFunction());
	else
		return false;

	return true;
}
Esempio n. 12
0
File: app.cpp Progetto: speakman/qlc
//////////////////////////////////////////////////////////////////////
// Main initialization function                                     //
//                                                                  //
// This creates all items that are not saved in workspace files     //
//////////////////////////////////////////////////////////////////////
void App::init(QString openFile)
{
  //
  // Default size
  //
  resize(maximumSize());

  //
  // Settings has to be first
  //
  initSettings();

  //
  // Menus, toolbar, statusbar
  //
  initMenuBar();
  initStatusBar();
  initToolBar();

  //
  // The main view
  //
  initWorkspace();

  //
  // Plugins
  //
  initPlugins();

  //
  // Device classes
  //
  initDeviceClasses();

  //
  // Submasters & values
  //
  initSubmasters();
  initValues();

  //
  // Function consumer
  //
  initFunctionConsumer();

  //
  // Buses
  //
  Bus::init();

  //
  // Document
  //
  initDoc();

  //
  // Views
  //
  initDeviceManagerView();
  initVirtualConsole();


  // Trying to load workspace files
  // Either specified on command line or the last active workspace
  bool success = false;
  if (openFile != "")
    {
       success = doc()->loadWorkspaceAs(openFile);
       if (!success)
         {
            QString msg = "File: " + openFile + "\ncould'nt be opened. Please check path and spelling!\n";
	            msg += "We revert to the previously used workspace.";
	    QMessageBox::warning(this, KApplicationNameShort, msg,
			       QMessageBox::Ok, 0);
         }
    }
  //
  // Load the previous workspace
  //
  if (!success)
    {
      QString config;
      if (settings()->get(KEY_OPEN_LAST_WORKSPACE, config))
       {
         if (config == Settings::trueValue())
	  {
	    if (settings()->get(KEY_LAST_WORKSPACE_NAME, config))
	      {
	         success =  doc()->loadWorkspaceAs(config);
		 if (!success)
		   {
                      QString msg = "Previously used workspace file: " + config + "\ncould'nt be opened.";
	                      msg += "We start over with a new workspace.";
	              QMessageBox::warning(this, KApplicationNameShort, msg, QMessageBox::Ok, 0);
		   }
	      }
	  }
       }
    }
  if (!success)
    {
      newDocument();
    }
}