Tspostat in python. Flexible and incremental
Samo Penic
2019-08-15 c284863c1fae7faad0939cec32688d06f95871ee
finishing ulm2 calculations
1 files modified
13 ■■■■ changed files
poststat.py 13 ●●●● patch | view | raw | blame | history
poststat.py
@@ -107,12 +107,12 @@
def single_vtu_ulm2(vesicle):
    R0=ts.getR0(vesicle)
    print(type(R0))
    print(R0)
#    print(type(R0))
#    print(R0)
    ts.preparationSh(vesicle, R0)
    ts.calculateUlmComplex(vesicle)
    strng = ts.Ulm2Complex2String(vesicle).decode('ascii')
    print(strng)
#    print(strng)
    retval=strng.split(' ')
#    ts.freeUlm2String(strng)
    return retval
@@ -148,13 +148,10 @@
    """Function reads existing data_tspoststat and checks if there are new VTUs in the directory that were not poststated. If there are, then they are added to the list"""
    try:
        csvdict=read_csv(os.path.join(directory,'data_tspoststat.csv'))
        ulm2dict=read_csv(os.path.join(directory,'ulm2.csv'))
    except FileNotFoundError:
        #print("no file")
        csvdict={'OuterLoop':['OuterLoop', 'Volume', 'Area', 'lamdba1', 'lambda2', 'lambda3', 'Nbw/Nb', 'hbar', 'StretchingE', 'avgFx', 'avgFy', 'avgFz', 'BendingEonlyC0']}
        try:
            os.unlink(os.path.join(directory,'ulm2.csv'))
        except:
            print("No need to delete ulm2.csv")
        ulm2dict={'OuterLoop':['OuterLoop','ulm_0^0^2', 'ulm_1^-1^2', 'ulm_1^0^2', 'ulm_1^1^2', '...']}
    filedict=get_vtu_dict(directory)
    modified=False
@@ -183,9 +180,11 @@
                '{:.17e}'.format(p['avgFy']),
                '{:.17e}'.format(p['avgFz']),
                '{:.17e}'.format(p['BendingEonlyC0'])]
            ulm2dict[f]=[f, *ulm2]
            modified=True
    if modified:
        write_csv(os.path.join(directory,'data_tspoststat.csv'), csvdict)
        write_csv(os.path.join(directory,'ulm2.csv'), ulm2dict)
        
def clean_poststat_directory(directory):
    """Function deletes data_tspoststat.csv created by tspoststat in given directory, enabling forcing of re-tspostating it"""