Ejemplo n.º 1
0
def test_fix_pinch():
    dsets = hdf5.load_datasets(Path(stores_dir) / "with_pinch.hf5")
    pinched = Monolayer("pinched", dsets)
    assert not pinched.validate()
    fix_pinch(pinched)
    assert pinched.validate()
    edf = pinched.edge_df[["srce", "trgt", "face", "cell"]].copy()
    # Nothing happens here
    fix_pinch(pinched)
    assert pinched.validate()
    assert np.all(pinched.edge_df[["srce", "trgt", "face", "cell"]] == edf)
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
def test_monolayer_division():
    datasets_2d, _ = three_faces_sheet(zaxis=True)
    datasets = extrude(datasets_2d, method="translation")
    eptm = Monolayer("test_volume", datasets, bulk_spec(), coords=["x", "y", "z"])
    eptm.vert_df[eptm.coords] += np.random.normal(scale=1e-6, size=(eptm.Nv, 3))
    MonolayerGeometry.update_all(eptm)
    for orientation in ["vertical", "horizontal", "apical"]:
        monolayer_division(eptm, 0, orientation=orientation)
        eptm.reset_topo()
        eptm.reset_index()

        assert eptm.validate()
    assert eptm.Nc == 6
Ejemplo n.º 5
0
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