ConvertAsciitoTXT.py 1.7 KB
Newer Older
1
2
# -*- coding: utf-8 -*-
"""
Michael Rudolf's avatar
Michael Rudolf committed
3
4
5
6
Converts all *.asc files in the folder given in `path_in` and creates a time
series plot in the folder `path_out`. This script requires `rstevaluation` to
be installed on the system.

7
8
Created on Tue Sep 25 14:54:43 2018

Michael Rudolf's avatar
Michael Rudolf committed
9
@author: M.Warsitzka, M.Rudolf
10
11
12
"""
import os

Michael Rudolf's avatar
Michael Rudolf committed
13
import numpy as np
14
15
import rstevaluation.files as rstfiles
import rstevaluation.plots as rstplots
Michael Rudolf's avatar
Michael Rudolf committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51


def main():
    projectname = '393-01_01_Foamglass100'

    path_in = 'Legacy/FileConversion/input'
    path_out = 'Legacy/FileConversion/output'
    # =========== PARAMETERS & VARIABLES ============
    var = {
        'A':  0.022619,  # area of shear zone (= surface area of lid) (m^2)
        'li': 0.0776,  # inner lever (center cell to center of shear zone)
        'lo': 0.1250,  # outer lever (center cell to hinge point)
        'le': 1.611655493,  # load point level
        'v':  30,  # shear velocity (mm/min)
        'g': 9.81,  # acceleration due to gravity
        'prec': 125,  # rounding precision for normal load in file names
        'velnoise': 1e-2,
        'stressnoise': 0.025,
        'smoothwindow': 51,  # define window for smooth shear stress curve
        'nsamples': 10**6  # Maximum number of samples for downsampling
    }
    exp_data = [
        rstfiles.convert(path_in, f, var)
        for f in os.listdir(path_in)
        if f.endswith('.asc')
    ]
    normal_stresses = [
        '%i' % (np.floor(np.mean(d['normalstress'])/var['prec'])*var['prec'])
        for d in exp_data
    ]
    rstplots.plotts(path_out, projectname, exp_data, normal_stresses)
    rstfiles.saveTS(path_out, projectname, exp_data, normal_stresses)


if __name__ == '__main__':
    main()