Automatically create data sources as necessary from arrays, dicts, dataframes
#1,499 opened on Jul 19, 2017
Repository metrics
- Stars
- (556 stars)
- PR merge metrics
- (PR metrics pending)
Description
A common operation that people want to do is, for instance, something like "Give me a phase plot of this thing!" But they may not have gone through the entire process of building out a dataset through load_uniform_grid and then selecting all_data() but it's just as valid.
One straightforward way of addressing this would be to build out a mechanism for automatically converting guessable formats into datasets. This would work nicely for things like phase plots and profile plots, but if the appropriate arrays and records are available, it could be just as useful to do this for projections and slices as well.
As a few examples:
- Dataframes from pandas: these are trivially convertable to a data source for phase plots and profile plots, even if not spatially organized.
- A dict-of-arrays could also work the same way.
- A single array (of 2 or 3 dimensions, or with an appropriate dtype) fed in could be done similarly.
For projection and slice plots, it could be something like looking for records like x, etc, and then creating the dataset based on the extent.
The endpoint might look something like:
my_data = dict( x = ..., y = ..., z = ..., density = ..., temperature = ...)
yt.PhasePlot(my_array, "density", "temperature")
This would substantially lower the barrier to entry for using yt functionality, and would not be limited to plots; this could also work for other top-level operations.