Sounds like it could be a good match for `scipy.spatial.cKDTree`.
It can handle single-element queries...
>>> element = numpy.arange(1, 8)
>>> targets = numpy.random.uniform(0, 8, (1000, 7))
>>> tree = scipy.spatial.cKDTree(targets)
>>> distance, index = tree.query(element)
>>> targets[index]
arr
On Wed, May 2, 2012 at 1:06 PM, Moroney, Catherine M (388D)
wrote:
> Hello,
>
> Can somebody give me some hints as to how to code up this function
> in pure python, rather than dropping down to Fortran?
>
> I will want to compare a 7-element vector (called "element") to a large list
> of similarl
On Wed, May 2, 2012 at 11:06 AM, Moroney, Catherine M (388D)
wrote:
> I will want to compare a 7-element vector (called "element") to a large list
> of similarly-dimensioned
> vectors (called "target", and pick out the vector in "target" that is the
> closest to "element"
> (determined by minimi
Hello,
Can somebody give me some hints as to how to code up this function
in pure python, rather than dropping down to Fortran?
I will want to compare a 7-element vector (called "element") to a large list of
similarly-dimensioned
vectors (called "target", and pick out the vector in "target" that