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


Python abcdisplayer.ABCDisplayer类代码示例

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


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

示例1: compute_parameters

    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,代码行数:26,代码来源:connectivity.py

示例2: prepare_mapped_sensors_as_measure_points_params

def prepare_mapped_sensors_as_measure_points_params(project_id, sensors, eeg_cap=None):
    """
    Compute sensors positions by mapping them to the ``eeg_cap`` surface
    If ``eeg_cap`` is not specified the mapping will use a default EEGCal DataType in current project.
    If no default EEGCap is found, return sensors as they are (not projected)

    :returns: dictionary to be used in Viewers for rendering measure_points
    :rtype: dict
    """

    if eeg_cap is None:
        eeg_cap = dao.try_load_last_entity_of_type(project_id, EEGCap)

    if eeg_cap:
        datatype_kwargs = json.dumps({'surface_to_map': eeg_cap.gid})
        sensor_locations = ABCDisplayer.paths2url(sensors, 'sensors_to_surface') + '/' + datatype_kwargs
        sensor_no = sensors.number_of_sensors
        sensor_labels = ABCDisplayer.paths2url(sensors, 'labels')

        return {'urlMeasurePoints': sensor_locations,
                'urlMeasurePointsLabels': sensor_labels,
                'noOfMeasurePoints': sensor_no,
                'minMeasure': 0,
                'maxMeasure': sensor_no,
                'urlMeasure': ''}

    return prepare_sensors_as_measure_points_params(sensors)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:27,代码来源:sensors.py

示例3: get_sensor_measure_points

 def get_sensor_measure_points(sensors):
     """
         Returns urls from where to fetch the measure points and their labels
     """
     measure_points = ABCDisplayer.paths2url(sensors, 'locations')
     measure_points_no = sensors.number_of_sensors
     measure_points_labels = ABCDisplayer.paths2url(sensors, 'labels')
     return measure_points, measure_points_labels, measure_points_no
开发者ID:unimauro,项目名称:tvb-framework,代码行数:8,代码来源:brain.py

示例4: retrieve_measure_points

 def retrieve_measure_points(self, time_series):
     """
     To be overwritten method, for retrieving the measurement points (region centers, EEG sensors).
     """
     if isinstance(time_series, TimeSeriesSurface):
         return [], [], 0
     measure_points = ABCDisplayer.paths2url(time_series.connectivity, 'centres')
     measure_points_labels = ABCDisplayer.paths2url(time_series.connectivity, 'region_labels')
     measure_points_no = time_series.connectivity.number_of_regions
     return measure_points, measure_points_labels, measure_points_no
开发者ID:unimauro,项目名称:tvb-framework,代码行数:10,代码来源:brain.py

示例5: prepare_sensors_as_measure_points_params

def prepare_sensors_as_measure_points_params(sensors):
    """
    Returns urls from where to fetch the measure points and their labels
    """
    sensor_locations = ABCDisplayer.paths2url(sensors, 'locations')
    sensor_no = sensors.number_of_sensors
    sensor_labels = ABCDisplayer.paths2url(sensors, 'labels')

    return {'urlMeasurePoints': sensor_locations,
            'urlMeasurePointsLabels': sensor_labels,
            'noOfMeasurePoints': sensor_no,
            'minMeasure': 0,
            'maxMeasure': sensor_no,
            'urlMeasure': ''}
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:14,代码来源:sensors.py

