From 8381580885f4fe473bc32c80b6f4a963c3719fa9 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 11 Jun 2020 19:25:10 +0100 Subject: [PATCH] KDTree further formatting review and typos --- release-packaging/Classes/FluidKDTree.sc | 40 ++++++++++--------- .../HelpSource/Classes/FluidKDTree.schelp | 14 +++---- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/release-packaging/Classes/FluidKDTree.sc b/release-packaging/Classes/FluidKDTree.sc index 2bc8b3e..4cf622f 100644 --- a/release-packaging/Classes/FluidKDTree.sc +++ b/release-packaging/Classes/FluidKDTree.sc @@ -1,27 +1,31 @@ FluidKDTree : FluidManipulationClient { - var id; + var id; - *new {|server| - var uid = UniqueID.next; - ^super.new(server,uid)!?{|inst|inst.init(uid);inst} - } + *new {|server| + var uid = UniqueID.next; + ^super.new(server,uid)!?{|inst|inst.init(uid);inst} + } - init {|uid| - id = uid; - } + init {|uid| + id = uid; + } - fit{|dataset,action| + fit{|dataset,action| dataset.asSymbol.postln; - this.prSendMsg(\fit,[dataset.asSymbol],action); - } + this.prSendMsg(\fit, [dataset.asSymbol], action); + } - kNearest{ |buffer, k,action| - this.prSendMsg(\kNearest,[buffer.asUGenInput,k],action,k.collect{string(FluidMessageResponse,_,_)}); - } - - kNearestDist { |buffer, k,action| - this.prSendMsg(\kNearestDist,[buffer.asUGenInput,k],action,[numbers(FluidMessageResponse,_,k,_)]); - } + kNearest{ |buffer, k,action| + this.prSendMsg(\kNearest, + [buffer.asUGenInput,k], action, + k.collect{string(FluidMessageResponse,_,_)} + ); + } + kNearestDist { |buffer, k,action| + this.prSendMsg(\kNearestDist, [buffer.asUGenInput,k], action, + [numbers(FluidMessageResponse,_,k,_)] + ); + } } diff --git a/release-packaging/HelpSource/Classes/FluidKDTree.schelp b/release-packaging/HelpSource/Classes/FluidKDTree.schelp index 66877ef..679934e 100644 --- a/release-packaging/HelpSource/Classes/FluidKDTree.schelp +++ b/release-packaging/HelpSource/Classes/FluidKDTree.schelp @@ -11,9 +11,9 @@ See https://scikit-learn.org/stable/modules/neighbors.html#nearest-neighbor-algo CLASSMETHODS:: METHOD:: new -Make a new KDTree model for the given server +Make a new KDTree model for the given server. ARGUMENT:: server -The server on which to make the model +The server on which to make the model. INSTANCEMETHODS:: @@ -24,24 +24,24 @@ ARGUMENT:: dataset The LINK::Classes/FluidDataSet:: of interest. This can either be a data set object itself, or the name of one. ARGUMENT:: action -A function to run when indexing is complete +A function to run when indexing is complete. METHOD:: kNearest -Returns the IDs of the CODE::k:: points nearest to the one passed +Returns the IDs of the CODE::k:: points nearest to the one passed. ARGUMENT:: buffer A LINK::Classes/Buffer:: containing a data point to match against. The number of frames in the buffer must match the dimensionality of the LINK::Classes/FluidDataSet:: the tree was fitted to. ARGUMENT:: k -The number of neighbours to return +The number of neighbours to return. ARGUMENT:: action A function that will run when the query returns, whose argument is an array of point IDs from the tree's LINK::Classes/FluidDataSet:: METHOD:: kNearestDist -Get the distances of the K nearest neighbours to a point +Get the distances of the K nearest neighbours to a point. ARGUMENT:: buffer A LINK::Classes/Buffer:: containing a data point to match against. The number of frames in the buffer must match the dimensionality of the LINK::Classes/FluidDataSet:: the tree was fitted to. @@ -50,7 +50,7 @@ ARGUMENT:: k The number of neighbours to search ARGUMENT:: action -A function that will run when the query returns, whose argument is an array of distances +A function that will run when the query returns, whose argument is an array of distances. EXAMPLES::