def log(self): """Get the flattened dictionary for consumption by GSD object.""" log = dict() for key, value in dict_flatten(self.logger.log()).items(): log_value, type_flag = value type_flag = TypeFlags[type_flag] # This has to be checked first since type_shapes has a flag # TypeFlags.object. if key[-1] in self._special_keys: self._log_special(log, key[-1], log_value) # Now we can skip any flags we don't process, in this case # TypeFlags.object. if type_flag not in self._skip_flags: if log_value is None: continue else: # This places logged quantities that are # per-{particle,bond,...} into the correct GSD namespace # log/particles/{remaining namespace}. This preserves OVITO # intergration. if type_flag in self._per_flags: log['/'.join((self._global_prepend, type_flag.name + 's') + key)] = log_value elif type_flag in self._convert_flags: self._log_convert_value( log, '/'.join((self._global_prepend,) + key), type_flag, log_value) else: log['/'.join((self._global_prepend,) + key)] = \ log_value else: pass return log
def log(self): """Get the flattened dictionary for consumption by GSD object.""" log = dict() for key, value in dict_flatten(self.logger.log()).items(): if 'state' in key and _iterable_is_incomplete(value[0]): pass log_value, type_category = value type_category = LoggerCategories[type_category] # This has to be checked first since type_shapes has a category # LoggerCategories.object. if key[-1] in self._special_keys: self._log_special(log, key[-1], log_value) # Now we can skip any categories we don't process, in this case # LoggerCategories.object. if type_category not in self._skip_categories: if log_value is None: continue else: # This places logged quantities that are # per-{particle,bond,...} into the correct GSD namespace # log/particles/{remaining namespace}. This preserves OVITO # intergration. if type_category in self._per_categories: log['/'.join((self._global_prepend, type_category.name + 's') + key)] = log_value elif type_category in self._convert_categories: self._log_convert_value( log, '/'.join((self._global_prepend,) + key), type_category, log_value) else: log['/'.join((self._global_prepend,) + key)] = \ log_value else: pass return log
def _get_log_dict(self): """Get a flattened dict for writing to output.""" return { key: value[0] for key, value in dict_flatten(self.logger.log()).items() }