source: rotdif/bin/elmdock_split.py @ 1528

Last change on this file since 1528 was 1528, checked in by yuexi, 2 years ago

add elm split

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/usr/bin/python
2import pandas as pd
3import numpy as np
4from preprocess_dyna_rho import preprocess_out
5
6
7def split_data(dyna_flag, elm_flag, elmdock_flag):
8    with open('elmdock_log.out') as in_f:
9        all_txt = in_f.read().splitlines()
10        #get the lines
11    dock_start = 0
12    dock_end = 0
13    diso_start = 0
14    diso_end = 0
15    daxi_start = 0
16    daxi_end = 0
17    dani_start = 0
18    dani_end = 0
19    elm_start = 0
20    elm_end = 0
21    for i in range(len(all_txt)):
22        if 'Full Rotdif Results: Isotropic Solution' in all_txt[i]:
23            iso_start = i+2
24        elif 'Full Rotdif Results: Axially-Symmetric Solution' in all_txt[i]:
25            axi_start = i+2
26            iso_end = i-1
27        elif 'Full Rotdif Results: Anisotropic Solution' in all_txt[i]:
28            ani_start = i+2
29            axi_end = i-1
30            ani_end = ani_start + (axi_end - axi_start)
31        elif 'Full Dynamics Results: Isotropic Solution' in all_txt[i]:
32            diso_start = i+2
33        elif 'Full Dynamics Results: Axially-Symmetric Solution' in all_txt[i]:
34            daxi_start = i+2
35            diso_end = i-1
36        elif 'Full Dynamics Results: Anisotropic Solution' in all_txt[i]:
37            dani_start = i+2
38            daxi_end = i-1
39            #last two rows are comments
40            dani_end = dani_start + (daxi_end - daxi_start)
41        elif 'ELM Tensor Prediction' in all_txt[i]:
42            elm_start = i
43        elif 'Eigendecomposition' in all_txt[i]:
44            elm_end = i + 4
45        elif 'Docking Results' in all_txt[i]:
46            dock_start = i
47            dock_end = len(all_txt) - 2
48        #starter = [iso_start,axi_start,ani_start,diso_start,daxi_start,dani_start, elm_start]
49        #ender = [iso_end,axi_end,ani_end,diso_end,daxi_end,dani_end, elm_end]
50    iso_output = preprocess_out(iso_start, iso_end, all_txt,"exp")
51    axi_output = preprocess_out(axi_start, axi_end, all_txt,"exp")
52    ani_output = preprocess_out(ani_start, ani_end, all_txt,"exp")
53    diso_output = []
54    daxi_output = []
55    dani_output = []
56    elm_output = []
57    dock_output = []
58    if dyna_flag == True:
59        diso_output = preprocess_out(diso_start, diso_end, all_txt,"dyna")
60        daxi_output = preprocess_out(daxi_start, daxi_end, all_txt,"dyna")
61        dani_output = preprocess_out(dani_start, dani_end, all_txt,"dyna")
62    if elm_flag == True:
63        elm_output = all_txt[elm_start:elm_end]
64    if elmdock_flag == True:
65        dock_output = all_txt[dock_start:dock_end]
66    return iso_output,axi_output,ani_output,diso_output,daxi_output,dani_output, elm_output, dock_output
Note: See TracBrowser for help on using the repository browser.