Method: sizeFirstDim
Change size in first (slowest) dimension, truncating or padding with self.defaultValue as necessary.
guid:
|
www.ccpn.ac.uk_Fogh_2011-03-30-18:05:06_00012__www.ccpn.ac.uk_Fogh_2011-03-30-17:55:16_00001
|
OpType:
|
otherModify
|
OpSubType:
|
None
|
isQuery:
|
False
|
isAbstract:
|
False
|
Scope:
|
instance_level
|
Code:
|
if value < 0:
raise ApiError("Dimension size must be non-negative: %s" % value)
shapeList = self.__dict__['shape'] # must bypass API
lendiff = value - shapeList[0]
if lendiff:
data = self.__dict__['data'] # must bypass API
if data:
# if data array is empty we have an all-default matrix
if lendiff > 0:
data.extend([self.defaultValue]*self.pointToIndex((lendiff,)))
else:
# lendiff < 0
del data[self.pointToIndex((lendiff,)):]
shapeList[0] = value
|
|