Closed AUTProgram closed 1 year ago
I have run unit tests, all work except one that throws
message = 'Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.', category = None
def warn_external(message, category=None):
"""
`warnings.warn` wrapper that sets *stacklevel* to "outside Matplotlib".
The original emitter of the warning can be obtained by patching this
function back to `warnings.warn`, i.e. ``_api.warn_external =
warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
etc.).
"""
frame = sys._getframe()
for stacklevel in itertools.count(1): # lgtm[py/unused-loop-variable]
if frame is None:
# when called in embedded context may hit frame is None
break
if not re.match(r"\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))",
# Work around sphinx-gallery not setting __name__.
frame.f_globals.get("__name__", "")):
break
frame = frame.f_back
> warnings.warn(message, category, stacklevel)
E UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
..\..\AppData\Local\pypoetry\Cache\virtualenvs\ionics-fits-fyXcmhes-py3.8\lib\site-packages\matplotlib\_api\__init__.py:363: UserWarning
================================================================================================================================================= short test summary info ==================================================================================================================================================
FAILED test/test_polynomial.py::test_power_n - UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
Not sure if this is caused by the configuration of the pc I am using.
All tests finish correctly
@hartytp Let me know if you are happy with the docstrings now.
@hartytp Let me know if you are happy with the docstrings now.
which one?
which one?
Those for get_initial_value
and estimate_parameters
mainly. I will have to copy the docstring of estimate_parameters
for each model.
I believe this is ready to be merged
Can you sort the test failure out though https://github.com/OxIonics/ionics_fits/actions/runs/3429613116/jobs/5715467301#step:8:30
🎆
This PR modifies the way in which initial values for parameters are obtained. An attribute
heuristic
has been added to theModelParameter
class, which is used if both offixed_to
andinitialised_to
areNone
. There is now only one method to get the initial guess for parameters during fitting, calledget_initial_value
. This method may returnNone
only beforeestimate_parameters
has been called. Ifget_initial_value
returnsNone
for any parameter after pre-fit estimation has been completed, the fitter raises an error.As part of this PR, bound checking for fixed parameters is added. Functionality is further changed such that if the initial value is outside bounds, an error is thrown rather than silently clipping the parameter.