The shape of array |anntools.SeasonalANN.ratios|.
183830
def shape(self) -> Tuple[int, ...]:
        """"""
        return tuple(int(sub) for sub in self.ratios.shape)
1191318
def agg_dims(arr, stat):
    
    axis = None
    if arr.ndim > 2:
        axis = 1
        arr = arr.reshape(arr.shape[0], -1)
    module = np.ma if hasattr(arr, 'mask') else np
    return getattr(module, stat)(arr, axis)
874055
def prepare_venn_axes(ax, centers, radii):
    '''
    
    '''
    ax.set_aspect('equal')
    ax.set_xticks([])
    ax.set_yticks([])
    min_x = min([centers[i][0] - radii[i] for i in range(len(radii))])
    max_x = max([centers[i][0] + radii[i] for i in range(len(radii))])
    min_y = min([centers[i][1] - radii[i] for i in range(len(radii))])
    max_y = max([centers[i][1] + radii[i] for i in range(len(radii))])
    ax.set_xlim([min_x - 0.1, max_x + 0.1])
    ax.set_ylim([min_y - 0.1, max_y + 0.1])
    ax.set_axis_off()
799978
def reshape_axes(axes, shape, newshape, unknown=None):
    
    shape = tuple(shape)
    newshape = tuple(newshape)
    if len(axes) != len(shape):
        raise ValueError('axes do not match shape')

    size = product(shape)
    newsize = product(newshape)
    if size != newsize:
        raise ValueError('cannot reshape %s to %s' % (shape, newshape))
    if not axes or not newshape:
        return ''

    lendiff = max(0, len(shape) - len(newshape))
    if lendiff:
        newshape = newshape + (1,) * lendiff

    i = len(shape)-1
    prodns = 1
    prods = 1
    result = []
    for ns in newshape[::-1]:
        prodns *= ns
        while i > 0 and shape[i] == 1 and ns != 1:
            i -= 1
        if ns == shape[i] and prodns == prods*shape[i]:
            prods *= shape[i]
            result.append(axes[i])
            i -= 1
        elif unknown:
            result.append(unknown)
        else:
            unknown = 'Q'
            result.append(unknown)

    return ''.join(reversed(result[lendiff:]))
1112137
def shape4d(a, data_format='NHWC'):
    
    s2d = shape2d(a)
    if get_data_format(data_format, False) == 'NHWC':
        return [1] + s2d + [1]
    else:
        return [1, 1] + s2d
311011
def get_axis(array, axis, slice_num):
    """"""

    slice_list = [slice(None)] * array.ndim
    slice_list[axis] = slice_num
    slice_data = array[tuple(slice_list)].T  # transpose for proper orientation

    return slice_data
272537
function ndarrayLike( v ) {
	return v !== null &&
		typeof v === 'object' &&
		typeof v.data === 'object' &&
		typeof v.shape === 'object' &&
		typeof v.strides === 'object' &&
		typeof v.offset === 'number' &&
		typeof v.dtype === 'string' &&
		typeof v.length === 'number';
}
989841
function cmax( arr ) {
	if ( !Array.isArray( arr ) ) {
		throw new TypeError( 'cmax()::invalid input argument. Must provide an array.' );
	}
	var len = arr.length,
		v = new Array( len ),
		max;

	max = arr[ 0 ];
	v[ 0 ] = max;
	for ( var i = 1; i < len; i++ ) {
		if ( arr[ i ] > max ) {
			max = arr[ i ];
		}
		v[ i ] = max;
	}
	return v;
}
1031191
def diag_indices(k=0)
      if ndim < 2
        raise NArray::ShapeError, "must be >= 2-dimensional array"
      end
      m,n = shape[-2..-1]
      NArray.diag_indices(m,n,k)
    end
430090
function scorePattern(point, ratios, matrix) {
        try {
            const horizontalRun = countBlackWhiteRun(point, { x: -1, y: point.y }, matrix, ratios.length);
            const verticalRun = countBlackWhiteRun(point, { x: point.x, y: -1 }, matrix, ratios.length);
            const topLeftPoint = {
                x: Math.max(0, point.x - point.y) - 1,
                y: Math.max(0, point.y - point.x) - 1,
            };
            const topLeftBottomRightRun = countBlackWhiteRun(point, topLeftPoint, matrix, ratios.length);
            const bottomLeftPoint = {
                x: Math.min(matrix.width, point.x + point.y) + 1,
                y: Math.min(matrix.height, point.y + point.x) + 1,
            };
            const bottomLeftTopRightRun = countBlackWhiteRun(point, bottomLeftPoint, matrix, ratios.length);
            const horzError = scoreBlackWhiteRun(horizontalRun, ratios);
            const vertError = scoreBlackWhiteRun(verticalRun, ratios);
            const diagDownError = scoreBlackWhiteRun(topLeftBottomRightRun, ratios);
            const diagUpError = scoreBlackWhiteRun(bottomLeftTopRightRun, ratios);
            const ratioError = Math.sqrt(horzError.error * horzError.error +
                vertError.error * vertError.error +
                diagDownError.error * diagDownError.error +
                diagUpError.error * diagUpError.error);
            const avgSize = (horzError.averageSize + vertError.averageSize + diagDownError.averageSize + diagUpError.averageSize) / 4;
            const sizeError = (Math.pow((horzError.averageSize - avgSize), 2) +
                Math.pow((vertError.averageSize - avgSize), 2) +
                Math.pow((diagDownError.averageSize - avgSize), 2) +
                Math.pow((diagUpError.averageSize - avgSize), 2)) / avgSize;
            return ratioError + sizeError;
        }
        catch (_a) {
            return Infinity;
        }
    }
329808
def toRanks(A):
    
    AA=sp.zeros_like(A)
    for i in range(A.shape[1]):
        AA[:,i] = st.rankdata(A[:,i])
    AA=sp.array(sp.around(AA),dtype="int")-1
    return AA
728034
function(array) {
				array = array || [];
				var i = 0;
				var l = this.vertices.length;
				for (var j=0;j<l;j++) {
					var v = this.vertices[j];
					array[i++] = v.x;
					array[i++] = v.y;
					array[i++] = v.z;
				}
				return array;
			}
430908
def _ndarray_assoc(arr, k, v):
    ''
    arr = np.array(arr)
    arr[k] = v
    arr.setflags(write=False)
    return arr
80253
def _subArrayShape(self):
        
        fieldName = self.nodeName
        fieldDtype = self._array.dtype.fields[fieldName][0]
        return fieldDtype.shape
1268808
def out_shape_from_array(arr):
    """"""
    arr = np.asarray(arr)
    if arr.ndim == 1:
        return arr.shape
    else:
        return (arr.shape[1],)
333540
def f(self, m):
        '''  '''
        M = reshape(m,self.input_dim)
        n = M.shape[0]
        if M.shape[1] != self.input_dim:
            return 'Wrong input dimension'
        else:
            S = self.environment.update(M)
            m = M[0]
            s = S[0]
            # Store the points (m,s) explored during the optimisation
            self.pointsList.append((m,s))
            return self.dist_array(S)
787683
def ndim(self):
        """"""
        if self.is_raster():
            return {
                FeatureType.DATA: 4,
                FeatureType.MASK: 4,
                FeatureType.SCALAR: 2,
                FeatureType.LABEL: 2,
                FeatureType.DATA_TIMELESS: 3,
                FeatureType.MASK_TIMELESS: 3,
                FeatureType.SCALAR_TIMELESS: 1,
                FeatureType.LABEL_TIMELESS: 1
            }[self]
        return None