[FLASH-USERS] understanding HDF5 data structures

John ZuHone jzuhone at milkyway.gsfc.nasa.gov
Wed Jun 11 11:28:57 EDT 2014


Hi Jonathan,

(re-posting this to the list because other people may find it helpful)

yt is still probably your best bet for getting at the raw data and then plotting it in matplotlib. You can make raw slice and projection objects (that are not plots) and regrid them to a uniform cell spacing, which in yt parlance is called a "FixedResolutionBuffer". There is an example of how to create a FixedResolutionBuffer from a projection in yt that you can feed to matplotlib here: 

http://yt-project.org/docs/dev-3.0/visualizing/manual_plotting.html#fixed-resolution-buffers

If you were trying to do a slice, then you would replace the logic and the call to "pf.proj" in that example with something like this:

slc = pf.slice(0, c[0])
width = (10, 'kpc') # we want a 10 kpc view
res = [1000, 1000] # create an image with 1000x1000 pixels
frb = slc.to_frb(width, res, center=c)

Best,

John

On Jun 11, 2014, at 11:16 AM, Slavin, Jonathan <jslavin at cfa.harvard.edu> wrote:

> Hi John,
> 
> I'm sorry I never got a chance to discuss FLASH when you were here. Beyond any particular application, I'd like to understand the data storage itself.  
> 
> I've looked at the yt documentation and did not get any insights from that.  In any case, I prefer to do my plotting within matplotlib because of its interactivity -- which is now available using the flash python module as a means to get the output into an array.
> 
> So could you tell me how yt or other routines translate the hdf5 dataset items into arrays?  Or tell me what routines I should look at?  (I do have yt installed.)
> 
> Thanks,
> Jon 
> 
> 
> On Wed, Jun 11, 2014 at 10:51 AM, John ZuHone <jzuhone at milkyway.gsfc.nasa.gov> wrote:
> Hi Jonathan,
> 
> How that is done "under the hood" is probably pretty similar across the different analysis packages, but the implementations are still going to be rather different. 
> 
> In particular, for a slice, the analysis package is going to do some version of looping over grids that intersect with the slice plane and interpolating the relevant cells to a fixed resolution buffer.  
> 
> A good example is the yt project: http://yt-project.org, which fully supports FLASH data. 
> 
> Did you have a particular application in mind? 
> 
> Best,
> 
> John Z
> 
> On Jun 11, 2014, at 10:45 AM, Slavin, Jonathan <jslavin at cfa.harvard.edu> wrote:
> 
>> Hi all,
>> 
>> I'm new to using flash and just trying to understand the output in HDF5.  For example, when I read in the data from a plot file via h5py:
>> >>> f = h5py.File('sedov_forced_hdf5_plt_cnt_0000')
>> I get
>> >>> dens = f['dens']
>> >>> dens.shape
>> (517, 1, 8, 8)
>> I assume that somehow the various python or IDL output routines that create plots are using other information about grid refinement to create arrays that can be plotted directly (e.g. to create slices).  I'd like to know how that is done under the hood.  Any help would be appreciated.
>> 
>> Jon
>> 
>> -- 
>> ________________________________________________________
>> Jonathan D. Slavin                 Harvard-Smithsonian CfA
>> jslavin at cfa.harvard.edu       60 Garden Street, MS 83
>> phone: (617) 496-7981       Cambridge, MA 02138-1516
>> fax: (617) 496-7577            USA
>> ________________________________________________________
>> 
> 
> 
> 
> 
> -- 
> ________________________________________________________
> Jonathan D. Slavin                 Harvard-Smithsonian CfA
> jslavin at cfa.harvard.edu       60 Garden Street, MS 83
> phone: (617) 496-7981       Cambridge, MA 02138-1516
> fax: (617) 496-7577            USA
> ________________________________________________________
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20140611/b95fe3f8/attachment.htm>


More information about the flash-users mailing list