dfm / corner.py

Make some beautiful corner plots
http://corner.readthedocs.io
BSD 2-Clause "Simplified" License
513 stars 228 forks source link

Support for regularly-gridded data #160

Open jtlz2 opened 3 years ago

jtlz2 commented 3 years ago

Brilliant code etc., for which thanks.

I'd like to use corner for plotting (arbitrary) data that are already on a regular n-dimensional grid.

Is this supported?

Or do I have to sample from the grid and pass the samples into corner to invert them onto its internal grid..? :\

Thanks

dfm commented 3 years ago

This is not directly supported and I don't have plans for support since most of the code base is actually there to do sensible things with samples. Can you say more about what you'd like to get from corner in this case?

jtlz2 commented 3 years ago

I'd like to exploit corner's ability to elegantly plot projections of multi-dimensional functions/grids. Right now I think I would have two options:

  1. Sample from the high-dimensional numpy grid* (slow, poor scaling, ...) and ingest to corner; or,
  2. Roll my own corner plotter. I have done this before - but that was in the pre-corner days and seems a bit mediaeval. Do you know of any code out there that does this already?

It would be satisfying but strange in equal measure to have to call run a sampler just to get the plots out.

Otherwise to benefit from corner I'd need a way to inject/overlay the histogram on a sampler-derived one. Perhaps there is a way to hack / patch the code to do this?

*Could also of course be analytic, scipy function, etc.

dfm commented 3 years ago

This is an interesting question and it would certainly be possible to refactor the corner backend into a two step procedure: (1) compute the histograms, (2) do the plotting with a fixed grid. But this would require a pretty major reworking of the existing code because the two steps are very tightly coupled at this point. If I needed to do this, I would probably just roll my own, copying some of the source from src/corner/core.py. Sorry that I can't be more concrete!