def test_remove_cell(): dsets = hdf5.load_datasets(Path(stores_dir) / "with_4sided_cell.hf5") mono = Monolayer("4", dsets) Nci = mono.Nc cell = mono.cell_df.query("num_faces == 4").index[0] res = remove_cell(mono, cell) MonolayerGeometry.update_all(mono) assert not res assert mono.validate() assert mono.Nc == Nci - 1 with pytest.warns(UserWarning): cell = mono.cell_df.query("num_faces != 4").index[0] res = remove_cell(mono, cell) assert mono.validate()
def test_close_cell(): dsets = hdf5.load_datasets(Path(stores_dir) / "with_4sided_cell.hf5") mono = Monolayer("4", dsets) cell = mono.cell_df.query("num_faces != 4").index[0] Nfi = mono.cell_df.loc[cell, "num_faces"] Nei = mono.Ne edges = mono.edge_df.query(f"cell == {cell}") face = edges["face"].iloc[0] face_edges = edges.query(f"face == {face}").index Nsi = len(face_edges) mono.face_df.drop(face, axis=0, inplace=True) mono.edge_df.drop(face_edges, axis=0, inplace=True) mono.reset_index() mono.reset_topo() assert mono.cell_df.loc[cell, "num_faces"] == Nfi - 1 assert mono.Ne == Nei - Nsi res = close_cell(mono, cell) MonolayerGeometry.update_all(mono) mono.reset_index() mono.reset_topo() assert not res assert mono.validate() assert mono.cell_df.loc[cell, "num_faces"] == Nfi assert mono.Ne == Nei
def test_monolayer_division(): datasets_2d, specs = three_faces_sheet(zaxis=True) datasets = extrude(datasets_2d, method="translation") eptm = Monolayer("test_volume", datasets, bulk_spec(), coords=["x", "y", "z"]) MonolayerGeometry.update_all(eptm) for orientation in ["vertical", "horizontal"]: daughter = cell_division(eptm, 0, orientation=orientation) eptm.reset_topo() eptm.reset_index() assert eptm.validate() assert eptm.Nc == 5