def update(): """ Update TVB code to SVN revision version 4455. This update was done for release 1.0.2. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: user = dao.get_system_user() adapter = ObjSurfaceImporter() OperationService().fire_operation(adapter, user, project.id, visible=False, surface_type=EEG_CAP, data_file=DATA_FILE_EEG_CAP) adapter = ObjSurfaceImporter() OperationService().fire_operation(adapter, user, project.id, visible=False, surface_type=FACE, data_file=DATA_FILE_FACE) except Exception as excep: LOGGER.exception(excep) TvbProfile.current.manager.add_entries_to_config_file( {stored.KEY_MATLAB_EXECUTABLE: get_matlab_executable()})
def update(): """ Move images previously stored in TVB operation folders, in a single folder/project. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: figures = _figures_in_project(project.id) for figure in figures: figure.file_path = "%s-%s" % (figure.operation.id, figure.file_path) dao.store_entities(figures) project_path = FilesHelper().get_project_folder(project) update_manager = ProjectUpdateManager(project_path) update_manager.run_all_updates() project.version = TvbProfile.current.version.PROJECT_VERSION dao.store_entity(project)
def update(): """ Move images previously stored in TVB operation folders, in a single folder/project. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_end=min(page_start + PAGE_SIZE, projects_count)) for project in projects_page: figures = _figures_in_project(project.id) for figure in figures: figure.file_path = "%s-%s" % (figure.operation.id, figure.file_path) dao.store_entities(figures) project_path = FilesHelper().get_project_folder(project) update_manager = ProjectUpdateManager(project_path) update_manager.run_all_updates() project.version = TvbProfile.current.version.PROJECT_VERSION dao.store_entity(project)
def update(): """ Update TVB code to SVN revision version 4455. This update was done for release 1.0.2. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: user = dao.get_system_user() adapter = ObjSurfaceImporter() FlowService().fire_operation(adapter, user, project.id, visible=False, surface_type=EEG_CAP, data_file=DATA_FILE_EEG_CAP) adapter = ObjSurfaceImporter() FlowService().fire_operation(adapter, user, project.id, visible=False, surface_type=FACE, data_file=DATA_FILE_FACE) except Exception as excep: LOGGER.exception(excep) TvbProfile.current.manager.add_entries_to_config_file({stored.KEY_MATLAB_EXECUTABLE: get_matlab_executable()})
def update(): """ Update TVB code to SVN revision version 4455. This update was done for release 1.0.2. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: user = dao.get_system_user() adapter = ObjSurfaceImporter() FlowService().fire_operation(adapter, user, project.id, visible=False, surface_type=EEG_CAP, data_file=DATA_FILE_EEG_CAP) adapter = ObjSurfaceImporter() FlowService().fire_operation(adapter, user, project.id, visible=False, surface_type=FACE, data_file=DATA_FILE_FACE) except Exception, excep: LOGGER.exception(excep)
def update(): """ Update TVB code to SVN revision version 4770. This update was done for release 1.0.5 """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: handle_event(EVENT_FILE_IDENTIFIER, dao.get_system_user(), project) except Exception, excep: LOGGER.exception(excep)
def update(): """ Update TVB code to SVN revision version 6093. This update was done for release 1.1.5. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: handle_event(EVENT_FILE_IDENTIFIER, dao.get_system_user(), project) except Exception: LOGGER.exception("could not migrate project id: %s, name %s" % (project.id, project.name))
def update(): """ Update TVB code to SVN revision version 4770. This update was done for release 1.0.5 """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: adapter = Sensors_Importer() FlowService().fire_operation(adapter, dao.get_system_user(), project.id, visible=False, sensors_file=DATA_FILE, sensors_type=Sensors_Importer.INTERNAL_SENSORS) except Exception, excep: LOGGER.exception(excep)
def update(): """ Update TVB code to SVN revision version 4770. This update was done for release 1.0.5 """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: adapter = SensorsImporter() FlowService().fire_operation(adapter, dao.get_system_user(), project.id, visible=False, sensors_file=DATA_FILE, sensors_type=SensorsImporter.INTERNAL_SENSORS) except Exception as excep: LOGGER.exception(excep)
def update(): """ Update TVB code to SVN revision version 6093. This update was done for release 1.1.5. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: user = dao.get_system_user() adapter = ObjSurfaceImporter() FlowService().fire_operation(adapter, user, project.id, visible=False, surface_type=FACE, data_file=DATA_FILE_FACE) except Exception: LOGGER.exception("could not migrate project id: %s, name %s" % (project.id, project.name))
def update(): """ Cleanup Projections from disk (make sure Projection Regions are being removed). """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: project_path = FilesHelper().get_project_folder(project) update_manager = ProjectUpdateManager(project_path) update_manager.run_all_updates() project.version = TvbProfile.current.version.PROJECT_VERSION dao.store_entity(project)
def update(): """ Update TVB code to SVN revision version 6093. This update was done for release 1.1.5. """ projects_count = dao.get_all_projects(is_count=True) for page_start in range(0, projects_count, PAGE_SIZE): projects_page = dao.get_all_projects(page_start=page_start, page_size=PAGE_SIZE) for project in projects_page: try: user = dao.get_system_user() adapter = ObjSurfaceImporter() OperationService().fire_operation(adapter, user, project.id, visible=False, surface_type=SurfaceTypesEnum.FACE_SURFACE.value, data_file=DATA_FILE_FACE) except Exception: LOGGER.exception("could not migrate project id: %s, name %s" % (project.id, project.name))
def read_h5(full_paths): # We need to load the DataType in the context of an operation, and a project all_projects = dao.get_all_projects() all_operations = dao.get_generic_entity(model.Operation, all_projects[0].id, "fk_launched_in") service = ImportService() results = [] for full_path in full_paths: folder, h5file = os.path.split(full_path) # The actual read of H5: datatype = service.load_datatype_from_file(folder, h5file, all_operations[0].id, move=False) print "We've build DataType: [%s]" % datatype.__class__.__name__, datatype results.append(datatype) return results
def read_h5(full_paths): # We need to load the DataType in the context of an operation, and a project all_projects = dao.get_all_projects() all_operations = dao.get_generic_entity(Operation, all_projects[0].id, "fk_launched_in") service = ImportService() results = [] for full_path in full_paths: # The actual read of H5: datatype = service.load_datatype_from_file(full_path, all_operations[0].id) print("We've build DataType: [%s]" % datatype.__class__.__name__, datatype) results.append(datatype) return results
def list_projects(): fmt = "%24s %5s" print(fmt % ('name', 'id')) for p in dao.get_all_projects(): print(fmt % (p.name, p.id))
# # """ Demo script for console profile which is showing how a project export can be done from the command line. After running this script, you should have a message in the console telling where the exported ZIP is placed. .. moduleauthor:: Lia Domide <*****@*****.**> """ from tvb.core.services.project_service import ProjectService from tvb.core.entities.storage import dao from tvb.adapters.exporters.export_manager import ExportManager def run_export(project_id, loose_irrelevant=False): s = ProjectService() mng = ExportManager() project = s.find_project(project_id) export_file = mng.export_project(project, loose_irrelevant) print("Check the exported file: %s" % export_file) if __name__ == '__main__': from tvb.interfaces.command.lab import * projects = dao.get_all_projects() run_export(projects[0].id)