glue-viz / glue

Linked Data Visualizations Across Multiple Files
http://glueviz.org
Other
728 stars 152 forks source link

2D histogram viewer #1382

Open astrofrog opened 7 years ago

astrofrog commented 7 years ago

We should implement a 2D histogram viewer

granttremblay commented 6 years ago

I know this is an old open issue, but I'd like to add my quick +1. Mapping a Chandra event list to an image really requires proper 2D histogram functionality. See below, for example, for a great use case, in which I map structures in Chandra/HRC three-tap amplitude space to what I'd like to be a real sky image. Without 2D histogram functionality, this is more difficult.

screen shot 2018-02-05 at 12 46 59 pm screen shot 2018-02-05 at 12 44 27 pm
astrofrog commented 6 years ago

@granttremblay - just to check, in your case, would the histogram be made by adding the amplitudes of all the photons? Or does each photon count equally?

astrofrog commented 6 years ago

Just for info, the latest developer version of glue includes a way to make density maps and adjust the DPI to effectively make 2D histograms. If you have a third quantity, you can color-code by the average value in each bin (but not yet the sum)

granttremblay commented 6 years ago

@astrofrog To make an Chandra "image" from an event list, it's simply the number of events per pixel, so a pure 2D histogram made of sums.

For example, if data is a table read from a Chandra events list, one would make an "image" from that events list with:


nbins = (300,300)

plt.hist2d(data['x'], data['y'], nbins)

Also, thanks for the info re: the developer version. If you could simply color code by sum of values in each bin, that would indeed be exactly what's needed.

astrofrog commented 6 years ago

@granttremblay - you can try the latest dev version with conda if you like:

conda install -c glueviz -c glueviz/label/dev glueviz

Currently you can color code by the counts in each bin, but not weighted counts. Give it a try!