mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 03:53:41 +02:00
feat: changed the way empty obs are initialized
This commit is contained in:
parent
7b433c8df7
commit
1ab16612d9
1 changed files with 6 additions and 9 deletions
|
@ -68,8 +68,9 @@ class Obs:
|
||||||
already subtracted from the samples
|
already subtracted from the samples
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if means is None and samples is not None:
|
sample_length = len(samples)
|
||||||
if len(samples) != len(names):
|
if means is None and sample_length:
|
||||||
|
if sample_length != len(names):
|
||||||
raise Exception('Length of samples and names incompatible.')
|
raise Exception('Length of samples and names incompatible.')
|
||||||
if idl is not None:
|
if idl is not None:
|
||||||
if len(idl) != len(names):
|
if len(idl) != len(names):
|
||||||
|
@ -86,11 +87,7 @@ class Obs:
|
||||||
if min(len(x) for x in samples) <= 4:
|
if min(len(x) for x in samples) <= 4:
|
||||||
raise Exception('Samples have to have at least 5 entries.')
|
raise Exception('Samples have to have at least 5 entries.')
|
||||||
|
|
||||||
if names:
|
self.names = sorted(names)
|
||||||
self.names = sorted(names)
|
|
||||||
else:
|
|
||||||
self.names = []
|
|
||||||
|
|
||||||
self.shape = {}
|
self.shape = {}
|
||||||
self.r_values = {}
|
self.r_values = {}
|
||||||
self.deltas = {}
|
self.deltas = {}
|
||||||
|
@ -100,7 +97,7 @@ class Obs:
|
||||||
self.covobs = covobs
|
self.covobs = covobs
|
||||||
|
|
||||||
self.idl = {}
|
self.idl = {}
|
||||||
if samples is not None:
|
if sample_length:
|
||||||
if idl is not None:
|
if idl is not None:
|
||||||
for name, idx in sorted(zip(names, idl)):
|
for name, idx in sorted(zip(names, idl)):
|
||||||
if isinstance(idx, range):
|
if isinstance(idx, range):
|
||||||
|
@ -1632,7 +1629,7 @@ def cov_Obs(means, cov, name, grad=None):
|
||||||
co : Covobs
|
co : Covobs
|
||||||
Covobs to be embedded into the Obs
|
Covobs to be embedded into the Obs
|
||||||
"""
|
"""
|
||||||
o = Obs(None, None)
|
o = Obs([], [])
|
||||||
o._value = co.value
|
o._value = co.value
|
||||||
o.names.append(co.name)
|
o.names.append(co.name)
|
||||||
o.covobs[co.name] = co
|
o.covobs[co.name] = co
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue