Ejemplo n.º 1
0
    def get(self, edge_ids=None, properties=None):  # pylint: disable=arguments-renamed
        """Edge properties as pandas DataFrame.

        Args:
            edge_ids (int/CircuitEdgeId/CircuitEdgeIds/sequence): same as Edges.ids().
            properties (None/str/list): an edge property name or a list of edge property names.
                If set to None ids are returned.

        Returns:
            pandas.Series/pandas.DataFrame:
                A pandas Series indexed by edge IDs if ``properties`` is scalar.
                A pandas DataFrame indexed by edge IDs if ``properties`` is list.

        Notes:
            The Edges.property_names function will give you all the usable properties
            for the `properties` argument.
        """
        if edge_ids is None:
            raise BluepySnapError("You need to set edge_ids in get.")
        if properties is None:
            Deprecate.warn(
                "Returning ids with get/properties is deprecated and will be removed in 1.0.0. "
                "Please use Edges.ids instead.")
            return edge_ids
        return super().get(edge_ids, properties)
Ejemplo n.º 2
0
    def _get(self, selection, properties=None):
        """Get an array of edge IDs or DataFrame with edge properties."""
        edge_ids = utils.ensure_ids(selection.flatten())
        if properties is None:
            Deprecate.warn(
                "Returning ids with get/properties is deprecated and will be removed in 1.0.0. "
                "Please use EdgePopulation.ids instead.")
            return edge_ids

        if utils.is_iterable(properties):
            if len(edge_ids) == 0:
                result = pd.DataFrame(columns=properties)
            else:
                result = pd.DataFrame(index=edge_ids)
                for p in properties:
                    result[p] = self._get_property(p, selection)
        else:
            if len(edge_ids) == 0:
                result = pd.Series(name=properties, dtype=np.float64)
            else:
                result = pd.Series(self._get_property(properties, selection),
                                   index=edge_ids,
                                   name=properties)

        return result
Ejemplo n.º 3
0
 def properties(self, edge_ids, properties):
     """Doc is overridden below."""
     Deprecate.warn(
         "EdgePopulation.properties function is deprecated and will be removed in 1.0.0. "
         "Please use EdgePopulation.get instead.")
     return self.get(edge_ids, properties)
Ejemplo n.º 4
0
 def properties(self, edge_ids, properties):
     """Doc is overridden below."""
     Deprecate.warn(
         "Edges.properties function will be deprecated in 1.0.0. Please use "
         "Edges.get instead.")
     return self.get(edge_ids, properties)