예제 #1
0
 public NonlinearFitDocument(NonlinearFitDocument from)
 {
     _fitEnsemble          = null == from._fitEnsemble ? null : (FitEnsemble)from._fitEnsemble.Clone();
     _fitEnsemble.Changed += new EventHandler(EhFitEnsemble_Changed);
     _currentParameters    = null == from._currentParameters ? null : (ParameterSet)from._currentParameters.Clone();
     // Note that the fit context is not cloned here.
 }
 public NonlinearFitDocument(NonlinearFitDocument from)
 {
   _fitEnsemble = null == from._fitEnsemble ? null : (FitEnsemble)from._fitEnsemble.Clone();
   _fitEnsemble.Changed += new EventHandler(EhFitEnsemble_Changed);
   _currentParameters = null == from._currentParameters ? null : (ParameterSet)from._currentParameters.Clone();
   // Note that the fit context is not cloned here.
 }
예제 #3
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                NonlinearFitDocument s = (NonlinearFitDocument)obj;

                info.AddValue("FitEnsemble", s._fitEnsemble);
                info.AddValue("Parameters", s._currentParameters);
            }
예제 #4
0
        public NonlinearFitDocument(NonlinearFitDocument from)
        {
            _fitEnsemble = null == from._fitEnsemble ? null : (FitEnsemble)from._fitEnsemble.Clone();
            _fitEnsemble.ParentObject = this;

            _currentParameters = null == from._currentParameters ? null : (ParameterSet)from._currentParameters.Clone();
            // Note that the fit context is not cloned here.
        }
예제 #5
0
		public NonlinearFitDocument(NonlinearFitDocument from)
		{
			_fitEnsemble = null == from._fitEnsemble ? null : (FitEnsemble)from._fitEnsemble.Clone();
			_fitEnsemble.ParentObject = this;

			_currentParameters = null == from._currentParameters ? null : (ParameterSet)from._currentParameters.Clone();
			// Note that the fit context is not cloned here.
		}
예제 #6
0
            public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                NonlinearFitDocument s = o != null ? (NonlinearFitDocument)o : new NonlinearFitDocument();

                s._fitEnsemble = (FitEnsemble)info.GetValue("FitEnsemble", s);
                s._fitEnsemble.ParentObject = s;
                s._currentParameters        = (ParameterSet)info.GetValue("Parameters", s);

                return(s);
            }
    public NonlinearFitController(NonlinearFitDocument doc)
    {
      _doc = doc;
      _parameterController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _doc.CurrentParameters }, typeof(IMVCAController));
      _fitEnsembleController = (IFitEnsembleController)Current.Gui.GetControllerAndControl(new object[] { _doc.FitEnsemble }, typeof(IFitEnsembleController));

      _funcselController = new FitFunctionSelectionController(_doc.FitEnsemble.Count == 0 ? null : _doc.FitEnsemble[0].FitFunction);
      Current.Gui.FindAndAttachControlTo(_funcselController);

      _doc.FitEnsemble.Changed += new EventHandler(EhFitEnsemble_Changed);
    }
예제 #8
0
        /// <summary>
        /// Creates an instance of this class. This constructor needs either
        /// <paramref name="dataTable"/>, <paramref name="xCol"/> and <paramref name="yCol"/> to be valid, or all to be null.
        /// If all null, consider to use the other provided constructor.
        /// </summary>
        /// <param name="fitFunc">Fitting function.</param>
        /// <param name="parameter">Array of default parameters (length must match the expected number of parameter of fitFunc).</param>
        /// <param name="dataTable">The data table from which the provided <paramref name="xCol"/> and <paramref name="yCol"/> originate.</param>
        /// <param name="groupNumber">The group number of the columns <paramref name="xCol"/> and <paramref name="yCol"/>.</param>
        /// <param name="xCol">Data column of independent values.</param>
        /// <param name="yCol">Data column of dependent values.</param>
        /// <param name="start">First point to be used for fitting.</param>
        /// <param name="count">Number of points to be used for fitting.</param>
        public SimpleNonlinearFit(FitEvaluationFunction fitFunc, double[] parameter, Altaxo.Data.DataTable dataTable, int groupNumber, Altaxo.Data.INumericColumn xCol, Altaxo.Data.INumericColumn yCol, int start, int count)
        {
            _fitDoc = new NonlinearFitDocument();

            if (null == dataTable && null == xCol && null == yCol)
            {
                _fitEle = new FitElement(Altaxo.Data.Selections.RangeOfRowIndices.FromStartAndCount(start, count));
            }
            else
            {
                _fitEle = new FitElement(dataTable, groupNumber, Altaxo.Data.Selections.RangeOfRowIndices.FromStartAndCount(start, count), xCol, yCol);
            }

            _fitEle.FitFunction = new DummyFitFunc(fitFunc, parameter);
            _fitDoc.FitEnsemble.Add(_fitEle);
            _fitDoc.SetDefaultParametersForFitElement(0);
        }
예제 #9
0
		public NonlinearFitController(NonlinearFitDocument doc)
		{
			_doc = doc;
			_parameterController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.CurrentParameters }, typeof(IMVCANController));
			_fitEnsembleController = (IFitEnsembleController)Current.Gui.GetControllerAndControl(new object[] { _doc.FitEnsemble }, typeof(IFitEnsembleController));

			_funcselController = new FitFunctionSelectionController(_doc.FitEnsemble.Count == 0 ? null : _doc.FitEnsemble[0].FitFunction);
			Current.Gui.FindAndAttachControlTo(_funcselController);

			{
				var fitEnsemble = _doc.FitEnsemble;
				fitEnsemble.Changed += new WeakEventHandler(EhFitEnsemble_Changed, handler => fitEnsemble.Changed -= handler);
			}

			_generationInterval = new Common.EquallySpacedInterval();
			_generationIntervalController = new Common.EquallySpacedIntervalController();
			_generationIntervalController.InitializeDocument(_generationInterval);
		}
예제 #10
0
		/// <summary>
		/// Creates an instance of this class.
		/// </summary>
		/// <param name="fitFunc">Fitting function.</param>
		/// <param name="parameter">Array of default parameters (length must match the expected number of parameter of fitFunc).</param>
		/// <param name="xCol">Data column of independent values.</param>
		/// <param name="yCol">Data column of dependent values.</param>
		/// <param name="start">First point to be used for fitting.</param>
		/// <param name="count">Number of points to be used for fitting.</param>
		public SimpleNonlinearFit(FitEvaluationFunction fitFunc, double[] parameter, Altaxo.Data.INumericColumn xCol, Altaxo.Data.INumericColumn yCol, int start, int count)
		{
			_fitDoc = new NonlinearFitDocument();
			_fitEle = new FitElement(null, 0, Altaxo.Data.Selections.RangeOfRowIndices.FromStartAndCount(start, count), xCol, yCol);
			_fitEle.FitFunction = new DummyFitFunc(fitFunc, parameter);
			_fitDoc.FitEnsemble.Add(_fitEle);
			_fitDoc.SetDefaultParametersForFitElement(0);
		}