Click or drag to resize

Updating RelaxISFitResult

The RelaxISFitResult now contains the new Parameters. property The old properties ParameterValues and ParameterErrors have been made readonly. For compatiblity they still return the parameter values and errors, taken directly from the new parameters list. To facilitate that these properties are not used for write access, their type was changed from a double array to IReadOnlyList<double>.

The old functionality is contained in the new property. If the array returned by the previous properties was used e.g. in other function calls, a conversion back to an array by calling the ToArray() may be required. If data was written to the properties, now the Parameters must be adjusted instead.

Prerequisites

No prerequisites for the update are needed.

Converting the returned readonly list to array

Perform these steps to update your code

  1. Indentify where the property value was used.

    C#
    [...]
    var parameterValues = fitResult.ParameterValues;
    return MyFunction(parameterValues);

    Call the ToArray() function to convert the readonly-list back to an aray.

    C#
    [...]
    var parameterValues = fitResult.ParameterValues.ToArray();
    return MyFunction(parameterValues);
If you wrote values to the ParameterValues or -Errors properties

Perform these steps to update the plugin

  1. Identify where the property values were written to.

    C#
    // Individual indexed access
    fitResult.ParameterValues[1] = 123.0;
    fitResult.ParameterErrors[1] = 0;
    
    // Full replacement of an array
    fitResult.ParameterValues = new double[] { 1.0, 2.0, 3.0 };

    Access either the individual items or replace the values via a loop.

    C#
    // Individual indexed access
    fitResult.Parameters[1].Value = 123.0;
    fitResult.Parameters[1].Error = 0;
    
    // Full replacement from an array. Length checks may be required.
    for (var i = 0; i < newArray.Length; i++)
    {
      fitResult.Parameters[i].Value = newArray[i];
    }
See Also