FluidDataSet.renamePoint

This is killing me. Let’s say I have a DS with 10 data points, numbered in order. Then I remove dataPoint 6. Now I have points labeled 0, 1, 2, 3, 4, 5, 7, 8, 9. How do I make it so there is no gap with the current tools? I don’t think you can. All you need is .renamePoint, then:

(7…9).do{|i| ds.renamePoint(i, i-1)};

Also, come on, no animated gifs on this site?

1 Like

OK, so here is a functioning solution in the current situation. I think it is too ugly and too difficult.

~ds.dump({|vals| 
	i=2; //this is the value we have deleted
		if(vals["data"][i.asString]==nil){
			i.postln;
			((i+1)..(vals.size+1)).do{|i2|
				i2.postln;
				vals.postln;
				t = vals["data"][i2.asString];
				vals["data"].removeAt(i2.asString);
				vals["data"].add((i2-1).asString-> t);
		}};
	~ds.load(vals);
})
1 Like

I’ll add it to the wishlist

Isn’t the whole point of a dataset with a hash table like structure that it isn’t ordered?

So are you trying to iterate through the dataset? Why would it matter if individual entries are gone.

What I did in C-C-Combine when I load multiple corpora and start getting near the 1million entries point, is start automatically deleting entries below a certain loudness (using some useful shit @a.harker added to entrymatcher) and just leave it like that with gaping holes in it. I still query what I need, and get back valid entries, it just skips over “the holes”.

I’m not asking for the DataSet to be ordered. I am asking to be able to rename a point, which is useful well beyond this example.

I totally get the usefulness and limitations of a hash table. If this were just a dictionary, that would be fine. But it is actually a dictionary living beyond a firewall, where getting something simple, like the keys, requires you to dump the entire data set and rustle through the data for the thing you want:

~ds.dump({|vals| vals[“data”].keys.postln})

So, because it is behind a wall, I think some convenience classes for accessing/altering data are necessary.

1 Like

OK. I’m glad to be wrong. While I still think renaming a point is a valid idea, throwing out the OCD need to keep things tidy within my data structure is much cleaner than always rearranging things.

Yeah totally. I don’t know the specific implementation or implications are for SC, but having more ways to get stuff in and out of fluid.dataset~s would be fantastic.

At the moment it’s a bit of a strange thing where you can’t get stuff in and out directly, but it’s the central datatype/container for all the TB2 stuff.