Closed mcfarljm closed 3 years ago
Calling AKMCS.__init__ with the default value of samples=None produces the following error:
AKMCS.__init__
samples=None
self.dimension = np.shape(self.samples)[1] IndexError: tuple index out of range
The reason is that AKMCS.__init__ starts by storing self.samples as: https://github.com/SURGroup/UQpy/blob/80884c6578dab6d70a9e83a3e61bf47bdb2e9a99/src/UQpy/SampleMethods.py#L2682
self.samples
And then it uses the following logic to find the input dimension:
https://github.com/SURGroup/UQpy/blob/80884c6578dab6d70a9e83a3e61bf47bdb2e9a99/src/UQpy/SampleMethods.py#L2703-L2707
This does not work in the case of samples=None (which is actually the default), because array(None) is not None is True.
array(None) is not None
Perhaps consider using:
self.samples = np.array(samples) if samples is not None else None
Or otherwise the dimension logic could start by checking if samples is not None as opposed to self.samples.
samples
Yes, you are correct. We have not correctly addressed the samples=None case. We will fix it.
Calling
AKMCS.__init__
with the default value ofsamples=None
produces the following error:The reason is that
AKMCS.__init__
starts by storingself.samples
as: https://github.com/SURGroup/UQpy/blob/80884c6578dab6d70a9e83a3e61bf47bdb2e9a99/src/UQpy/SampleMethods.py#L2682And then it uses the following logic to find the input dimension:
https://github.com/SURGroup/UQpy/blob/80884c6578dab6d70a9e83a3e61bf47bdb2e9a99/src/UQpy/SampleMethods.py#L2703-L2707
This does not work in the case of
samples=None
(which is actually the default), becausearray(None) is not None
is True.Perhaps consider using:
Or otherwise the dimension logic could start by checking if
samples
is not None as opposed toself.samples
.