当前位置: 首页>>代码示例>>Python>>正文


Python DictionaryTreeBrowser.add_node方法代码示例

本文整理汇总了Python中hyperspy.misc.utils.DictionaryTreeBrowser.add_node方法的典型用法代码示例。如果您正苦于以下问题:Python DictionaryTreeBrowser.add_node方法的具体用法?Python DictionaryTreeBrowser.add_node怎么用?Python DictionaryTreeBrowser.add_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hyperspy.misc.utils.DictionaryTreeBrowser的用法示例。


在下文中一共展示了DictionaryTreeBrowser.add_node方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_artificial_samfire

# 需要导入模块: from hyperspy.misc.utils import DictionaryTreeBrowser [as 别名]
# 或者: from hyperspy.misc.utils.DictionaryTreeBrowser import add_node [as 别名]
def create_artificial_samfire(shape):
    artificial_samfire = DictionaryTreeBrowser()
    artificial_samfire.add_node('running_pixels')
    artificial_samfire.running_pixels = []
    artificial_samfire.add_node('model')
    artificial_samfire.add_node('metadata')
    artificial_samfire.metadata.add_node('marker')
    artificial_samfire.metadata.marker = np.zeros(shape)
    artificial_samfire.add_node('_scale')
    artificial_samfire._scale = 1.0
    return artificial_samfire
开发者ID:jhemmelg,项目名称:hyperspy,代码行数:13,代码来源:test_strategy.py

示例2: setUp

# 需要导入模块: from hyperspy.misc.utils import DictionaryTreeBrowser [as 别名]
# 或者: from hyperspy.misc.utils.DictionaryTreeBrowser import add_node [as 别名]
 def setUp(self):
     self.w = ReducedChiSquaredWeight()
     artificial_model = DictionaryTreeBrowser()
     artificial_model.add_node('red_chisq.data')
     artificial_model.red_chisq.data = np.arange(35).reshape((5, 7))
     self.w.model = artificial_model
开发者ID:jhemmelg,项目名称:hyperspy,代码行数:8,代码来源:test_red_chisq_weight.py

示例3: Fitting

# 需要导入模块: from hyperspy.misc.utils import DictionaryTreeBrowser [as 别名]
# 或者: from hyperspy.misc.utils.DictionaryTreeBrowser import add_node [as 别名]

#.........这里部分代码省略.........
    update
        updates the current model with values, received from a worker
    log
        if _log exists, logs the arguments to the list.
    generate_values
        creates a generator to calculate values to be sent to the workers
    """

    __active_strategy_ind = 0
    _progressbar = None
    pool = None
    _figure = None
    optional_components = []
    running_pixels = []
    plot_every = 0
    save_every = np.nan
    _workers = None
    _args = None
    count = 0

    def __init__(self, model, workers=None, setup=True, **kwargs):
        # constants:
        if workers is None:
            workers = max(1, cpu_count() - 1)
        self.model = model
        self.metadata = DictionaryTreeBrowser()

        self._scale = 1.0
        # -1 -> done pixel, use
        # -2 -> done, ignore when diffusion
        #  0 -> bad fit/no info
        # >0 -> select when turn comes

        self.metadata.add_node('marker')
        self.metadata.add_node('goodness_test')

        marker = np.empty(self.model.axes_manager.navigation_shape[::-1])
        marker.fill(self._scale)

        self.metadata.marker = marker
        self.strategies = StrategyList(self)
        self.strategies.append(ReducedChiSquaredStrategy())
        self.strategies.append(HistogramStrategy())
        self._active_strategy_ind = 0
        self.update_every = max(10, workers * 2)  # some sensible number....
        from hyperspy.samfire_utils.fit_tests import red_chisq_test
        self.metadata.goodness_test = red_chisq_test(tolerance=1.0)
        self.metadata._gt_dump = None
        from hyperspy.samfire_utils.samfire_kernel import single_kernel
        self.single_kernel = single_kernel
        self._workers = workers
        if len(kwargs) or setup:
            self._setup(**kwargs)
        self.refresh_database()

    @property
    def active_strategy(self):
        """Returns the active strategy"""
        return self.strategies[self._active_strategy_ind]

    @active_strategy.setter
    def active_strategy(self, value):
        self.change_strategy(value)

    def _setup(self, **kwargs):
        """Set up SAMFire - configure models, set up pool if necessary"""
开发者ID:woozey,项目名称:hyperspy,代码行数:70,代码来源:samfire.py


注:本文中的hyperspy.misc.utils.DictionaryTreeBrowser.add_node方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。