-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01.read_rprof_datfile.py
More file actions
executable file
·52 lines (46 loc) · 1.33 KB
/
01.read_rprof_datfile.py
File metadata and controls
executable file
·52 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
52
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 28 22:44:59 2023
@author: chingchen
"""
import os, sys
datapath = '/Users/chingchen/Desktop/StagYY_Works/data_scaling/'
#datapath = '/lfs/jiching/data/'
#datapath = '/lfs/jiching/ScalingLaw_model/data_scaling/'
path = '/Users/chingchen/Desktop/StagYY_Works/data_scaling/'
#path = '/lfs/jiching/ScalingLaw_model/23agu/'
model = sys.argv[1]
p = sys.argv[2]
p = int(p) + 1
#for mm in range(1,2):
# model = 'w080'+str(mm)
# model='ca06'
# p = 129
#model = 'h06_192'
#p = 193
# model = 'h04_256'
# p = 257
file = datapath+model+'_rprof.dat'
sourceFileName = file
sourceFileData = open(file,'r')
ListOfLine = sourceFileData.read().splitlines()
new_data = ListOfLine[1:]
n = len(new_data)
m = int(n/p)
for i in range(m):
destFileName = path+model+'/datafile/'
if not os.path.isdir(path+model):
os.mkdir(path+model)
if not os.path.isdir(destFileName):
os.mkdir(destFileName)
destFileData = open(destFileName+model+'_data_'+str(i)+'.txt','w')
if (i==m-1):
for line in new_data[i*p+1:]:
destFileData.write(line+'\n')
else:
for line in new_data[i*p+1:(i+1)*p]:
destFileData.write(line+'\n')
destFileData.close()
print(model+'==DONE==',m-1)
print(path+model+'/datafile/')