def launch(self, data_file, **kwargs): try: parser = NetworkxParser(self.storage_path, **kwargs) net = networkx.read_gpickle(data_file) connectivity = parser.parse(net) return [connectivity] except ParseException, excep: self.log.exception("Could not process Connectivity") raise LaunchException(excep)
def launch(self, view_model): # type: (NetworkxImporterModel) -> [ConnectivityIndex] try: parser = NetworkxParser(view_model) net = pandas.read_pickle(view_model.data_file) connectivity = parser.parse(net) return h5.store_complete(connectivity, self.storage_path) except ParseException as excep: self.log.exception("Could not process Connectivity") raise LaunchException(excep)
def _parse_connectome_network(self, connectome_network, warning_message, **kwargs): """ Parse data from a NetworkX object and save it in Connectivity DataTypes. """ connectivities = [] parser = NetworkxParser(self.storage_path, **kwargs) for net in connectome_network: try: net.load() connectivity = parser.parse(net.data) connectivity.user_tag_1 = connectivity.weights.shape[0] connectivities.append(connectivity) except ParseException: self.logger.exception("Could not process Connectivity") warning_message += "Problem when importing Connectivities!! \n" return connectivities