示例6: compute_params

    def compute_params(self, region_mapping_volume=None, measure=None, data_slice='', background=None):

        region_mapping_volume = self._ensure_region_mapping(region_mapping_volume)

        volume = region_mapping_volume.volume
        volume_shape = region_mapping_volume.read_data_shape()
        volume_shape = (1, ) + volume_shape

        if measure is None:
            params = self._compute_region_volume_map_params(region_mapping_volume)
        else:
            params = self._compute_measure_params(region_mapping_volume, measure, data_slice)

        url_voxel_region = ABCDisplayer.paths2url(region_mapping_volume, "get_voxel_region", parameter="")

        params.update(volumeShape=json.dumps(volume_shape),
                      volumeOrigin=json.dumps(volume.origin.tolist()),
                      voxelUnit=volume.voxel_unit,
                      voxelSize=json.dumps(volume.voxel_size.tolist()),
                      urlVoxelRegion=url_voxel_region)

        if background is None:
            background = dao.try_load_last_entity_of_type(self.current_project_id, StructuralMRI)

        params.update(self._compute_background(background))
        return params
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:26,代码来源:region_volume_mapping.py

示例7: get_metric_matrix

    def get_metric_matrix(self, datatype_group, selected_metric=None):
        self.model = PseIsoModel.from_db(datatype_group.fk_operation_group)
        if selected_metric is None:
            selected_metric = self.model.metrics.keys()[0]

        data_matrix = self.model.apriori_data[selected_metric]
        data_matrix = numpy.rot90(data_matrix)
        data_matrix = numpy.flipud(data_matrix)
        matrix_data = ABCDisplayer.dump_with_precision(data_matrix.flat)
        matrix_guids = self.model.datatypes_gids
        matrix_guids = numpy.rot90(matrix_guids)
        matrix_shape = json.dumps(data_matrix.squeeze().shape)
        x_min = self.model.apriori_x[0]
        x_max = self.model.apriori_x[self.model.apriori_x.size - 1]
        y_min = self.model.apriori_y[0]
        y_max = self.model.apriori_y[self.model.apriori_y.size - 1]
        vmin = data_matrix.min()
        vmax = data_matrix.max()
        return dict(matrix_data=matrix_data,
                    matrix_guids=json.dumps(matrix_guids.flatten().tolist()),
                    matrix_shape=matrix_shape,
                    color_metric=selected_metric,
                    x_min=x_min,
                    x_max=x_max,
                    y_min=y_min,
                    y_max=y_max,
                    vmin=vmin,
                    vmax=vmax)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:28,代码来源:pse_isocline.py

示例8: launch

    def launch(self, **kwargs):
        self.log.debug("Plot started...")
        input_data = kwargs['input_data']
        shape = list(input_data.read_data_shape())
        state_list = input_data.source.labels_dimensions.get(input_data.source.labels_ordering[1], [])
        mode_list = range(shape[3])
        available_scales = ["Linear", "Logarithmic"]

        params = dict(matrix_shape=json.dumps([shape[0], shape[2]]),
                      plotName=input_data.source.type,
                      url_base=ABCDisplayer.paths2url(input_data, "get_fourier_data", parameter=""),
                      xAxisName="Frequency [kHz]",
                      yAxisName="Power",
                      available_scales=available_scales,
                      state_list=state_list,
                      mode_list=mode_list,
                      normalize_list=["no", "yes"],
                      normalize="no",
                      state_variable=state_list[0],
                      mode=mode_list[0],
                      xscale=available_scales[0],
                      yscale=available_scales[0],
                      x_values=json.dumps(input_data.frequency[slice(shape[0])].tolist()),
                      xmin=input_data.freq_step,
                      xmax=input_data.max_freq)
        return self.build_display_result("fourier_spectrum/view", params)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:26,代码来源:fourier_spectrum.py

示例9: launch

    def launch(self, connectivity):
        """Construct data for visualization and launch it."""

        pars = {"labels": json.dumps(connectivity.region_labels.tolist()),
                "url_base": ABCDisplayer.paths2url(connectivity, attribute_name="weights", flatten="True")
                }

        return self.build_display_result("connectivity_edge_bundle/view", pars)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:8,代码来源:connectivity_edge_bundle.py

