コード例 #1
0
def _add_lineageid(poly_embryo, input_file_lineageId):
    ''' enrich embryo VTP with lineageid arrays '''
    if not input_file_lineageId:
        return

    df_cell = pd.read_csv(input_file_lineageId)
    nb_levels = 5
    l_parentid = []
    l_l_levels = []
    for ix_row, row_i in df_cell.iterrows():
        l_name_lineage = re.findall("\d", str(row_i.name_lineage))
        l_name_lineage_levels = []
        for ix_level in range(0, nb_levels):
            l_name_lineage_levels.append(
                l_name_lineage[ix_level] if ix_level < len(l_name_lineage) else '0')
        l_l_levels.append(l_name_lineage_levels)
        l_parentid.append(row_i.parentIndex)

    a_levels = np.transpose(np.char.array(l_l_levels))
    for ix_level in range(0, nb_levels):
        a_lineage_cum = a_lineage_cum + \
            a_levels[ix_level] if ix_level > 0 else a_levels[ix_level]
        add_array_with_mapper(poly_embryo, 'parentIndex', f'lineageid{ix_level}', {k: int(v) for k, v in zip(l_parentid, a_lineage_cum)})

    return
コード例 #2
0
def _add_canonical_contactid(poly_embryo, d_parentid_canonical):
    if not d_parentid_canonical:
        return

    add_array_with_mapper(poly_embryo, 'contactid',
                          'contactidCanonical', d_parentid_canonical)

    return
コード例 #3
0
def _add_canonical_parentid(poly_embryo, df_canonical_parentid):
    if df_canonical_parentid.empty:
        return

    d_cellname_canonical_parentid = {k: get_canonical_parentid(
        k, df_canonical_parentid) for k in d_parentid_cellname.values()}
    add_array_with_mapper(poly_embryo, 'cellName', 'parentIndexCanonical',
                          d_cellname_canonical_parentid, default=999)
    d_parentid_canonical = {
        i: d_cellname_canonical_parentid[j] for i, j in d_parentid_cellname.items()}
    write_mapper_cellname_csv(d_cellname_canonical_parentid)

    return d_parentid_canonical
コード例 #4
0
def _add_parentid(poly_embryo, d_parentid_cellname):

    add_array_with_mapper(poly_embryo, 'parentIndex', 'cellName',
                          d_parentid_cellname, default='Unidentified')

    return
コード例 #5
0
        engage_cd_counter(mysim, cells, h_eff,
                          CD_cell_cell)  # Must be after last remesh
        mysim.run_until(mysim.get_time() + dtg)
        vtkWriter.VTKSerialWriter(data=cells('triangles'),
                                  filename=str(output_folder / "Seeding"),
                                  select_all=True,
                                  start_index=get_latest_file()[1] +
                                  1).execute()
        log_chronology_txt("After final runtime : engaging contactdetection")

        # read in clean VTP to fix indices
        poly_embryo = read_vtp_file(output_folder / get_latest_file()[0])
        d_oldix_newix, _ = get_map_oldix_newix(type='triangles')
        add_array_with_mapper(poly_embryo,
                              name_array_source='contact_index',
                              name_array_dest='contact_index',
                              mapper=d_oldix_newix,
                              field_type="CELL")
        d_oldix_newix, _ = get_map_oldix_newix(type='nodes')
        add_array_with_mapper(poly_embryo,
                              name_array_source='vertexIndices',
                              name_array_dest='vertexIndices',
                              mapper=d_oldix_newix,
                              field_type="CELL")
        write_vtp_file(poly_embryo, output_folder / get_latest_file()[0])
        log_chronology_txt(
            "After final runtime : fixing indices due to remeshing => end of simulation"
        )

    #save centroids
    np.savetxt(str(output_folder / "cell_centroids.csv"),