SuperCollider: KDTree .write crashes server

Greetings,

KDTree seems to be working as described, however when I try to write it to a file the server crashes. A file is created, however it is empty. (see code below, just in case I’m doing something weird)

Thanks!

s.boot;

// choose number of dimensions
~n_dims = 23;

// make dummy data
~data = Array.fill(100,{Array.fill(~n_dims,{gauss(0.0,1.0)});});

~dataset.clear;
// create fluid dataset
~dataset = FluidDataSet(s,\test,~n_dims);

(
// go through all the dummy data points and add them as buffers
~data.do({
	arg datapoint,i;
	Buffer.loadCollection(s,datapoint,1,{
		arg buf;
		~dataset.addPoint(i.asSymbol,buf);
	});
});
)

// write dataset json
~dataset.write("/Users/ted/Desktop/datasettest_%.json".format(Date.localtime),{"json written".postln;});

// quit server
s.quit;

// server
s.boot;

// create fluid dataset
~dataset = FluidDataSet(s,\test,~n_dims);
~dataset.read("/Users/ted/Desktop/datasettest_Thu Dec 19 14:08:11 2019.json",{"dataset read".postln});

// make an empty buffer to fill with a specific data point from dataset
b = Buffer.alloc(s,23);

(
// put data point labeled 2 into buffer b
~dataset.getPoint(\2,b,{
	"done".postln;
	defer{b.plot};
});
)

// make a new kdtree
~kdtree = FluidKDTree.new;

(
// fit the kdtree to the dataset from above
~kdtree.fit(~dataset,{
	"done".postln;
});
)

(
// make a buffer with a new random data point and find datapoint closest to it in the set
Buffer.loadCollection(s,Array.fill(~n_dims,{gauss(0.0,1.0)}),1,{
	arg buf;
	~kdtree.kNearest(buf,1,{
		arg nearest_id;
		"done".postln;
		nearest_id.postln;
	});
});
)

(
// make a buffer with a new random data point and find distance to datapoint closest to it in the set
Buffer.loadCollection(s,Array.fill(~n_dims,{gauss(0.0,1.0)}),1,{
	arg buf;
	~kdtree.kNearestDist(buf,1,{
		arg distance;
		"done".postln;
		distance.postln;
	});
});
)

// check dim
~kdtree.cols({arg cols; cols.postln;});

// write kdtree json
~kdtree.write("/Users/ted/Desktop/kdtreetest.json",{"json written".postln;}); // SERVER CRASHES

// =============================================

Hello!

Nice catch! I’ll check if it is the case with other CCEs and will hopefully sort soon.

Still crashing the server.

yes, because you still have the same toolset (alpha01). Thanks for your patience.