mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-07-01 01:09:27 +02:00
Added the possibility to use constrained fit parameters. Added correlated least squares.
This commit is contained in:
parent
4bf95da346
commit
dbe1c26362
3 changed files with 183 additions and 34 deletions
|
@ -1196,6 +1196,8 @@ def covariance(obs1, obs2, correlation=False, **kwargs):
|
|||
if true the correlation instead of the covariance is
|
||||
returned (default False)
|
||||
"""
|
||||
if set(obs1.names).isdisjoint(set(obs2.names)):
|
||||
return 0.
|
||||
|
||||
for name in sorted(set(obs1.names + obs2.names)):
|
||||
if (obs1.shape.get(name) != obs2.shape.get(name)) and (obs1.shape.get(name) is not None) and (obs2.shape.get(name) is not None):
|
||||
|
@ -1287,6 +1289,9 @@ def covariance2(obs1, obs2, correlation=False, **kwargs):
|
|||
|
||||
return gamma
|
||||
|
||||
if set(obs1.names).isdisjoint(set(obs2.names)):
|
||||
return 0.
|
||||
|
||||
if not hasattr(obs1, 'e_names') or not hasattr(obs2, 'e_names'):
|
||||
raise Exception('The gamma method has to be applied to both Obs first.')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue