def _group_or_panel_from_dict(d, obj): ''' Convert a dictionary to a group or panel and add to model. ''' base = VirtualPanel.from_dict(d) obj.set_type(base.get_type()) obj.set_name(base.get_name()) obj.set_local_frame( base.get_local_fast_axis(), base.get_local_slow_axis(), base.get_local_origin()) for child in d['children']: if 'panel' in child: index = child['panel'] obj.add_panel(obj.root()._container[index]) else: HierarchicalDetector._group_or_panel_from_dict(child, obj.add_group())