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, data_file, **kwargs): try: parser = NetworkxParser(self.storage_path, **kwargs) net = networkx.read_gpickle(data_file) connectivity = parser.parse(net) return [connectivity] except ParseException as 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 get_upload_input_tree(self): tree = [{'name': 'data_file', 'type': 'upload', 'required_type': '.gpickle', 'label': 'Please select file to import', 'required': True}] tree.extend(NetworkxParser.prepare_input_params_tree()) return tree
def get_upload_input_tree(self): """ Define as input parameter, a CFF archive. """ tree = [{ 'name': 'cff', 'type': 'upload', 'required_type': '.cff', 'label': 'CFF archive', 'required': True, 'description': 'Connectome File Format archive expected' }] tree.extend( NetworkxParser.prepare_input_params_tree(prefix="CNetwork: ")) tree.append({ 'name': 'should_center', 'type': 'bool', 'default': False, 'label': 'CSurface: Center surfaces', 'description': 'Center surfaces using vertices positions mean along axes' }) return tree
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 = str(connectivity.weights.shape[0]) + " regions" connectivities.append(connectivity) except ParseException: self.logger.exception("Could not process Connectivity") warning_message += "Problem when importing Connectivities!! \n" return connectivities
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
def get_upload_input_tree(self): """ Define as input parameter, a CFF archive. """ tree = [{'name': 'cff', 'type': 'upload', 'required_type': '.cff', 'label': 'CFF archive', 'required': True, 'description': 'Connectome File Format archive expected'}] tree.extend(NetworkxParser.prepare_input_params_tree(prefix="CNetwork: ")) tree.append({'name': 'should_center', 'type': 'bool', 'default': False, 'label': 'CSurface: Center surfaces', 'description': 'Center surfaces using vertices positions mean along axes'}) return tree
def get_upload_input_tree(self): tree = [ { "name": "data_file", "type": "upload", "required_type": ".gpickle", "label": "Please select file to import", "required": True, } ] tree.extend(NetworkxParser.prepare_input_params_tree()) return tree