[yt-users] Support for boxlib-style orion files

Nathan Goldbaum nathan12343 at gmail.com
Tue Oct 2 11:40:21 PDT 2012


Hi Mark,

If you look inside the orion frontend, specifically at yt/frontends/orion/data_structures.py, you'll see that there is a _is_valid() method associated with the orion output class.  This method is called by the load() function to check to see if an output is an orion output file. There is a corresponding _is_valid() method associated with all of the possible output types and the load function calls each of them every time it tries to open a file. For convenience I'll paste the orion _is_valid() here:

    def _is_valid(cls, *args, **kwargs):                                                                                             
        # fill our args                                                                                                              
        pname = args[0].rstrip("/")                                                                                                  
        dn = os.path.dirname(pname)                                                                                                  
        if len(args) > 1: kwargs['paramFilename'] = args[1]                                                                          
        pfname = kwargs.get("paramFilename", os.path.join(dn, "inputs"))                                                             
                                                                                                                                     
        # We check for the job_info file's existence because this is currently                                                       
        # what distinguishes Orion data from MAESTRO data.                                                                           
        pfn = os.path.join(pfname)                                                                                                   
        if not os.path.exists(pfn): return False                                                                                     
        castro = any(("castro." in line for line in open(pfn)))                                                                      
        nyx = any(("nyx." in line for line in open(pfn)))                                                                            
        maestro = os.path.exists(os.path.join(pname, "job_info"))                                                                    
        really_orion = any(("geometry.prob_lo" in line for line in open(pfn)))                                                       
        orion = (not castro) and (not maestro) and (not nyx) and really_orion                                                        
        return orion                                                      

First, it checks to see if the parameter file you're supplying to the load function actually exist.  Next, it looks for some files that are dumped by Nyx and Maestro (two other boxlib codes with similar output formats) and a geometry.prob_lo file that it assumes must be dumped by orion.  In the past, we've had some trouble with orion outputs being mistaken for Nyx or maestro outputs.  

Unfortunately it's difficult to say exactly what's going wrong without access to the simulation output you're trying to open.  One way for you to figure out what's happening is to stick a call to pdb (the python debugger) right before the both of the return statements.  One calls pdb by placing a call to pdb.set_trace() somewhere in the source code.  You may need to import pdb first.  When the python interpreter reaches the pdb.set_trace() call, you'll be dumped into a pdb session which is controlled exactly like a gdb session.

Hope that's helpful.  Please let us know if you figure out what's happening here.

Nathan

On Oct 2, 2012, at 11:17 AM, Mark Krumholz wrote:

> 
> Hi yt list,
> 
> I just upgraded to the latest and greatest yt release, and I discovered that I can no longer read BoxLib-style (i.e. older style) ORION output files. When I try, I get
> 
> In [1]: pf=load('plt05230')
> yt : [ERROR    ] 2012-10-02 11:14:41,142 Couldn't figure out output type for plt05230
> ---------------------------------------------------------------------------
> YTOutputNotIdentified                     Traceback (most recent call last)
> /Users/krumholz/Library/yt/yt-x86_64/src/yt-hg/scripts/iyt in <module>()
> ----> 1 pf=load('plt05230')
> 
> /Users/krumholz/Library/yt/yt-x86_64/src/yt-hg/yt/convenience.pyc in load(*args, **kwargs)
>     81                 return output_type_registry[n](fn)
>     82         mylog.error("Couldn't figure out output type for %s", args[0])
> ---> 83         raise YTOutputNotIdentified(args, kwargs)
>     84     mylog.error("Multiple output type candidates for %s:", args[0])
>     85     for c in candidates:
> 
> YTOutputNotIdentified: Supplied ('plt05230',) {}, but could not load!
> 
> This file was previously readable with an older version of yt, so something about the recent upgrade seems to have broken compatibility with these older files. Any suggestions?
> 
> --
> Mark Krumholz
> 
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org




More information about the yt-users mailing list