示例10: retrieve_measure_points_prams

    def retrieve_measure_points_prams(self, time_series):
        """
        To be overwritten method, for retrieving the measurement points (region centers, EEG sensors).
        """
        if self.connectivity is None:
            self.measure_points_no = 0
            return {'urlMeasurePoints': [],
                    'urlMeasurePointsLabels': [],
                    'noOfMeasurePoints': 0}

        measure_points = ABCDisplayer.paths2url(self.connectivity, 'centres')
        measure_points_labels = ABCDisplayer.paths2url(self.connectivity, 'region_labels')
        self.measure_points_no = self.connectivity.number_of_regions

        return {'urlMeasurePoints': measure_points,
                'urlMeasurePointsLabels': measure_points_labels,
                'noOfMeasurePoints': self.measure_points_no}
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:17,代码来源:brain.py

示例11: _compute_background

 def _compute_background(background):
     if background is not None:
         min_value, max_value = background.get_min_max_values()
         url_volume_data = ABCDisplayer.paths2url(background, 'get_volume_view', parameter='')
     else:
         min_value, max_value = 0, 0
         url_volume_data = None
     return dict( minBackgroundValue=min_value, maxBackgroundValue=max_value,
                  urlBackgroundVolumeData = url_volume_data )
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:9,代码来源:region_volume_mapping.py

示例12: compute_raw_matrix_params

    def compute_raw_matrix_params(matrix):
        """
        Serializes matrix data, shape and stride metadata to json
        """
        matrix_data = ABCDisplayer.dump_with_precision(matrix.flat)
        matrix_shape = json.dumps(matrix.shape)

        return dict(matrix_data=matrix_data,
                    matrix_shape=matrix_shape)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:9,代码来源:matrix_viewer.py

示例13: launch

    def launch(self, datatype):
        """Construct data for visualization and launch it."""

        # get data from coher datatype, convert to json
        frequency = ABCDisplayer.dump_with_precision(datatype.get_data('frequency').flat)
        array_data = datatype.get_data('array_data')

        params = self.compute_raw_matrix_params(array_data)
        params.update(frequency=frequency)
        params.update(matrix_strides=json.dumps([x / array_data.itemsize for x in array_data.strides]))
        return self.build_display_result("cross_coherence/view", params)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:11,代码来源:cross_coherence.py

示例14: compute_sensor_surfacemapped_measure_points

    def compute_sensor_surfacemapped_measure_points(project_id, sensors, eeg_cap=None):
        """
        Compute sensors positions by mapping them to the ``eeg_cap`` surface
        If ``eeg_cap`` is not specified the mapping will use a default.
        It returns a url from where to fetch the positions
        If no default is available it returns None
        :returns: measure points, measure points labels, measure points number
        :rtype: tuple
        """

        if eeg_cap is None:
            eeg_cap = dao.get_values_of_datatype(project_id, EEGCap)[0]
            if eeg_cap:
                eeg_cap = ABCDisplayer.load_entity_by_gid(eeg_cap[-1][2])

        if eeg_cap:
            datatype_kwargs = json.dumps({'surface_to_map': eeg_cap.gid})
            measure_points = ABCDisplayer.paths2url(sensors, 'sensors_to_surface') + '/' + datatype_kwargs
            measure_points_no = sensors.number_of_sensors
            measure_points_labels = ABCDisplayer.paths2url(sensors, 'labels')
            return measure_points, measure_points_labels, measure_points_no
开发者ID:unimauro,项目名称:tvb-framework,代码行数:21,代码来源:brain.py

示例15: get_shell_surface_urls

    def get_shell_surface_urls(shell_surface=None, project_id=0):

        if shell_surface is None:
            shell_surface = dao.get_values_of_datatype(project_id, FaceSurface)[0]

            if not shell_surface:
                raise Exception('No face object found in database.')

            shell_surface = ABCDisplayer.load_entity_by_gid(shell_surface[0][2])

        face_vertices, face_normals, _, face_triangles = shell_surface.get_urls_for_rendering()
        return json.dumps([face_vertices, face_normals, face_triangles])
开发者ID:unimauro,项目名称:tvb-framework,代码行数:12,代码来源:brain.py


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