mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
make deriv structure like second_deriv
This commit is contained in:
parent
52b91d83d8
commit
cb9d942208
1 changed files with 1 additions and 5 deletions
|
@ -588,8 +588,8 @@ class Corr:
|
||||||
"""
|
"""
|
||||||
if self.N != 1:
|
if self.N != 1:
|
||||||
raise ValueError("deriv only implemented for one-dimensional correlators.")
|
raise ValueError("deriv only implemented for one-dimensional correlators.")
|
||||||
|
newcontent: list[Union[None, ndarray, Obs]] = []
|
||||||
if variant == "symmetric":
|
if variant == "symmetric":
|
||||||
newcontent = []
|
|
||||||
for t in range(1, self.T - 1):
|
for t in range(1, self.T - 1):
|
||||||
if (self.content[t - 1] is None) or (self.content[t + 1] is None):
|
if (self.content[t - 1] is None) or (self.content[t + 1] is None):
|
||||||
newcontent.append(None)
|
newcontent.append(None)
|
||||||
|
@ -599,7 +599,6 @@ class Corr:
|
||||||
raise ValueError('Derivative is undefined at all timeslices')
|
raise ValueError('Derivative is undefined at all timeslices')
|
||||||
return Corr(newcontent, padding=[1, 1])
|
return Corr(newcontent, padding=[1, 1])
|
||||||
elif variant == "forward":
|
elif variant == "forward":
|
||||||
newcontent = []
|
|
||||||
for t in range(self.T - 1):
|
for t in range(self.T - 1):
|
||||||
if (self.content[t] is None) or (self.content[t + 1] is None):
|
if (self.content[t] is None) or (self.content[t + 1] is None):
|
||||||
newcontent.append(None)
|
newcontent.append(None)
|
||||||
|
@ -609,7 +608,6 @@ class Corr:
|
||||||
raise ValueError("Derivative is undefined at all timeslices")
|
raise ValueError("Derivative is undefined at all timeslices")
|
||||||
return Corr(newcontent, padding=[0, 1])
|
return Corr(newcontent, padding=[0, 1])
|
||||||
elif variant == "backward":
|
elif variant == "backward":
|
||||||
newcontent = []
|
|
||||||
for t in range(1, self.T):
|
for t in range(1, self.T):
|
||||||
if (self.content[t - 1] is None) or (self.content[t] is None):
|
if (self.content[t - 1] is None) or (self.content[t] is None):
|
||||||
newcontent.append(None)
|
newcontent.append(None)
|
||||||
|
@ -619,7 +617,6 @@ class Corr:
|
||||||
raise ValueError("Derivative is undefined at all timeslices")
|
raise ValueError("Derivative is undefined at all timeslices")
|
||||||
return Corr(newcontent, padding=[1, 0])
|
return Corr(newcontent, padding=[1, 0])
|
||||||
elif variant == "improved":
|
elif variant == "improved":
|
||||||
newcontent = []
|
|
||||||
for t in range(2, self.T - 2):
|
for t in range(2, self.T - 2):
|
||||||
if (self.content[t - 2] is None) or (self.content[t - 1] is None) or (self.content[t + 1] is None) or (self.content[t + 2] is None):
|
if (self.content[t - 2] is None) or (self.content[t - 1] is None) or (self.content[t + 1] is None) or (self.content[t + 2] is None):
|
||||||
newcontent.append(None)
|
newcontent.append(None)
|
||||||
|
@ -629,7 +626,6 @@ class Corr:
|
||||||
raise ValueError('Derivative is undefined at all timeslices')
|
raise ValueError('Derivative is undefined at all timeslices')
|
||||||
return Corr(newcontent, padding=[2, 2])
|
return Corr(newcontent, padding=[2, 2])
|
||||||
elif variant == 'log':
|
elif variant == 'log':
|
||||||
newcontent = []
|
|
||||||
for t in range(self.T):
|
for t in range(self.T):
|
||||||
if (self.content[t] is None) or (self.content[t] <= 0):
|
if (self.content[t] is None) or (self.content[t] <= 0):
|
||||||
newcontent.append(None)
|
newcontent.append(None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue