QuTech-Delft / qtt

Quantum Technology Toolbox https://qtt.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve error message for fitting with small data

peendebak opened this issue · comments

Fitting methods can fail if the amount of data provided is too small. Generating an error is fine, but the error message should be comprehensible.

A minimal example:

import numpy as np
from qtt.algorithms.functions import fit_gauss_ramsey

x_data=np.array([[1.99999999e-08]])
y_data=np.array([[0.19833334]])
local_fit_parameters, results = fit_gauss_ramsey(x_data, y_data)

Generates:

ValueError: The model function generated NaN values and the fit aborted! Please check your model function and/or set boundaries on parameters where applicable. In cases like this, using "nan_policy='omit'" will probably not work.
  • Fix error message for the fit_gauss_ramsey (and others)
  • Add regression tests

Issue has been addressed in private SQT repo.