I hope that somebody can provide some clarification on how the numpy.where() function works. After trying out several different inputs, I cannot wrap my head around it. Taking the first example below, the output of:
np.where([True,False],[1,0],[3,4])
is:
array([1, 4])
How exactly is the array of Boolean values being applied to the arrays [1,0] and [3,4] to yield the output?
Results of some additional testing are shown below:
import numpy as np
np.where([True,False],[1,0],[3,4])
Out[129]: array([1, 4])
np.where([True,False],[1,0],[6,4])
Out[130]: array([1, 4])
np.where([True,False],[1,0],[0,0])
Out[131]: array([1, 0])
np.where([True,False],[0,0],[0,0])
Out[132]: array([0, 0])
np.where([True,False],[1,0],[0,12])
Out[133]: array([ 1, 12])
np.where([True,False],[1,6],[4,12])
Out[134]: array([ 1, 12])
np.where([True,True],[1,6],[4,12])
Out[135]: array([1, 6])
np.where([False,False],[1,6],[4,12])
Out[136]: array([ 4, 12])
np.where([True,False],[1,0],[3,4])
Out[137]: array([1, 4])
np.where([True,True],[1,0],[3,4])
Out[138]: array([1, 0])
np.where([True,True],[1,0],[3,4])
Out[139]: array([1, 0])
np.where([True,False],[1,0],[3,4])
Out[140]: array([1, 4])