solving span bugs (#57)

This commit is contained in:
Dario Coscia
2022-12-14 13:56:10 +01:00
committed by GitHub
parent de0fd01f8a
commit c52ee03b53
3 changed files with 56 additions and 8 deletions

View File

@@ -100,6 +100,25 @@ class Span(Location):
result = result.append(pts_variable, mode='std')
return result
def _single_points_sample(n, variables):
tmp = []
for variable in variables:
if variable in self.fixed_.keys():
value = self.fixed_[variable]
pts_variable = torch.tensor([[value]]).repeat(n, 1)
pts_variable = pts_variable.as_subclass(LabelTensor)
pts_variable.labels = [variable]
tmp.append(pts_variable)
result = tmp[0]
for i in tmp[1:]:
result = result.append(i, mode='std')
return result
if self.fixed_ and (not self.range_):
return _single_points_sample(n, variables)
if variables == 'all':
variables = list(self.range_.keys()) + list(self.fixed_.keys())