agentscript0
agentscript0 copied to clipboard
ABM.DataSet fails silently if passed a sparse array
E.g.
var myDataSet = new ABM.DataSet(100, 100, new Array(100*100));
myDataSet.setXY(10, 10, 255);
var img = myDataSet.toImage();
img ends up being all black
I think this is the result you'd expect. The data is all 0 (black) except for the 10,10 point that would be blue, if I recall correctly
But you have a point, converting to an image is mainly import/export when not image (pixel) data. We should pass in a pixel creation procedure much like the image import stunt.
Let me look and see if I have a sketch for image conversions, I forget how I meant the data to be visualized. Grayscale makes the most sense, but if the data values are large (>256) direct visualization may be useful.
Colormaps may be useful here: mapping data to color is what they are designed for.
I think this is the result you'd expect. The data is all 0 (black) except for the 10,10 point that would be blue, if I recall correctly
Err--I think it should be setting the pixel at (10, 10) to white, no? No white pixels in the image though. I think something is breaking, maybe during normalization? (Just a guess.)