def test_prepare_inputs_with_eeg_monitor(self, operation_factory, simulator_factory, surface_index_factory, sensors_index_factory, region_mapping_index_factory, connectivity_index_factory): surface_idx, surface = surface_index_factory(cortical=True) sensors_idx, sensors = sensors_index_factory() proj = ProjectionSurfaceEEG(sensors=sensors, sources=surface, projection_data=numpy.ones(3)) op = operation_factory() storage_path = FilesHelper().get_project_folder(op.project, str(op.id)) prj_db_db = h5.store_complete(proj, storage_path) prj_db_db.fk_from_operation = op.id dao.store_entity(prj_db_db) connectivity = connectivity_index_factory(76, op) rm_index = region_mapping_index_factory(conn_gid=connectivity.gid, surface_gid=surface_idx.gid) eeg_monitor = EEGViewModel(projection=proj.gid, sensors=sensors.gid) eeg_monitor.region_mapping = rm_index.gid sim_folder, sim_gid = simulator_factory(op=op, monitor=eeg_monitor, conn_gid=connectivity.gid) hpc_client = HPCSchedulerClient() input_files = hpc_client._prepare_input(op, sim_gid) assert len(input_files) == 11
def test_store_simulator_view_model_eeg(connectivity_index_factory, surface_index_factory, region_mapping_factory, sensors_index_factory, operation_factory): conn = connectivity_index_factory() surface_idx, surface = surface_index_factory(cortical=True) region_mapping = region_mapping_factory() sensors_idx, sensors = sensors_index_factory() proj = ProjectionSurfaceEEG(sensors=sensors, sources=surface, projection_data=numpy.ones(3)) op = operation_factory() storage_path = FilesHelper().get_project_folder(op.project, str(op.id)) prj_db_db = h5.store_complete(proj, storage_path) prj_db_db.fk_from_operation = op.id dao.store_entity(prj_db_db) seeg_monitor = EEGViewModel(projection=proj.gid, sensors=sensors.gid) seeg_monitor.region_mapping = region_mapping.gid.hex sim_view_model = SimulatorAdapterModel() sim_view_model.connectivity = conn.gid sim_view_model.monitors = [seeg_monitor] op = operation_factory() storage_path = FilesHelper().get_project_folder(op.project, str(op.id)) h5.store_view_model(sim_view_model, storage_path) loaded_sim_view_model = h5.load_view_model(sim_view_model.gid, storage_path) assert isinstance(sim_view_model, SimulatorAdapterModel) assert isinstance(loaded_sim_view_model, SimulatorAdapterModel) assert sim_view_model.monitors[0].projection == loaded_sim_view_model.monitors[0].projection
def test_gather_view_model_and_datatype_references_multiple_monitors( connectivity_index_factory, operation_factory, sensors_index_factory, surface_index_factory, region_mapping_index_factory): conn = connectivity_index_factory() _, surface = surface_index_factory(cortical=True) region_mapping_idx = region_mapping_index_factory( conn_gid=conn.gid, surface_gid=surface.gid.hex) sensors_idx, sensors = sensors_index_factory() proj = ProjectionSurfaceEEG(sensors=sensors, sources=surface, projection_data=numpy.ones(3)) op = operation_factory() storage_path = StorageInterface().get_project_folder( op.project.name, str(op.id)) prj_db = h5.store_complete(proj, storage_path) prj_db.fk_from_operation = op.id dao.store_entity(prj_db) seeg_monitor = EEGViewModel(projection=proj.gid, sensors=sensors.gid) seeg_monitor.region_mapping = region_mapping_idx.gid sim_view_model = SimulatorAdapterModel() sim_view_model.connectivity = conn.gid sim_view_model.monitors = [TemporalAverageViewModel(), seeg_monitor] op = operation_factory() storage_path = StorageInterface().get_project_folder( op.project.name, str(op.id)) h5.store_view_model(sim_view_model, storage_path) only_vm_references, _ = h5.gather_references_of_view_model( sim_view_model.gid, storage_path, True) assert len(only_vm_references) == 7 vm_references, dt_references = h5.gather_references_of_view_model( sim_view_model.gid, storage_path) assert len(vm_references + dt_references) == 12