Commit graph

57 commits

Author SHA1 Message Date
s-kuberski
4b1bb0872a
fix: corrected bug that prevented combined fits with multiple x-obs in some cases (#241)
* fix: corrected bug that prevented combined fits with multiple x-obs in some cases

* made test more complex

* [Fix] Slightly increase tolerance for matrix function test.

* Adapt test_merge_idx to compare lists

---------

Co-authored-by: Simon Kuberski <simon.kuberski@cern.ch>
Co-authored-by: Fabian Joswig <fjosw@users.noreply.github.com>
2024-09-13 19:15:59 +02:00
Pia Leonie Jones Petrak
1d6f7f65c0
Feature/corr matrix and inverse cov matrix as input in least squares function for correlated fits (#223)
* feat: corr_matrix kwargs as input for least squares fit

* feat/tests: inverse covariance matrix and correlation matrix kwargs as input for least squares function

* feat/tests/example: reduced new kwargs to 'inv_chol_cov_matrix' and outsourced the inversion & cholesky decomposition of the covariance matrix (function 'invert_corr_cov_cholesky(corr, covdiag)')

* tests: added tests for inv_chol_cov_matrix kwarg for the case of combined fits

* fix: renamed covdiag to inverrdiag needed for the cholesky decomposition and corrected its documentation

* examples: added an example of a correlated combined fit to the least_squares documentation

* feat/tests/fix(of typos): added function 'sort_corr()' (and a test of it) to sort correlation matrix according to a list of alphabetically sorted keys

* docs: added more elaborate documentation/example of sort_corr(), fixed typos in documentation of invert_corr_cov_cholesky()
2024-09-13 08:35:10 +02:00
s-kuberski
dc63142f8e
Fixed bugs for combined fits with multiple independent variables (#211) 2023-10-24 19:30:52 +02:00
Fabian Joswig
f1150f09c8
Matmul overloaded for correlator class. (#199)
* feat: matmul method added to correlator class.

* feat: corr, corr matmul and correlator matrix trace added.

* tests: tests for matmul and trace added.

* tests: slightly reduced tolerance and good guess bad guess test.

* feat: rmatmul added and __array_priority__ set.

* tests: additional tests for rmatmul added.

* tests: one more tests for rmatmul added.

* docs: docstring added to Corr.trace.

* tests: associative property test added for complex Corr matmul.

* fix: Corr.roll method now also works for correlator matrices by
explicitly specifying the axis.

Co-authored-by: Matteo Di Carlo <matteo.dicarlo93@gmail.com>

* feat: exception type for correlator trace of 1dim correlator changed.

* tests: trace N=1 exception tested.

---------

Co-authored-by: Matteo Di Carlo <matteo.dicarlo93@gmail.com>
2023-07-17 11:48:57 +01:00
Fabian Joswig
5c2a6de56f
fix: explicit Exception for combined fit constant edge case. (#202) 2023-07-14 14:26:54 +01:00
nils-ht
2363b755dd
NHT changes plots combined fit (#166)
* NHT changes plots combined fit

* feat: Exception for illegal combination added and test fixed.

---------

Co-authored-by: Fabian Joswig <fabian.joswig@ed.ac.uk>
2023-03-17 13:52:07 +00:00
Fabian Joswig
a7a098b861
fix: chisquare, dof and p-value also calculated when dof is 0. Test for
dof and chisquare_over_dof added.
2023-03-09 15:32:27 +00:00
Fabian Joswig
06ba2015be
tests: test for different methods in prior fit added. 2023-03-09 15:00:52 +00:00
Fabian Joswig
80f4eef912
chore: Exception in least_squares specified. 2023-03-08 16:45:29 +00:00
Fabian Joswig
839d9214ed
Improved prior fit (#161)
* refactor: merged combined fit and prior fit without breaking the
routine. Fitting with priors does not work yet.

* refactor: correlated fits without priors work now.

* refactor: prior error propagation and dof fixed.

* refactor: old prior fit implementation moved to tests.

* refactor: moved _extract_val_and_dval out of least_squares.

* refactor: comment removed.

* tests: additional tests and exceptions added.

* tests: test for constrained prior fit added.

* docs: least_squares docstring extended.

* fix: linting errors fixed.

* feat: additional if cause for fits without priors added to achieve
original speed.

* tests: test_constrained_and_prior_fit fixed.

* fix: fix array cast of least_squares dict mode.

* tests: test for lists in dict fit added.

* fix: additional asarray added in resplot.

Co-authored-by: Simon Kuberski <simon.kuberski@uni-muenster.de>
2023-03-07 16:15:16 +00:00
Fabian Joswig
82cd2f11ea
fix: multi dim fits fixed in least squares. Test added. (#160)
Co-authored-by: Simon Kuberski <simon.kuberski@uni-muenster.de>
2023-03-03 16:35:26 +00:00
Fabian Joswig
dc7033e51f
refactor: _standard_fit method made redundant. (#154)
* refactor: _standard_fit method made redundant.

* fix: xs and yz in Corr.fit promoted to arrays.

* fix: x promoted to array in _combined_fit if input is just a list.

* feat: residual_plot and qqplot now work with combined fits with
dictionary inputs.

* tests: test for combined fit resplot and qqplot added.

* docs: docstring of fits.residual_plot extended.
2023-03-01 10:00:35 +00:00
ppetrak
ba54545b4e feat/tests: Correlated fits now also work for combined fits. 2023-02-03 14:54:54 +01:00
ppetrak
80371a0898 fix/tests: Combined fit now also works when the keys of the x,y & func input dictionaries are not in the same order, build: improvements in performance 2023-01-30 14:26:47 +01:00
ppetrak
4b3fac8ee4 tests: invalid fit functions, num_grad vs auto_grad 2022-12-20 18:26:15 +01:00
ppetrak
80c8a0f979 feat: added (default) method Levenberg-Marquardt, test added 2022-12-20 15:26:13 +01:00
Fabian Joswig
33ff2219ba
fix: Combined fit can now handle list and array inputs for y-values, test added. 2022-12-19 16:06:12 +01:00
Fabian Joswig
140b626aae
fix: Combined fit can now handle list and array inputs for x-values,
test added.
2022-12-19 15:15:24 +01:00
Fabian Joswig
850be29d20
tests: test for Hotelling t-squared p-value added. 2022-12-06 17:18:16 +00:00
Simon Kuberski
50ac82ed1d released absolute tolerance in test_fit_corr_independent 2022-10-19 16:28:07 +02:00
Fabian Joswig
f5c9a30266
tests: tests for num_grad version of prior fits added. 2022-10-07 18:02:27 +01:00
Fabian Joswig
e4d18fc8c8
tests: num_grad test for total least squares added. 2022-10-06 18:09:37 +01:00
Fabian Joswig
8cf15b651f
tests: num_grad fit test improved. 2022-10-06 17:55:04 +01:00
Fabian Joswig
f22614f999
tests: tests for num diff least square fits added. 2022-10-05 18:41:28 +01:00
Fabian Joswig
fff74ed69e ci: tolerance on total least squares tolerance test relaxed. 2022-06-28 14:51:12 +01:00
Fabian Joswig
3e29cf9ca8 fix: detection of invalid fit functions extended. 2022-06-24 12:50:26 +01:00
Fabian Joswig
338bf8906a refactor: maintainability issues in tests fixed. 2022-06-24 12:28:49 +01:00
Fabian Joswig
f49562b895 tests: additional test for least square fits added which probes
different initial guess and exceptions.

Tolerance in total least square tests relaxed.
2022-06-10 10:13:49 +01:00
Fabian Joswig
8a911cac61 tests: Correlated least square fit tested against jackknife resampling 2022-06-07 10:59:26 +01:00
Fabian Joswig
c9e0c6e208 tests: linear least_squares fit error estimation tested against jackknife resampling. 2022-06-06 15:11:03 +01:00
Fabian Joswig
e7f5961cd6 fix: bug in estimation of chisquare for correlated fit fixed, tests
added.
2022-05-26 13:52:05 +01:00
Fabian Joswig
6bbd88a8c1 tests: fit_corr_independent now runs for various methods. 2022-05-25 18:03:46 +01:00
Fabian Joswig
c9f65298b4 tests: test added that checks that correlated and uncorrelated fits give
the same result if the input data is uncorrelated.
2022-04-07 17:14:26 +01:00
Fabian Joswig
e6813a6c8e feat: correlated_fit now throws an exception when the correlation matrix
is ill conditioned with respect to the machine precision.

Criterion for warning for ill-conditioned covariance matrix changed to cond > sqrt(eps)

Test added.
2022-03-09 12:24:52 +00:00
Fabian Joswig
99bead518c tests: additional test for expected chiqsquare and correlated fit based
on cov obs added.
2022-03-07 11:54:09 +00:00
Fabian Joswig
b14314b424 fix: Error handling for fits and root finding with numpy instead of autograd.numpy
improved. Tests added.
2022-03-02 15:49:29 +00:00
Fabian Joswig
82419b7a88 feat: positive semi-definite estimator for the covariance implemented,
fits.covariance matrix deprecated, covariance can now handle lists of
observables.
2022-03-01 09:45:25 +00:00
Fabian Joswig
952c7acef5 tests: additional tests for alternative fit methods in
fits.least_squares added
2022-02-02 10:10:20 +00:00
Simon Kuberski
d1e18b6673 Fixes least_squares with migrad, tests extended 2022-02-02 09:05:13 +01:00
Fabian Joswig
6174343de6 test: test for ks_test added 2022-01-10 15:24:43 +01:00
Fabian Joswig
1cbbc68e8b test criterion for correlated fit relaxed 2021-12-20 11:46:05 +01:00
Fabian Joswig
ec20ee38a6 feat!: covariance replaced by covariance2, window altered to minimum of
the window of the two observables. Tests adjusted.
2021-12-13 17:06:03 +00:00
Fabian Joswig
352b93ee2c fix: the covariance functions now correctly check whether the
gamma_method was run. Tests added.
2021-12-09 13:06:49 +00:00
Fabian Joswig
87c50f54c0 refactor!: fit_general deprecated and moved to tests 2021-12-09 10:11:31 +00:00
Fabian Joswig
9ddadaf6b3 fix: fits and root now work when the value of the zeroth input is
exactly zero. Tests extended.
2021-12-07 18:40:36 +00:00
Fabian Joswig
f223b12cc2 fix: instances of plot.show changed to plot.draw in fit module 2021-12-07 08:27:24 +00:00
Fabian Joswig
6028274342 test: test for r_value propagation in fits added 2021-12-04 13:05:18 +00:00
Simon Kuberski
359c9c06da Bugfix for covobs, fit tests for covobs added 2021-11-30 13:32:50 +01:00
Fabian Joswig
ed6bb24607 refactor: deprecated e_tag and e_tag_global removed from modules and
tests
2021-11-15 17:24:56 +00:00
Simon Kuberski
99d8ee5dd5 Adapted test_total_least_squares 2021-11-15 18:12:49 +01:00