Inherits from
- AbstractArray: enthought.traits.trait_numeric.AbstractArray
Attributes
Inherited from base classes
Method summary
- __init__(self, dtype = None, shape = None, value = None, typecode = None, **metadata)
Inherited from base classes
- arg_error(self, method, arg_num, object, name, value)
- create_editor(self)
- dup_arg_error(self, method, arg_num, object, name)
- error(self, object, name, value)
- full_info(self, object, name, value)
- inner_traits(self)
- is_valid(self, object, name, value)
- keyword_error(self, method, object, name, value)
- missing_arg_error(self, method, arg_num, object, name)
- repr(self, value)
- return_error(self, method, object, value)
Methods
- __init__(self, dtype = None, shape = None, value = None, typecode = None, **metadata)
Returns a CArray trait.
Parameters
- dtype : a numpy dtype (e.g., int32)
- The type of elements in the array
- shape : a tuple
- Describes the required shape of any assigned value. Wildcards and ranges are allowed. The value None within the shape tuple means that the corresponding dimension is not checked. (For example, shape=(None,3) means that the first dimension can be any size, but the second must be 3.) A two-element tuple within the shape tuple means that the dimension must be in the specified range. The second element can be None to indicate that there is no upper bound. (For example, shape=((3,5),(2,None)) means that the first dimension must be in the range 3 to 5 (inclusive), and the second dimension must be at least 2.)
- value : numpy array
- A default value for the array
Default Value
value or zeros(min(shape)), where min(shape) refers to the minimum shape allowed by the array. If shape is not specified, the minimum shape is (0,).
Description
The trait returned by CArray() is similar to that returned by Array(), except that it allows both upcasting and downcasting of assigned values that are already numpy arrays. It automatically casts tuples and lists of the right shape to the specified dtype (just like numpy's array does).