 # Mass-weighted Histogram

I’m using a dataset with AMR, and I’d like to create a histogram (for each time step) of the pressure. But what I know of the histogram filter only allows me to use the counts of the cells for the height of the bars in the histograms. That’s not so helpful because of the AMR–cell size is not consistent nor meaningful.

Is there a way to ask ParaView to make a histogram weighted by the mass in each cell?

My data is cell data.

I noticed that the histogram filter used:

``````>>> histogram2.SelectInputArray = ["CELLS", "Pressure (dyn/cm^2^)"]
``````

But I noticed that the “CELLS” gets passed into either of two Python `dict`s:
`ASSOCIATIONS = { 'POINTS' : 0, 'CELLS' : 1, 'FIELD' : 2, 'VERTICES' : 4, 'EDGES' : 5, 'ROWS' : 6} _LEGACY_ASSOCIATIONS = { 'POINT_DATA' : 0, 'CELL_DATA' : 1 }`

So it’s definitely not as simple as:

``````>>> histogram2.SelectInputArray = ['Mass (g) - 1', 'Pressure (dyn/cm^2^)']
``````

Any tips?

You probably needs to compute it this mass and use the calculator.

I’m not sure I understand your suggestion. For clarity, `'Mass (g) - 1'` is already cell data. `'Pressure (dyn/cm^2^)'` is also cell data.

When I make a histogram, is there a way to select the cells in one bin, sum the `'Mass (g) - 1'` field of those cells, and then use that as the height of that bin? If so, I would just iterate over each bin, I suppose.

Now I understand, I’m afraid this is not supported by the Histogram filter, you should be able to compute it yourself and show it in a BarChartView though.