agentscript0 icon indicating copy to clipboard operation
agentscript0 copied to clipboard

ABM.DataSet fails silently if passed a sparse array

Open bennlich opened this issue 10 years ago • 2 comments

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

bennlich avatar Feb 19 '15 23:02 bennlich

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.

backspaces avatar Feb 20 '15 05:02 backspaces

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.)

bennlich avatar Feb 20 '15 17:02 bennlich