Defines common utilities objects that don’t fall in any specific category.
Performs a simple linear conversion of given array between the old and new ranges.
Parameters: |
|
---|---|
Returns: | |
Return type: | ndarray |
Examples
>>> a = np.linspace(0, 1, 10)
>>> linear_conversion(a, np.array([0, 1]), np.array([1, 10]))
array([ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.])
Implements supports for vivification of the underlying dict like data-structure, magical!
Returns: | |
---|---|
Return type: | defaultdict |
Examples
>>> vivified = vivification()
>>> vivified['my']['attribute'] = 1
>>> vivified['my']
defaultdict(<function vivification at 0x...>, {u'attribute': 1})
>>> vivified['my']['attribute']
1
Converts given vivified data-structure to dictionary.
Parameters: | vivified (defaultdict) – Vivified data-structure. |
---|---|
Returns: | |
Return type: | dict |
Examples
>>> vivified = vivification()
>>> vivified['my']['attribute'] = 1
>>> vivified_to_dict(vivified)
{u'my': {u'attribute': 1}}