Mercurial > repos > ximgchess > hedm_npz_to_tesr
annotate hedm_npz_to_tesr.py @ 0:bd74229f61e8 draft
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
author | ximgchess |
---|---|
date | Thu, 01 Apr 2021 18:30:44 +0000 |
parents | |
children |
rev | line source |
---|---|
0
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
3 """ |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
4 Created on Mon Nov 19 08:32:06 2018 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
5 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
6 @author: dcp99 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
7 """ |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
8 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
9 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
10 #%% |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
11 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
12 import argparse |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
13 import numpy as np |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
14 import re |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
15 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
16 def __main__(): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
17 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
18 parser = argparse.ArgumentParser( |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
19 description='Convert an HEDM_map.npz file to a neper tesr file') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
20 parser.add_argument( |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
21 'input', |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
22 type=argparse.FileType('rb'), |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
23 help='HEDM_map.npz') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
24 parser.add_argument( |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
25 'output', |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
26 type=argparse.FileType('w'), |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
27 help='neper tesr file' ) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
28 parser.add_argument('-s', '--voxel_spacing', type=float, default=0.005, help='voxel spacing') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
29 parser.add_argument('-x', '--x_name', default='^.*X.*$', help='X array name') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
30 parser.add_argument('-y', '--y_name', default='^.*Y.*$', help='Y array name') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
31 parser.add_argument('-z', '--z_name', default='^.*Z.*$', help='Z array name') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
32 parser.add_argument('-g', '--grain_map', default='^.*grain.*$', help='grain map name') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
33 parser.add_argument('-d', '--debug', action='store_true', help='Debug') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
34 args = parser.parse_args() |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
35 data=np.load(args.input) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
36 grain_map = Xs = Ys = Zs = None |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
37 for f in data.files: |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
38 if re.match(args.grain_map, f): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
39 grain_map = data[f] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
40 elif re.match(args.x_name, f): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
41 Xs = data[f] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
42 elif re.match(args.y_name, f): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
43 Ys = data[f] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
44 elif re.match(args.z_name, f): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
45 Zs = data[f] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
46 voxel_spacing = args.voxel_spacing |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
47 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
48 #CREATE ASSEMBLED DATA -- LIST OF [VOXEL COORDINATES (X,Y,Z),GRAIN ID] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
49 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
50 coordinate_list=np.vstack((Xs.ravel(),Ys.ravel(),Zs.ravel())) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
51 assembled_data=np.hstack((coordinate_list.T,np.atleast_2d(grain_map.ravel()).T)) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
52 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
53 #%% SORT BY ROWS Z AND THEN Y |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
54 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
55 assembled_data=assembled_data[assembled_data[:,2].argsort()] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
56 total_size=int(grain_map.shape[0]*grain_map.shape[1]*grain_map.shape[2]) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
57 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
58 stack_size=int(grain_map.shape[0]*grain_map.shape[1]) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
59 for ii in np.arange(int(total_size/stack_size)): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
60 tmp_args=assembled_data[ii*stack_size:(ii+1)*stack_size,1].argsort() |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
61 assembled_data[ii*stack_size:(ii+1)*stack_size,:]=assembled_data[ii*stack_size+tmp_args,:] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
62 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
63 stack_size=grain_map.shape[1] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
64 for ii in np.arange(int(total_size/stack_size)): |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
65 tmp_args=assembled_data[ii*stack_size:(ii+1)*stack_size,0].argsort() |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
66 assembled_data[ii*stack_size:(ii+1)*stack_size,:]=assembled_data[ii*stack_size+tmp_args,:] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
67 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
68 #%% |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
69 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
70 np.set_printoptions(threshold=np.inf) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
71 l1 = '***tesr' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
72 l2 = ' **format' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
73 l3 = ' 2.0 ascii' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
74 l4 = ' **general' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
75 l5 = ' 3' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
76 l6 = ' ' + str(grain_map.shape[1]) + ' ' + str(grain_map.shape[0]) + ' ' + str(grain_map.shape[2]) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
77 l7 = ' ' + str(voxel_spacing) + ' ' + str(voxel_spacing) + ' ' + str(voxel_spacing) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
78 l8 = ' **cell'; |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
79 l9 = ' ' + str(np.max(grain_map).astype('int')) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
80 l10 = ' *id'; |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
81 l11 = ' ' + str(np.arange(1,np.max(grain_map)+1).astype('int'))[1:-1] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
82 l12 = ' **data' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
83 #l13 = ' ' + str(assembled_data[:,3].astype('int'))[1:-1] |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
84 l14 = '***end' |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
85 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
86 #%% |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
87 output = args.output |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
88 output.write('%s\n' % l1) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
89 output.write('%s\n' % l2) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
90 output.write('%s\n' % l3) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
91 output.write('%s\n' % l4) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
92 output.write('%s\n' % l5) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
93 output.write('%s\n' % l6) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
94 output.write('%s\n' % l7) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
95 output.write('%s\n' % l8) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
96 output.write('%s\n' % l9) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
97 output.write('%s\n' % l10) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
98 output.write('%s\n' % l11) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
99 output.write('%s\n' % l12) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
100 output.write(' ') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
101 np.savetxt(output,np.atleast_2d(assembled_data[:,3]).T,fmt='%d') |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
102 #output.write('%s\n' % l13) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
103 output.write('%s\n' % l14) |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
104 output.close() |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
105 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
106 |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
107 if __name__ == "__main__": |
bd74229f61e8
"planemo upload for repository https://github.com/ximg-chess/galaxytools/tools/hedm_npz_to_tesr commit 0db0d2633f65e2ceca2e34c8899a52b18965d059-dirty"
ximgchess
parents:
diff
changeset
|
108 __main__() |