Tspostat in python. Flexible and incremental
Samo Penic
2019-08-15 640c527b9d7a03272627cd7844bbf810c573a087
Added functionf for spherical harmonics
2 files modified
58 ■■■■■ changed files
poststat.py 19 ●●●●● patch | view | raw | blame | history
wrapper.py 39 ●●●●● patch | view | raw | blame | history
poststat.py
@@ -105,6 +105,17 @@
        }
    return retval
def single_vtu_ulm2(vesicle):
    R0=ts.getR0(vesicle)
    print(type(R0))
    print(R0)
    ts.preparationSh(vesicle, R0)
    ts.calculateUlmComplex(vesicle)
    strng = ts.Ulm2Complex2String(vesicle).decode('ascii')
    print(strng)
    retval=strng.split(' ')
#    ts.freeUlm2String(strng)
    return retval
def read_csv(filename):
    with open(filename,'r') as f:
@@ -140,12 +151,18 @@
    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
    for f in filedict:
        if f not in csvdict:
            vesicle= ts.parseDump(filedict[f])
            p=single_vtu_poststat(vesicle)
            ulm2=single_vtu_ulm2(vesicle)
            hist=get_histogram_data(vesicle)
            with open(os.path.join(directory, "histogram_{:06d}.csv".format(int(f))), 'w') as histf:
                histf.write('Number_of_vertices_in cluster Number_of_clusters\n')
@@ -184,7 +201,7 @@
        self.dirlist=dirlist
    def run(self):
        for d in self.dirlist:
            clean_poststat_directory(d)
            #clean_poststat_directory(d)
            poststat_directory(d)
            print("Directory {} done".format(d))
        print("All done for this process")
wrapper.py
@@ -289,7 +289,44 @@
    ts.stretchenergy.argtype=[POINTER(ts_vesicle), POINTER(ts_triangle)]
    ts.stretchenergy(vesicle,triangle)
def get_absolute_ulm2(vesicle,l,m):
    ts.get_absolute_ulm2.argtype=[POINTER(ts_vesicle), c_double, c_double]
    ts.get_absolute_ulm2.restype=c_double
    ret=ts.get_absolute_ulm2(vesicle,l,m)
    return ret
def getR0(vesicle):
    ts.getR0.argtype=[POINTER(ts_vesicle)]
    ts.getR0.restype=c_double
    r0=ts.getR0(vesicle)
    return r0
def preparationSh(vesicle,r0):
    ts.preparationSh.argtypes=[POINTER(ts_vesicle), c_double]
    ts.preparationSh(vesicle,r0)
def calculateUlmComplex(vesicle):
    ts.calculateUlmComplex.argtype=[POINTER(ts_vesicle)]
    ts.calculateUlmComplex(vesicle)
def Ulm2Complex2String(vesicle):
    ts.Ulm2Complex2String.argtype=[POINTER(ts_vesicle)]
    ts.Ulm2Complex2String.restype=c_char_p
    string=ts.Ulm2Complex2String(vesicle)
    return string
def freeUlm2String(string):
    ts.freeUlm2String.argtype=[c_char_p]
    ts.freeUlm2String(string)
#This function seems not to exist!!!
#def solve_for_ulm2(vesicle):
#    ts.solve_for_ulm2.argtype=[POINTER(ts_vesicle)]
#    ts.solve_for_ulm2(vesicle)
def mean_curvature_and_energy(vesicle):
    ts.mean_curvature_and_energy.argtype=[POINTER(ts_vesicle)]
    ts.mean_curvature_and_energy(vesicle)