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


Python ABCDisplayer.get_one_dimensional_list方法代码示例

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


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

示例1: compute_parameters

# 需要导入模块: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 别名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import get_one_dimensional_list [as 别名]
    def compute_parameters(input_data, colors=None, rays=None):
        """
        Having as inputs a Connectivity matrix(required) and two arrays that 
        represent the rays and colors of the nodes from the matrix(optional) 
        this method will build the required parameter dictionary that will be 
        sent to the HTML/JS 3D representation of the connectivity matrix.
        """
        if colors is not None:
            color_list = colors.array_data.tolist()
            color_list = ABCDisplayer.get_one_dimensional_list(color_list, input_data.number_of_regions,
                                                               "Invalid input size for Sphere Colors")
            color_list = numpy.nan_to_num(numpy.array(color_list, dtype=numpy.float64)).tolist()
        else:
            color_list = [1.0] * input_data.number_of_regions

        if rays is not None:
            rays_list = rays.array_data.tolist()
            rays_list = ABCDisplayer.get_one_dimensional_list(rays_list, input_data.number_of_regions,
                                                              "Invalid input size for Sphere Sizes")
            rays_list = numpy.nan_to_num(numpy.array(rays_list, dtype=numpy.float64)).tolist()
        else:
            rays_list = [1.0] * input_data.number_of_regions

        params = dict(raysArray=json.dumps(rays_list), rayMin=min(rays_list), rayMax=max(rays_list),
                      colorsArray=json.dumps(color_list), colorMin=min(color_list), colorMax=max(color_list))
        return params, {}
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:28,代码来源:connectivity.py

示例2: _prepare_colors

# 需要导入模块: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 别名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import get_one_dimensional_list [as 别名]
 def _prepare_colors(self, colors, expected_size, step=None):
     """
     From the input array, all values smaller than step will get a different color
     """
     if colors is None:
         return [self.DEFAULT_COLOR] * expected_size, None
     colors = numpy.nan_to_num(numpy.array(colors.array_data, dtype=numpy.float64)).tolist()
     colors = ABCDisplayer.get_one_dimensional_list(colors, expected_size, "Invalid size for colors array!")
     result = []
     if step is None:
         step = (max(colors) + min(colors)) / 2
     for val in colors:
         if val < step:
             result.append(self.OTHER_COLOR)
         else:
             result.append(self.DEFAULT_COLOR)
     return result, step
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:19,代码来源:connectivity.py

示例3: _normalize_rays

# 需要导入模块: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 别名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import get_one_dimensional_list [as 别名]
 def _normalize_rays(self, rays, expected_size):
     """
     Make sure all rays are in the interval [self.MIN_RAY, self.MAX_RAY]
     """
     if rays is None:
         value = (self.MAX_RAY + self.MIN_RAY) / 2
         return [value] * expected_size, 0.0, 0.0
     rays = rays.array_data.tolist()
     rays = ABCDisplayer.get_one_dimensional_list(rays, expected_size, "Invalid size for rays array.")
     min_x = min(rays)
     max_x = max(rays)
     if min_x >= self.MIN_RAY and max_x <= self.MAX_RAY:
         # No need to normalize
         return rays, min_x, max_x
     result = []
     diff = max_x - min_x
     if min_x == max_x:
         diff = self.MAX_RAY - self.MIN_RAY
     for ray in rays:
         result.append(self.MIN_RAY + self.MAX_RAY * (ray - min_x) / diff)
     result = numpy.nan_to_num(numpy.array(result, dtype=numpy.float64)).tolist()
     return result, min(rays), max(rays)
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:24,代码来源:connectivity.py


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