Newer
Older
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
"cells": [
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'ATF_FILE': 'CTX_Athabasca_Middle_step0.atf',\n",
" 'GP_FILE': 'CTX_Athabasca_Middle.gpf',\n",
" 'IMAGE_IPF': ['P19_008344_1894_XN_09N203W.ipf',\n",
" 'P20_008845_1894_XN_09N203W.ipf',\n",
" 'P03_002371_1888_XI_08N204W.ipf',\n",
" 'P01_001540_1889_XI_08N204W.ipf',\n",
" 'P01_001606_1897_XI_09N203W.ipf',\n",
" 'P03_002226_1895_XI_09N203W.ipf'],\n",
" 'IMAGE_SUP': ['P19_008344_1894_XN_09N203W.sup',\n",
" 'P20_008845_1894_XN_09N203W.sup',\n",
" 'P03_002371_1888_XI_08N204W.sup',\n",
" 'P01_001540_1889_XI_08N204W.sup',\n",
" 'P01_001606_1897_XI_09N203W.sup',\n",
" 'P03_002226_1895_XI_09N203W.sup'],\n",
" 'PATH': '/home/tthatcher/Desktop/Projects/Plio/plio/notebooks',\n",
" 'PROJECT': 'D:\\\\data\\\\CTX_Athabasca_Middle.prj'}"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"import numpy as np\n",
"\n",
"# Reads a .atf file and outputs all of the \n",
"# .ipf, .gpf, .sup, .prj, and path to locate the \n",
"# .apf file (should be the same as all others) \n",
"def read_atf(atf_file):\n",
" with open(atf_file) as f:\n",
"\n",
" files = []\n",
" ipf = []\n",
" sup = []\n",
" files_dict = []\n",
" \n",
" # Grabs every PRJ, GPF, SUP, and IPF image from the ATF file\n",
" for line in f:\n",
" if line[-4:-1] == 'prj' or line[-4:-1] == 'gpf' or line[-4:-1] == 'sup' or line[-4:-1] == 'ipf' or line[-4:-1] == 'atf':\n",
" files.append(line)\n",
" \n",
" files = np.array(files)\n",
" \n",
" # Creates appropriate arrays for certain files in the right format\n",
" for file in files:\n",
" file = file.strip()\n",
" file = file.split(' ')\n",
"\n",
" # Grabs all the IPF files\n",
" if file[1].endswith('.ipf'):\n",
" ipf.append(file[1])\n",
"\n",
" # Grabs all the SUP files\n",
" if file[1].endswith('.sup'):\n",
" sup.append(file[1])\n",
"\n",
" files_dict.append(file)\n",
"\n",
" # Creates a dict out of file lists for GPF, PRJ, IPF, and ATF\n",
" files_dict = (dict(files_dict))\n",
" \n",
" # Sets the value of IMAGE_IPF to all IPF images\n",
" files_dict['IMAGE_IPF'] = ipf\n",
" \n",
" # Sets the value of IMAGE_SUP to all SUP images\n",
" files_dict['IMAGE_SUP'] = sup\n",
" \n",
" # Sets the value of PATH to the path of the ATF file\n",
" files_dict['PATH'] = os.path.dirname(os.path.abspath(atf_file))\n",
" \n",
" return files_dict\n",
" \n",
"read_atf('CTX_Athabasca_Middle_step0.atf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}