Result

class glotaran.analysis.result.Result(scheme: Scheme, data: dict[str, xr.Dataset], optimized_parameters: ParameterGroup, additional_penalty: np.ndarray | None, least_squares_result: OptimizeResult, free_parameter_labels: list[str], termination_reason: str)[source]

Bases: object

The result of a global analysis

Parameters
  • scheme (Scheme) – An analysis scheme

  • data (Dict[str, xr.Dataset]) – A dictionary containing all datasets with their labels as keys.

  • optimized_parameters (ParameterGroup) – The optimized parameters, organized in a ParameterGroup

  • additional_penalty (Union[np.ndarray, None]) – A vector with the value for each additional penalty, or None

  • least_squares_result (OptimizeResult) – See scipy.optimize.OptimizeResult() scipy.optimize.least_squares()

  • free_parameter_labels (List[str]) – The text labels of the free parameters that were optimized

  • termination_reason (str) – The reason (message when) the optimizer terminated

Attributes Summary

additional_penalty

The additional penalty vector.

chi_square

The chi-square of the optimization.

covariance_matrix

Covariance matrix.

data

The resulting data as a dictionary of xarray.Dataset.

degrees_of_freedom

Degrees of freedom in optimization N - N_{vars}.

free_parameter_labels

List of labels of the free parameters used in optimization.

initial_parameters

The initital parameters.

jacobian

Modified Jacobian matrix at the solution See also: scipy.optimize.least_squares()

model

The model for analysis.

nnls

If True non-negative least squares optimization is used instead of the default variable projection.

number_of_data_points

Number of data points N.

number_of_function_evaluations

The number of function evaluations.

number_of_jacobian_evaluations

The number of jacobian evaluations.

number_of_variables

Number of variables in optimization N_{vars}

optimized_parameters

The optimized parameters.

reduced_chi_square

The reduced chi-square of the optimization.

root_mean_square_error

The root mean square error the optimization.

scheme

The scheme for analysis.

success

Indicates if the optimization was successful.

termination_reason

The reason of the termination of the process.

Methods Summary

get_dataset

Returns the result dataset for the given dataset label.

get_scheme

Return a new scheme from the Result object with optimized parameters.

markdown

Formats the model as a markdown text.

save

Saves the result to given folder.

Methods Documentation

property additional_penalty

The additional penalty vector.

property chi_square

The chi-square of the optimization.

\chi^2 = \sum_i^N [{Residual}_i]^2.

property covariance_matrix

Covariance matrix.

The rows and columns are corresponding to free_parameter_labels.

property data

The resulting data as a dictionary of xarray.Dataset.

Notes

The actual content of the data depends on the actual model and can be found in the documentation for the model.

property degrees_of_freedom

Degrees of freedom in optimization N - N_{vars}.

property free_parameter_labels

List of labels of the free parameters used in optimization.

get_dataset(dataset_label: str)xarray.core.dataset.Dataset[source]

Returns the result dataset for the given dataset label.

Parameters

dataset_label – The label of the dataset.

get_scheme()glotaran.analysis.scheme.Scheme[source]

Return a new scheme from the Result object with optimized parameters.

Returns

A new scheme with the parameters set to the optimized values. For the dataset weights the (precomputed) weights from the original scheme are used.

Return type

Scheme

property initial_parameters

The initital parameters.

property jacobian

Modified Jacobian matrix at the solution See also: scipy.optimize.least_squares()

Returns

Numpy array

Return type

np.ndarray

markdown(with_model=True)str[source]

Formats the model as a markdown text.

Parameters

with_model – If True, the model will be printed with initial and optimized parameters filled in.

property model

The model for analysis.

property nnls

If True non-negative least squares optimization is used instead of the default variable projection.

property number_of_data_points

Number of data points N.

property number_of_function_evaluations

The number of function evaluations.

property number_of_jacobian_evaluations

The number of jacobian evaluations.

property number_of_variables

Number of variables in optimization N_{vars}

property optimized_parameters

The optimized parameters.

property reduced_chi_square

The reduced chi-square of the optimization.

\chi^2_{red}= {\chi^2} / {(N - N_{vars})}.

property root_mean_square_error

The root mean square error the optimization.

rms = \sqrt{\chi^2_{red}}

save(path: str)list[str][source]

Saves the result to given folder.

Returns a list with paths of all saved items.

The following files are saved:

  • result.md: The result with the model formatted as markdown text.

  • optimized_parameters.csv: The optimized parameter as csv file.

  • {dataset_label}.nc: The result data for each dataset as NetCDF file.

Parameters

path – The path to the folder in which to save the result.

property scheme

The scheme for analysis.

property success

Indicates if the optimization was successful.

property termination_reason

The reason of the termination of the process.