Issue #919: Reading ORION2 sink particle files (yt_analysis/yt)
New issue 919: Reading ORION2 sink particle files https://bitbucket.org/yt_analysis/yt/issue/919/reading-orion2-sink-particle-... Anonymous: yt is having problems reading empty ORION2 sink particle files (on the Chombo frontend). When I try to make a plot (e.g., a sliceplot) it also reads in the corresponding sink particle file but if no sink particles have been created yet the file will only contain "0 0" and this causes an IO error. Here's the traceback: <ipython-input-29-2969b1e8c4ac> in <module>() ----> 1 slcx =SlicePlot(pf, 'x', 'tracer1') /home/rosen/yt-x86_64/src/yt-hg/yt/visualization/plot_window.pyc in SlicePlot(ds, normal, fields, axis, *args, **kwargs) 1841 del kwargs['north_vector'] 1842 -> 1843 return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs) /home/rosen/yt-x86_64/src/yt-hg/yt/visualization/plot_window.pyc in __init__(self, ds, axis, fields, center, width, axes_unit, origin, fontsize, field_parameters, window_size, aspect) 1013 slc = ds.slice(axis, center[axis], 1014 field_parameters = field_parameters, center=center) -> 1015 slc.get_data(fields) 1016 PWViewerMPL.__init__(self, slc, bounds, origin=origin, 1017 fontsize=fontsize, fields=fields, /home/rosen/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields) 600 def get_data(self, fields=None): 601 if self._current_chunk is None: --> 602 self.index._identify_base_chunk(self) 603 if fields is None: return 604 nfields = [] /home/rosen/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in index(self) 127 if self._index is not None: 128 return self._index --> 129 self._index = self.ds.index 130 return self._index 131 /home/rosen/yt-x86_64/src/yt-hg/yt/data_objects/static_output.pyc in index(self) 272 raise RuntimeError("You should not instantiate Dataset.") 273 self._instantiated_index = self._index_class( --> 274 self, dataset_type=self.dataset_type) 275 # Now we do things that we need an instantiated index for 276 # ...first off, we create our field_info now. /home/rosen/yt-x86_64/src/yt-hg/yt/frontends/chombo/data_structures.pyc in __init__(self, ds, dataset_type) 522 523 def __init__(self, ds, dataset_type="orion_chombo_native"): --> 524 ChomboHierarchy.__init__(self, ds, dataset_type) 525 526 def _detect_output_fields(self): /home/rosen/yt-x86_64/src/yt-hg/yt/frontends/chombo/data_structures.pyc in __init__(self, ds, dataset_type) 116 self.float_type = self._handle['Chombo_global'].attrs['testReal'].dtype.name 117 self._levels = [key for key in self._handle.keys() if key.startswith('level')] --> 118 GridIndex.__init__(self, ds, dataset_type) 119 120 self._read_particles() /home/rosen/yt-x86_64/src/yt-hg/yt/geometry/geometry_handler.pyc in __init__(self, ds, dataset_type) 63 # potentially quite expensive, and should be done with the indexing. 64 mylog.debug("Detecting fields.") ---> 65 self._detect_output_fields() 66 67 def __del__(self): /home/rosen/yt-x86_64/src/yt-hg/yt/frontends/chombo/data_structures.pyc in _detect_output_fields(self) 536 self.particle_filename = self.index_filename[:-4] + 'sink' 537 if not os.path.exists(self.particle_filename): return --> 538 pfield_list = [("io", c) for c in self.io.particle_field_index.keys()] 539 self.field_list.extend(pfield_list) 540 /home/rosen/yt-x86_64/src/yt-hg/yt/frontends/chombo/io.pyc in particle_field_index(self) 279 fn = self.ds.fullplotdir[:-4] + "sink" 280 --> 281 index = parse_orion_sinks(fn) 282 283 self._particle_field_index = index /home/rosen/yt-x86_64/src/yt-hg/yt/frontends/chombo/io.pyc in parse_orion_sinks(fn) 224 with open(fn, 'r') as f: 225 lines = f.readlines() --> 226 line = lines[1] 227 228 # The basic fields that all sink particles have IndexError: list index out of range Responsible: atmyers
participants (1)
-
Anonymous