Changes between Version 19 and Version 20 of coding_rules


Ignore:
Timestamp:
08/18/20 14:39:15 (5 years ago)
Author:
jdquinn
Comment:

Added documentation for find with compound condition

Legend:

Unmodified
Added
Removed
Modified
  • coding_rules

    v19 v20  
    138138Some notable omissions in the above sources are as follows:
    139139||= '''MATLAB''' =||= '''!NumPy''' =||= '''Notes''' =||
    140 || `find(a>0.5)` || `np.where(a>0.5)`[[BR]][[BR]]`np.where(a>0.5,a,a)` || find the indices where (a > 0.5)[[BR]][[BR]]When only the {{{condition}}} parameters is provided, this function is a shorthand for `np.asarray(condition).nonzero()`.[[BR]]Further, when working on a 1D array, this array must be passed in as a value for parameters `x` and `y` if the desired output is a single array of indices rather than a tuple of arrays.[[BR]][[BR]]Note as well that `a` must be of type `np.array` (or one of its subclasses): a {{{list}}} will not automatically be cast.[[BR]][[BR]]See also: https://numpy.org/doc/stable/reference/generated/numpy.where.html ||
     140|| `find(a>0.5)` || `np.where(a>0.5)`[[BR]][[BR]]`np.where(a>0.5,a,a)[0]` || find the indices where (a > 0.5)[[BR]][[BR]]When only the {{{condition}}} parameters is provided, this function is a shorthand for `np.asarray(condition).nonzero()`.[[BR]]Further, when working on a 1D array, this array must be passed in as a value for parameters `x` and `y` if the desired output is a single array of indices rather than a tuple of arrays.[[BR]][[BR]]Note as well that `a` must be of type `np.array` (or one of its subclasses): a {{{list}}} will not automatically be cast.[[BR]][[BR]]See also: https://numpy.org/doc/stable/reference/generated/numpy.where.html ||
     141|| `find('cond1' & 'cond2')` || `np.where(np.logical_and.reduce(('cond1', 'cond2'))[0]` || find the indices where 'cond1' and 'cond2' are met ||
    141142|| `<<cell_array>>{:}`  || `<<np.ndarray>>.flatten()` || Flatten a MATLAB cell array or Python ndarray ||
    142143== !Variable/Enum/Function Names ==