Commit graph

366 commits

Author SHA1 Message Date
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
db612597d2
[fix] Handle missing replia (#232)
* [fix] First version of a fix to cope with missing replica.

* [fix] added test for missing replica

* [fix] refactored fix for missing replica, modified tests

* [fix] refinement of tests
2024-04-25 20:45:53 +02:00
Fabian Joswig
43bd99b6c7
[fix] Numpy 2 breaking changes in tests (#234) 2024-04-17 14:53:34 +02:00
Justus Kuhlmann
b930fab9c2
Fix keyword files with list of lists (#226)
* first impl. handle reps with list of lists

* implement explicit type checks
2024-02-18 13:39:35 +01:00
Fabian Joswig
5122e260ea
Special function module (#221)
* [fix] Fixed intendation for flake8

* [feat] special module with Bessel functions added.

* [feat] init adapted.

* [tests] First test for special module added.

* [tests] Check kn special function derivative explicitly vs numerical
derivative of scipy function.

* [feat] Added remaining autograd scipy special functions to the special
module.

* [feat] Imports corrected, docstring added.
2024-01-07 17:22:05 +01:00
JanNeuendorf
e1a4d0c218
Additional GEVP method with errors (#195)
* Added the function error_gevp() to compute the gevp with statistical errors.

* Changed method name from error_gevp to error_GEVP and removed automatic gamma method

* added auto_gamma to error_GEVP

* Specified exceptions in Corr.error_GEVP

* Fixed a wrong path. It should be np.linalg.LinAlgError

* Added a test for error_GEVP

* The tests of error_gevp loads a test matrix

* Incorporated eigenvectors with uncertainties in GEVP routine

* Cleaned up GEVP routines

* Cleaned up breaking change from merge

* Released tolerance in test of GEVP

* Repaired broken GEVP test

---------

Co-authored-by: Simon Kuberski <simon.kuberski@uni-muenster.de>
2023-11-17 18:57:18 +01:00
s-kuberski
d689959b1f
fix: Check if configs appears multiple times when creating an obs (#216) 2023-11-10 19:13:11 +01:00
s-kuberski
dc63142f8e
Fixed bugs for combined fits with multiple independent variables (#211) 2023-10-24 19:30:52 +02:00
Justus Kuhlmann
0ef8649031
Feat/read sfcf multi (#210)
* make template

* read_sfcf_multi running with compact format

* fix append mode, norrmal tests work

* improve readability

* add simple test for multi_read

* simple multi_test works

* add first method to check sfcf param hashes

* add docstring

* simple test for o format working

* use benedict to make loops easier

* introduce python-benedict as dep

* no nice_out, less error prone, found bug in tests

* Revert "introduce python-benedict as dep"

This reverts commit 9696d68b7a.

* Revert "use benedict to make loops easier"

This reverts commit fa3987479b.

* no nice output after reverts

* [build] Added jkuhl-uni as CODEOWNER for sfcf.

* refactor: flatten internal dicts

* very small test extension

* ...flake8

* docu

* Delete second sep init

---------

Co-authored-by: Fabian Joswig <fabian.joswig@uni-muenster.de>
2023-10-20 19:22:55 +02:00
Fabian Joswig
7f8c2ce33b
feat: added support for addition and multiplication of complex numbers (#209)
to Corr objects.
2023-07-21 14:15:41 +01:00
Fabian Joswig
af28f77ec5
__eq__ method for Corr class (#206)
* feat: implemented __eq__ method for Corr class.

* feat: __eq__ method now respects None entries in correlators.

* feat: Obs can now be compared to None, __ne__ method removed as it is
not required.

* feat: Corr.__eq__ rewritten to give a per element comparison.

* tests: additional test case for correlator comparison added.

* feat: comparison now also works for padding.
2023-07-19 15:06:19 +01:00
Fabian Joswig
1e438356fd
Vectorized gamma_method (#207)
* feat: vectorized gamma_method function added.

* feat: vectorized gamma method generalized to also work on other objects
like Corr or Fit_result.

* feat: alias gamma_method for vectorized gamma_method added.

* docs: example 5 updated to include vectorized gamma_method.

* docs: output of example 5 updated.
2023-07-19 12:13:20 +01:00
Fabian Joswig
66d5f8be24
Corr array initialization generalized (#203)
* feat: corr array initialization generalized.

* feat: additional checks for three-dimensional arrays added.

* docs: Corr docstring improved.

* docs: typos corrected.

* docs: details about None padding added to Corr docstring.
2023-07-18 12:07:46 +01: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
s-kuberski
6dcd0c3518
feat: Added numerical integration of generic functions (#201)
* feat: Added numerical integration of generic functions

* refactored integration routines

* tests: two trivial tests for integration added.

* docs: quad docstring corrected.

* Small bugfix for integration without obs

---------

Co-authored-by: Fabian Joswig <fabian.joswig@ed.ac.uk>
2023-07-14 14:21:59 +01:00
Fabian Joswig
8736d1cd3c
feat: CObs format added and complex Corr print improved. (#200) 2023-07-14 13:38:21 +01:00
Fabian Joswig
b62a18643e
Bootstrap export/import (#198)
* feat: export_bootstrap method added.

* feat: import_bootstrap function added.

* tests: first test for import/export bootstrap added.

* feat: bootstrap feature cleaned up.

* docs: boostrap docstrings improved.
2023-07-14 13:12:11 +01:00
Fabian Joswig
db79cb2d95
tests: test for print_config added. 2023-07-10 15:44:06 +01:00
Fabian Joswig
9589820253
tests: coverage for all derivative variants extended. 2023-07-10 15:35:37 +01:00
Fabian Joswig
525c61ed20
Fix another edge case in _compute_drho (#194)
* tests: failing test for compute_drho edge case added.

* tests: example file for failing compute_drho added.

* tests: assertion that dvalue stays the same added to compute drho test.

* fix: another edge case in computation of drho fixed.
2023-06-02 15:04:15 +01:00
Justus Kuhlmann
9489b87a7e
fix nan to None test (#192) 2023-06-01 14:07:16 +01:00
Fabian Joswig
bb43a8afb7
Fix Obs in f-strings without specifier (#190)
* fix: Conversion of an array with ndim > 0 to a scalar deprecation fixed.

* fix: adjusted maximal value for rho in test_gamma_method_irregular.

* fix: obs in f-strings now work again when no specifier is provided.
2023-05-31 18:07:38 +01:00
s-kuberski
34fe7f44fc
Bug fix for edge case in _compute_drho (#189) 2023-05-30 15:29:22 +01:00
Fabian Joswig
095f7c8a46
fix: adjusted maximal value for rho in test_gamma_method_irregular. (#188) 2023-05-30 14:03:01 +01:00
Fabian Joswig
dc73456759
tests: np.alltrue replaced by np.all. 2023-05-30 12:52:10 +01:00
Justus Kuhlmann
1a811b04f3
Feat/files idl xsf (#185)
* added kwrg idl to ms5_xsf_read

* change output, warn user if expected idl not found
2023-05-26 13:01:52 +01:00
Justus Kuhlmann
e97cc519a9
taking care of cols with only None values (#184) 2023-05-22 12:37:46 +01:00
s-kuberski
81e4f37934
Restored JSON output of dicts with non-string keys (#179)
* Restored JSON output of dicts with non-string keys

* Use numpy.integer instead of deprecated numpy.int
2023-05-19 14:58:56 +01:00
Justus Kuhlmann
a5b6f69160
Slightly better Typechecking when exporting to SQL (#174)
* corret type clause

* add tests, changes in create_json_string

* create json-string now gives back None

* revert changes

* fix panda sql export

* add SQL test

* fixed None type export for csv and sql.gz

* move None parsing to json io

* alter regex

* revert changes

* only replace None with empty str when necessary

* fixed deserialze_df for python 3.7

* add more tesets

* fix case where gz was ignored

* hand voer gz explicitly

* replace nan  by None in non-Obs columns

* moved warning to csv export, mroe tests

* only values able to be nan are put in np.isnan()

* added python float for warning
2023-05-18 17:11:52 +01:00
s-kuberski
3198088f9c
Feat/flow (#176)
* fix: String conversion of Obs can now handle a dvalue that is NaN or inf

* Feat: Added extraction of w0/a from openQCD files

* Removed unnecessary round in w0 routine

* Improved error handling in fit_t0

* Allowed to change the reference flow time in t0 and w0 determinations.

* Added doc string to fit_t0
2023-05-16 18:29:13 +01:00
Justus Kuhlmann
5155effbbf
Fix/sort names (#177)
* cosmetic fix in sort_names

* bug fix, more tests
2023-05-16 18:28:32 +01:00
s-kuberski
15d07de87f
fix: String conversion of Obs can now handle a dvalue that is NaN or inf (#173) 2023-05-03 16:30:59 +02:00
s-kuberski
65a9128a7d
Fix/merge idx (#172)
* Fix: Corrected merging of idls

* Fix: Computation of drho in cases where tau_int is large compared to the chain length

* Removed unnecessary imports

* Refactor list comparisons in obs.py
2023-04-28 18:14:51 +01:00
Fabian Joswig
be061fdc23
Feat/str format (#170)
* feat: _format_uncertainty now accepts a significance.

* feat: __format__ now accepts significance.

* feat: explicit + sign added to format.

* fix: - option removed from format specifier.

* feat: space format added.
2023-04-20 17:31:37 +01:00
s-kuberski
a214465413
Fix/gaps (#169)
* fix: Fixed range detection in gamma_method

* Corrected test in dobsio

* Changed expansion paradigm in gamma_method

* Extended tests

* Updated docstrings

* Removed unnecessary intermediate variable

* Removed unnecessary code

* Fixed previously introduced bug in output in obs.details()

* Fixed previously introduced bug in window determination

* New criterion for matching gapped replica, fixed determination of w_max and fixed tau_exp analysis with gaps

* tests: split up consistency test for gamma method.

---------

Co-authored-by: Fabian Joswig <fabian.joswig@ed.ac.uk>
2023-04-20 17:30:57 +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
Justus Kuhlmann
83204ce794
fixed appended mode reading (#165) 2023-03-16 13:12:03 +00:00
Justus Kuhlmann
41fec09816
Impr/fix refactor sfcf read (#164)
* refactor read_sfcf

* adding tests for find_corr and read_compact_file

* add necessary broken data for tests

* fixed appended mode reading

* factored out sort_names and find_files

* now also using sort_files in sfcf.py

* edited tests to fit with new structure

* added find_files function

* shifted helpfunctions to bottom of file

* removed some debug lines

* linting

* Fixed requested changes, added silent mode

* added Exception if correlator is not found by read_append_rep

* use tmp_path fixture

* linting silent keyword

* try to fix testing for a_bb

* tests: Exception testing in test_find_corr made more explicit.

---------

Co-authored-by: Fabian Joswig <fabian.joswig@ed.ac.uk>
2023-03-15 17:46:12 +00:00
Fabian Joswig
3c942b380d
Serialize list of Obs in pandas.to_sql (#162)
* feat: Added serialization of list of Obs in pandas.to_sql.

* tests: test for list of Obs to sql added.

* feat: auto_gamma functionality added for deserialization of lists of
Obs.
2023-03-10 14:17:20 +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
9ef7e504a0
chore: Exceptions in Obs.__init__ made more explicit. 2023-03-02 18:54:08 +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
Fabian Joswig
d81d6ea0b8
fix: loop range in standard windowing procedure adjusted by gapsize
- Test added

Co-authored-by: Simon Kuberski <simon.kuberski@uni-muenster.de>
2023-02-27 21:43:29 +00:00
Fabian Joswig
8bc204fc31
tests: nan obs test added. 2023-02-26 18:56:46 +00:00
Justus Kuhlmann
0bc08be634
Impr/refactor find files (#153)
* wrote small test for ms5_xsf read method

* small bug in ms5_xsf found

* first version of refactoring with test

* built _find_files into openQCD module

* postfix can now be used as before

* altered test data to be smaller

* read_rwms throws better Exception now

* typo corrected

* better tests for postfixes, also added similar solution for ext variable

* added method to sort names of files and replica better
2023-02-17 11:51:00 +00:00