open-osc 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_osc/__init__.py +1 -0
- open_osc/_decode.py +801 -0
- open_osc-0.0.0.dist-info/METADATA +108 -0
- open_osc-0.0.0.dist-info/RECORD +7 -0
- open_osc-0.0.0.dist-info/WHEEL +5 -0
- open_osc-0.0.0.dist-info/licenses/LICENSE +21 -0
- open_osc-0.0.0.dist-info/top_level.txt +1 -0
open_osc/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from ._decode import OSC, OSCVariantA, OSCVariantAPh, load_osc
|
open_osc/_decode.py
ADDED
|
@@ -0,0 +1,801 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import struct
|
|
3
|
+
from typing import NoReturn, BinaryIO, Any, Optional
|
|
4
|
+
from warnings import warn
|
|
5
|
+
from collections import namedtuple
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FaultyOffsetError(BaseException): ...
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DecodedValueValidationError(BaseException): ...
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def load_osc(filepath, *args, **kwargs):
|
|
15
|
+
# Variant A always have higher priority than Variant B. Variant B is not capable to
|
|
16
|
+
# decode the phase chemistry.
|
|
17
|
+
try_list = [OSC, OSCVariantA, OSCVariantAPh]
|
|
18
|
+
for decoder in try_list:
|
|
19
|
+
try:
|
|
20
|
+
return decoder(filepath, *args, **kwargs)
|
|
21
|
+
except FaultyOffsetError as e:
|
|
22
|
+
pass
|
|
23
|
+
except UnicodeDecodeError as e:
|
|
24
|
+
pass
|
|
25
|
+
except DecodedValueValidationError as e:
|
|
26
|
+
pass
|
|
27
|
+
raise IOError(
|
|
28
|
+
f"Failed to find the working parser for the provided path ({filepath})."
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def string_processor(string: bytes):
|
|
33
|
+
return string.strip(b"\x00").strip().decode("ascii").replace("\x00", " ")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def unpack_autosize(fmt: str, file_obj: BinaryIO):
|
|
37
|
+
"""
|
|
38
|
+
Unpack binary data from a file object.
|
|
39
|
+
|
|
40
|
+
Parameters
|
|
41
|
+
----------
|
|
42
|
+
fmt : str
|
|
43
|
+
Format string which will be passed to struct.unpack() method.
|
|
44
|
+
file_obj : BinaryIO
|
|
45
|
+
File object.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
tuple
|
|
50
|
+
"""
|
|
51
|
+
return struct.unpack(fmt, file_obj.read(struct.calcsize(fmt)))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# This data obtained from following link. See page 23.
|
|
55
|
+
# https://creep-it.gm.univ-montp2.fr/wp-content/uploads/2016/03/CREEP_DM_MTEX_Intro_March_2016.pdf
|
|
56
|
+
SymmetryEntry = namedtuple(
|
|
57
|
+
"SymmetryEntry", ["lattice_system", "x", "y", "z", "laue_class"]
|
|
58
|
+
)
|
|
59
|
+
SYMMETRY_CODE = {
|
|
60
|
+
1: SymmetryEntry("Triclinic", "X || a*", "Z x X", "Z || c", "-1"),
|
|
61
|
+
2: SymmetryEntry("Monoclinic", "X || a*", "Z x X", "Z || c", "2/m"),
|
|
62
|
+
20: SymmetryEntry("Monoclinic", "Y x Z", "Y || b", "Z || c", "2/m"),
|
|
63
|
+
22: SymmetryEntry("Orthorhombic", "X || a", "Y || b", "Z || c", "mmm"),
|
|
64
|
+
4: SymmetryEntry("Tetragonal", "X || a", "Y || b", "Z || c", "4/m"),
|
|
65
|
+
42: SymmetryEntry("Tetragonal", "X || a", "Y || b", "Z || c", "4/mmm"),
|
|
66
|
+
3: SymmetryEntry("Trigonal", "X || a[2-1-10]", "Z x X", "Z || c", "-3"),
|
|
67
|
+
32: SymmetryEntry("Trigonal", "X || a[2-1-10]", "Z x X", "Z || c", "-3m"),
|
|
68
|
+
6: SymmetryEntry("Hexagonal", "X || a[2-1-10]", "Z x X", "Z || c", "6/m"),
|
|
69
|
+
62: SymmetryEntry("Hexagonal", "X || a[2-1-10]", "Z x X", "Z || c", "6/mmm"),
|
|
70
|
+
23: SymmetryEntry("Cubic", "X || a", "Y || b", "Z || c", "m-3"),
|
|
71
|
+
43: SymmetryEntry("Cubic", "X || a", "Y || b", "Z || c", "m-3m"),
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class OSC:
|
|
76
|
+
"""
|
|
77
|
+
Decode .osc files and provide an API to access the EBSD data, measurement parameters and phases.
|
|
78
|
+
|
|
79
|
+
This class is used to parse .osc files which are binary EBSD data files. It reads the file, decodes the binary data
|
|
80
|
+
and provides an API to access the EBSD data, measurement parameters and phases.
|
|
81
|
+
|
|
82
|
+
Parameters
|
|
83
|
+
----------
|
|
84
|
+
file : str
|
|
85
|
+
The path to the .osc file to be parsed.
|
|
86
|
+
allow_decoding_error : bool
|
|
87
|
+
If True, then some of faulty section decoding will be tolerated.
|
|
88
|
+
decode_headers_only : bool
|
|
89
|
+
If True, then headers of each section will be only decoded. Will not decode any data. Much faster option.
|
|
90
|
+
|
|
91
|
+
Attributes
|
|
92
|
+
----------
|
|
93
|
+
filepath : str
|
|
94
|
+
The path to the .osc file to be parsed.
|
|
95
|
+
metadata : dict
|
|
96
|
+
A dictionary containing the metadata of the .osc file.
|
|
97
|
+
phases : dict
|
|
98
|
+
A dictionary containing the phases of the .osc file.
|
|
99
|
+
hough : list
|
|
100
|
+
The decoded hough peak data from the .osc file. Format is (#No. Peaks, (Rho, Theta, Width, Max) * #No. Peaks).
|
|
101
|
+
data : list
|
|
102
|
+
The decoded ebsd data from the .osc file.
|
|
103
|
+
eds_data : dict
|
|
104
|
+
The decoded EDS data from the .osc file.
|
|
105
|
+
decoded_sections : dict
|
|
106
|
+
A decoded sections. Each value of key is True if decoded successfully.
|
|
107
|
+
|
|
108
|
+
Methods
|
|
109
|
+
-------
|
|
110
|
+
_decode():
|
|
111
|
+
Decodes the .osc file and populates the metadata, phases and data attributes.
|
|
112
|
+
|
|
113
|
+
Notes
|
|
114
|
+
-----
|
|
115
|
+
This class is compatible with certain version of OSC files. It may not work with all versions of OSC files.
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
def __init__(
|
|
119
|
+
self,
|
|
120
|
+
file: str,
|
|
121
|
+
allow_decoding_error: bool = False,
|
|
122
|
+
decode_headers_only: bool = False,
|
|
123
|
+
):
|
|
124
|
+
self.filepath: str = file
|
|
125
|
+
self.metadata: dict = {}
|
|
126
|
+
self.phases: dict[int, dict[str, Any]] = {}
|
|
127
|
+
|
|
128
|
+
# Processing flags
|
|
129
|
+
self.decode_headers_only = decode_headers_only
|
|
130
|
+
self.allow_decoding_error = allow_decoding_error
|
|
131
|
+
|
|
132
|
+
# Default values for decoded data
|
|
133
|
+
self.hough: Optional[list[int, list[list[float, float, float, float], ...]]] = (
|
|
134
|
+
None
|
|
135
|
+
)
|
|
136
|
+
self.data: Optional[list[list[float, ...], ...]] = None
|
|
137
|
+
self.eds_data: Optional[dict[str, tuple[int, ...]]] = (
|
|
138
|
+
None # string key & integer tuple value dictionary
|
|
139
|
+
)
|
|
140
|
+
self.roi: Optional[list[list[int, ...], ...]] = (
|
|
141
|
+
None # 2-dimensional list with integer values
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Processing results
|
|
145
|
+
self.decoded_sections = {
|
|
146
|
+
"PHASE": False,
|
|
147
|
+
"DATA": False,
|
|
148
|
+
"EDS": False,
|
|
149
|
+
"HOUGH": False,
|
|
150
|
+
"ROI": False,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# Header locations
|
|
154
|
+
self.HEADER_BEGIN: int = 0
|
|
155
|
+
self.ARB_HEADER: int = 1860
|
|
156
|
+
self.PHASE_BEGIN: int = 2058
|
|
157
|
+
|
|
158
|
+
# Markers
|
|
159
|
+
self.PHASE_MARKER = b"\xB9\x0B\xEF\xFF\x01\x00\x00\x00"
|
|
160
|
+
self.DATA_MARKER = b"\xB9\x0B\xEF\xFF\x02\x00\x00\x00"
|
|
161
|
+
self.ROI_MARKER = b"\xB9\x0B\xEF\xFF\x40\x00\x00\x00"
|
|
162
|
+
self.HOUGH_MARKER = b"\xB9\x0B\xEF\xFF\x08\x00\x00\x00"
|
|
163
|
+
self.EDS_MARKER = b"\xB9\x0B\xEF\xFF\x04\x00\x00\x00"
|
|
164
|
+
|
|
165
|
+
# Decoders
|
|
166
|
+
self.decoders = {
|
|
167
|
+
self.PHASE_MARKER: self._decode_phase,
|
|
168
|
+
self.DATA_MARKER: self._decode_data,
|
|
169
|
+
self.EDS_MARKER: self._decode_eds,
|
|
170
|
+
self.HOUGH_MARKER: self._decode_hough,
|
|
171
|
+
self.ROI_MARKER: self._decode_roi,
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
self._decode(allow_decoding_error=allow_decoding_error)
|
|
175
|
+
|
|
176
|
+
def __repr__(self):
|
|
177
|
+
return f"OSC({self.filepath})"
|
|
178
|
+
|
|
179
|
+
def __str__(self):
|
|
180
|
+
return (
|
|
181
|
+
f"OSC({self.filepath})\n"
|
|
182
|
+
f"- {len(self.phases)} Phases\n"
|
|
183
|
+
f"- {self.metadata['No. Columns']} Columns\n"
|
|
184
|
+
f"- {len(self.data)} Data Points"
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def columns(self):
|
|
189
|
+
return self._build_columns()
|
|
190
|
+
|
|
191
|
+
def data_as_dictionary(self):
|
|
192
|
+
return dict(zip(self.columns, list(map(list, zip(*self.data)))))
|
|
193
|
+
|
|
194
|
+
def _build_columns(self):
|
|
195
|
+
default = ["phi1", "Phi", "phi2", "x", "y", "IQ", "CI", "Phase", "SEM", "Fit"]
|
|
196
|
+
if self.metadata["No. Columns"] != len(default):
|
|
197
|
+
if len(default) < self.metadata["No. Columns"]:
|
|
198
|
+
additional_cols = [
|
|
199
|
+
f"Unknown {n}"
|
|
200
|
+
for n in range(self.metadata["No. Columns"] - len(default))
|
|
201
|
+
]
|
|
202
|
+
return default + additional_cols
|
|
203
|
+
else:
|
|
204
|
+
raise DecodedValueValidationError(
|
|
205
|
+
f"The number of detected columns ({self.metadata['No. Columns']}) is larger than "
|
|
206
|
+
f"the number of default columns ({len(default)}, which is kinda awkward situation. "
|
|
207
|
+
f"Therefore I decided to not provide the column information."
|
|
208
|
+
)
|
|
209
|
+
else:
|
|
210
|
+
return default
|
|
211
|
+
|
|
212
|
+
def _decode(self, allow_decoding_error=False) -> NoReturn:
|
|
213
|
+
"""
|
|
214
|
+
Decode a binary file and extracts various metadata and data.
|
|
215
|
+
|
|
216
|
+
This function decodes a binary file and extracts metadata from OSC file. Actual decoding logics are defined
|
|
217
|
+
at different methods (see self.decoders).
|
|
218
|
+
|
|
219
|
+
Parameters
|
|
220
|
+
----------
|
|
221
|
+
allow_decoding_error : bool
|
|
222
|
+
If True, then just break the extraction logic rather than raising error.
|
|
223
|
+
|
|
224
|
+
Returns
|
|
225
|
+
-------
|
|
226
|
+
None
|
|
227
|
+
|
|
228
|
+
Raises
|
|
229
|
+
------
|
|
230
|
+
ValueError
|
|
231
|
+
If the phases, data, unknown data, or Hough data are not properly aligned.
|
|
232
|
+
|
|
233
|
+
Notes
|
|
234
|
+
-----
|
|
235
|
+
The function opens a binary file, seeks to various positions in the file to extract metadata and data.
|
|
236
|
+
It uses the unpack function to decode the binary data. The metadata and data are stored in the instance
|
|
237
|
+
of the class. The function checks for proper alignment of phases, data, unknown data, and Hough data.
|
|
238
|
+
If these are not properly aligned, it raises a ValueError.
|
|
239
|
+
|
|
240
|
+
The function also handles unknown bytes in the binary file by seeking past them. It decodes the phases
|
|
241
|
+
and stores them in a dictionary with keys such as 'MaterialName', 'Symmetry', 'LatticeConstants',
|
|
242
|
+
'NumberFamilies', 'hklFamilies', 'Formula', and 'Categories0'.
|
|
243
|
+
|
|
244
|
+
The function decodes the data and stores it in the instance of the class. It also decodes unknown data
|
|
245
|
+
and Hough data and stores them in the instance of the class.
|
|
246
|
+
"""
|
|
247
|
+
|
|
248
|
+
# Decode the binary file
|
|
249
|
+
with open(self.filepath, "rb") as f:
|
|
250
|
+
# Decoding process settings (hard-coded)
|
|
251
|
+
MAX_ITERATION: int = (
|
|
252
|
+
10 # We don't know how many sections are there. Therefore, we limit the iteration.
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
# Get the rudimentary values
|
|
256
|
+
fsize = self._get_filesize(f) # get filesize
|
|
257
|
+
|
|
258
|
+
# Begin decoding process
|
|
259
|
+
it = 0
|
|
260
|
+
next_offset = self._decode_header(f)
|
|
261
|
+
while it < MAX_ITERATION:
|
|
262
|
+
previous_offset = next_offset
|
|
263
|
+
f.seek(next_offset)
|
|
264
|
+
identification_marker = f.read(8)
|
|
265
|
+
f.seek(f.tell() - 8)
|
|
266
|
+
if identification_marker not in self.decoders:
|
|
267
|
+
warn(
|
|
268
|
+
f"Marker is not identified. Marker: {identification_marker.hex()}"
|
|
269
|
+
)
|
|
270
|
+
decoder = self._decode_unknown_section
|
|
271
|
+
else:
|
|
272
|
+
decoder = self.decoders[identification_marker]
|
|
273
|
+
next_offset = decoder(f)
|
|
274
|
+
if next_offset == fsize:
|
|
275
|
+
break
|
|
276
|
+
if next_offset > fsize:
|
|
277
|
+
raise FaultyOffsetError(
|
|
278
|
+
"Next section offset value is larger than the file size."
|
|
279
|
+
)
|
|
280
|
+
if (next_offset - previous_offset == 8) and allow_decoding_error:
|
|
281
|
+
warn(
|
|
282
|
+
"Due to the misalignment of the data decoding process is halted. Did you stopped the data"
|
|
283
|
+
"acquisition during the measurement?"
|
|
284
|
+
)
|
|
285
|
+
break
|
|
286
|
+
it += 1
|
|
287
|
+
|
|
288
|
+
def _get_filesize(self, f):
|
|
289
|
+
"""
|
|
290
|
+
Get the file size of the binary file.
|
|
291
|
+
|
|
292
|
+
Parameters
|
|
293
|
+
----------
|
|
294
|
+
f : BinaryIO
|
|
295
|
+
File object to query the size of.
|
|
296
|
+
"""
|
|
297
|
+
initial_position = f.tell()
|
|
298
|
+
f.seek(0, io.SEEK_END) # Goto end
|
|
299
|
+
fsize = f.tell()
|
|
300
|
+
f.seek(initial_position)
|
|
301
|
+
return fsize
|
|
302
|
+
|
|
303
|
+
def _decode_header(self, f):
|
|
304
|
+
"""
|
|
305
|
+
Decode the header of binary file.
|
|
306
|
+
|
|
307
|
+
Parameters
|
|
308
|
+
----------
|
|
309
|
+
f : BinaryIO
|
|
310
|
+
File object to decode.
|
|
311
|
+
"""
|
|
312
|
+
f.seek(self.HEADER_BEGIN) # Go to initial poisition (unneccessary statement)
|
|
313
|
+
_, _, _, _, ncol, nrows, n_data, is_hex = unpack_autosize(
|
|
314
|
+
"<IIIIIIII", f
|
|
315
|
+
) # Unpack the header
|
|
316
|
+
|
|
317
|
+
if is_hex == 4:
|
|
318
|
+
gridtype = "HexGrid"
|
|
319
|
+
elif is_hex == 2:
|
|
320
|
+
gridtype = "SqrGrid"
|
|
321
|
+
else:
|
|
322
|
+
raise DecodedValueValidationError("Unknown header value.")
|
|
323
|
+
|
|
324
|
+
ncol += 1
|
|
325
|
+
nrows += 1
|
|
326
|
+
|
|
327
|
+
self.metadata["NCOL"] = ncol
|
|
328
|
+
self.metadata["NROWS"] = nrows
|
|
329
|
+
self.metadata["GridType"] = gridtype
|
|
330
|
+
self.metadata["N_DATA"] = n_data
|
|
331
|
+
|
|
332
|
+
if gridtype == "HexGrid":
|
|
333
|
+
expected = (ncol * nrows) - int(nrows / 2)
|
|
334
|
+
|
|
335
|
+
# TODO: Refine this part. Something is wrong.
|
|
336
|
+
if expected != n_data:
|
|
337
|
+
expected2 = ncol * nrows
|
|
338
|
+
if expected2 == n_data:
|
|
339
|
+
self.metadata["NCOL_EVEN"] = ncol
|
|
340
|
+
self.metadata["NCOL_ODD"] = ncol
|
|
341
|
+
else:
|
|
342
|
+
warn(
|
|
343
|
+
f"Over or undersampling. Cannot detect the number of even and odd columns."
|
|
344
|
+
)
|
|
345
|
+
self.metadata["NCOL_EVEN"] = None
|
|
346
|
+
self.metadata["NCOL_ODD"] = None
|
|
347
|
+
else:
|
|
348
|
+
self.metadata["NCOL_EVEN"] = ncol
|
|
349
|
+
self.metadata["NCOL_ODD"] = ncol - 1
|
|
350
|
+
elif gridtype == "SqrGrid":
|
|
351
|
+
expected = ncol * nrows
|
|
352
|
+
self.metadata["NCOL_ODD"] = ncol
|
|
353
|
+
self.metadata["NCOL_EVEN"] = ncol
|
|
354
|
+
if expected != n_data:
|
|
355
|
+
warn(f"Incomplete sampling. Expected {expected}, encountered {n_data}.")
|
|
356
|
+
else:
|
|
357
|
+
raise DecodedValueValidationError(
|
|
358
|
+
"Unidentified grid type."
|
|
359
|
+
) # Just for clarity. Useless declaration.
|
|
360
|
+
|
|
361
|
+
self.metadata["SamplingProgress"] = n_data / expected
|
|
362
|
+
f.seek(self.ARB_HEADER) # Go to arbitrary header position.
|
|
363
|
+
x_star, y_star, z_star, working_distance = unpack_autosize("<ffff", f)
|
|
364
|
+
self.metadata["x-star"] = x_star
|
|
365
|
+
self.metadata["y-star"] = y_star
|
|
366
|
+
self.metadata["z-star"] = z_star
|
|
367
|
+
self.metadata["WorkingDistance"] = working_distance
|
|
368
|
+
|
|
369
|
+
# Get the offset for phase section by searching
|
|
370
|
+
return self._get_phase_offset(f)
|
|
371
|
+
|
|
372
|
+
def _get_phase_offset(self, f):
|
|
373
|
+
current_position = f.tell()
|
|
374
|
+
f.seek(0)
|
|
375
|
+
s = f.read(1024 * 16)
|
|
376
|
+
offset = s.find(self.PHASE_MARKER)
|
|
377
|
+
f.seek(current_position)
|
|
378
|
+
return offset
|
|
379
|
+
|
|
380
|
+
def _end_of_section_checker(self, f, next_offset):
|
|
381
|
+
"""
|
|
382
|
+
Check if end of each section reached.
|
|
383
|
+
|
|
384
|
+
Parameters
|
|
385
|
+
----------
|
|
386
|
+
f : BinaryIO
|
|
387
|
+
File object to be checked.
|
|
388
|
+
next_offset : int
|
|
389
|
+
Next section offset.
|
|
390
|
+
"""
|
|
391
|
+
if next_offset != f.tell():
|
|
392
|
+
return False
|
|
393
|
+
else:
|
|
394
|
+
return True
|
|
395
|
+
|
|
396
|
+
def _decode_phase(self, f):
|
|
397
|
+
"""
|
|
398
|
+
Decode phase section.
|
|
399
|
+
|
|
400
|
+
Parameters
|
|
401
|
+
----------
|
|
402
|
+
f : BinaryIO
|
|
403
|
+
File object to be decoded.
|
|
404
|
+
"""
|
|
405
|
+
# Decode phase data stream
|
|
406
|
+
if self.PHASE_MARKER != f.read(8):
|
|
407
|
+
raise DecodedValueValidationError("Phases are not properly aligned.")
|
|
408
|
+
next_offset, num_phases = self._decode_phase_header(f)
|
|
409
|
+
for phase_id in range(num_phases):
|
|
410
|
+
name, sym_code, a, b, c, alpha, beta, gamma, nfamily = unpack_autosize(
|
|
411
|
+
"<256sIffffffI", f
|
|
412
|
+
)
|
|
413
|
+
# Sanity check
|
|
414
|
+
if (alpha > 180) or (beta > 180) or (gamma > 180):
|
|
415
|
+
raise DecodedValueValidationError(
|
|
416
|
+
"Phase angle validation failed. Angle must be less than 180 degrees."
|
|
417
|
+
)
|
|
418
|
+
if nfamily > 10000:
|
|
419
|
+
raise DecodedValueValidationError(
|
|
420
|
+
"Phase hkl families validation failed. Too many number of hkl families."
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
hkl_triplets = unpack_autosize(f"<{nfamily * 3}i", f)
|
|
424
|
+
hkl_triplets = [
|
|
425
|
+
hkl_triplets[i : i + 3] for i in range(0, len(hkl_triplets), 3)
|
|
426
|
+
]
|
|
427
|
+
formula = unpack_autosize(f"<1280s", f)[0]
|
|
428
|
+
flags = unpack_autosize(f"<{nfamily}I", f)
|
|
429
|
+
float_value = unpack_autosize(f"<{nfamily}f", f)
|
|
430
|
+
|
|
431
|
+
# Pass unknown 184 bytes
|
|
432
|
+
f.seek(f.tell() + 184)
|
|
433
|
+
|
|
434
|
+
flags_2 = unpack_autosize(f"<{nfamily}I", f)
|
|
435
|
+
|
|
436
|
+
f.seek(f.tell() + 4)
|
|
437
|
+
elastic_constants = unpack_autosize(f"<36f", f)
|
|
438
|
+
elastic_constants = [elastic_constants[i : i + 6] for i in range(0, 36, 6)]
|
|
439
|
+
|
|
440
|
+
self.phases[phase_id + 1] = {
|
|
441
|
+
"MaterialName": string_processor(name),
|
|
442
|
+
"Symmetry": sym_code,
|
|
443
|
+
"LatticeConstants": [a, b, c, alpha, beta, gamma],
|
|
444
|
+
"NumberFamilies": nfamily,
|
|
445
|
+
"hklFamilies": list(zip(hkl_triplets, flags, float_value, flags_2)),
|
|
446
|
+
"Formula": string_processor(formula),
|
|
447
|
+
"Categories0": None, # Not implemented.
|
|
448
|
+
"ElasticConstants": elastic_constants, # Not implemented.
|
|
449
|
+
"LaueClass": SYMMETRY_CODE[sym_code].laue_class, # Additional metadata
|
|
450
|
+
"ReferenceFrame": (
|
|
451
|
+
SYMMETRY_CODE[sym_code].x,
|
|
452
|
+
SYMMETRY_CODE[sym_code].y,
|
|
453
|
+
SYMMETRY_CODE[sym_code].z,
|
|
454
|
+
), # Additional metadata
|
|
455
|
+
"LatticeSystem": SYMMETRY_CODE[
|
|
456
|
+
sym_code
|
|
457
|
+
].lattice_system, # Additional metadata
|
|
458
|
+
}
|
|
459
|
+
self.decoded_sections["PHASE"] = True # Update the decoding status
|
|
460
|
+
if (
|
|
461
|
+
not self._end_of_section_checker(f, next_offset)
|
|
462
|
+
and not self.decode_headers_only
|
|
463
|
+
):
|
|
464
|
+
raise DecodedValueValidationError(
|
|
465
|
+
"Validation failed. Incomplete decoding in phase section."
|
|
466
|
+
)
|
|
467
|
+
return next_offset
|
|
468
|
+
|
|
469
|
+
def _decode_unknown_section(self, f):
|
|
470
|
+
"""
|
|
471
|
+
Decode unknown section. As we don't know what this section stands for, it will be skipped.
|
|
472
|
+
|
|
473
|
+
Parameters
|
|
474
|
+
----------
|
|
475
|
+
f : BinaryIO
|
|
476
|
+
File object to be decoded.
|
|
477
|
+
"""
|
|
478
|
+
f.read(8)
|
|
479
|
+
(next_offset,) = unpack_autosize("<I", f)
|
|
480
|
+
return next_offset
|
|
481
|
+
|
|
482
|
+
def _decode_phase_header(self, f):
|
|
483
|
+
next_offset, _, _, num_phases = unpack_autosize("<IIII", f)
|
|
484
|
+
return next_offset, num_phases
|
|
485
|
+
|
|
486
|
+
def _decode_data(self, f):
|
|
487
|
+
"""
|
|
488
|
+
Decode EBSD data section.
|
|
489
|
+
|
|
490
|
+
Parameters
|
|
491
|
+
----------
|
|
492
|
+
f : BinaryIO
|
|
493
|
+
File object to be decoded.
|
|
494
|
+
"""
|
|
495
|
+
# Decode EBSD data stream
|
|
496
|
+
if self.DATA_MARKER != f.read(8):
|
|
497
|
+
raise DecodedValueValidationError("Data is not properly aligned.")
|
|
498
|
+
next_offset, xstep, ystep = self._decode_data_header(f)
|
|
499
|
+
|
|
500
|
+
# Sanity check for step sizes
|
|
501
|
+
if xstep < 0 or ystep < 0:
|
|
502
|
+
raise DecodedValueValidationError(
|
|
503
|
+
"Step sizes are negative. Decoding is faulty. Please report the error with the file."
|
|
504
|
+
)
|
|
505
|
+
if max([xstep, ystep]) / min([xstep, ystep]) > 2:
|
|
506
|
+
warn(
|
|
507
|
+
"Step sizes are significantly different. Please check the data for errors."
|
|
508
|
+
)
|
|
509
|
+
# Sanity check for the grid type.
|
|
510
|
+
if self.metadata["GridType"] == "HexGrid": # Check if the grid type is HexGrid
|
|
511
|
+
if xstep == ystep: # If XSTEP and YSTEP is equal, then it is not a HexGrid.
|
|
512
|
+
raise DecodedValueValidationError(
|
|
513
|
+
"XSTEP and YSTEP is equal for HexGrid. Decoding is faulty. Please report the error"
|
|
514
|
+
"with the file."
|
|
515
|
+
)
|
|
516
|
+
elif (
|
|
517
|
+
self.metadata["GridType"] == "SqrGrid"
|
|
518
|
+
): # Check if the grid type is SqrGrid
|
|
519
|
+
if (
|
|
520
|
+
xstep != ystep
|
|
521
|
+
): # If XSTEP and YSTEP is not equal, then it is not a SqrGrid.
|
|
522
|
+
raise DecodedValueValidationError(
|
|
523
|
+
"XSTEP and YSTEP is not equal for SqrGrid. Decoding is faulty. Please report the error"
|
|
524
|
+
"with the file."
|
|
525
|
+
)
|
|
526
|
+
else:
|
|
527
|
+
pass
|
|
528
|
+
self.metadata["XSTEP"] = xstep
|
|
529
|
+
self.metadata["YSTEP"] = ystep
|
|
530
|
+
|
|
531
|
+
if not self.decode_headers_only:
|
|
532
|
+
data = struct.unpack(
|
|
533
|
+
f"<{int((next_offset - f.tell()) / 4)}f",
|
|
534
|
+
f.read(next_offset - f.tell()),
|
|
535
|
+
)
|
|
536
|
+
if len(data) % self.metadata["N_DATA"] != 0:
|
|
537
|
+
raise DecodedValueValidationError(
|
|
538
|
+
"The provided column number is not fit with the total number of data points."
|
|
539
|
+
)
|
|
540
|
+
no_cols = int(len(data) / self.metadata["N_DATA"])
|
|
541
|
+
self.data = [data[i : i + no_cols] for i in range(0, len(data), no_cols)]
|
|
542
|
+
else:
|
|
543
|
+
no_cols = int(int(((next_offset - f.tell()) / 4)) / self.metadata["N_DATA"])
|
|
544
|
+
self.metadata["No. Columns"] = no_cols
|
|
545
|
+
self.decoded_sections["DATA"] = True # Update the decoding status
|
|
546
|
+
|
|
547
|
+
# Sanity check: if the all decoding went well then the cursor should be at the end of section.
|
|
548
|
+
if (
|
|
549
|
+
not self._end_of_section_checker(f, next_offset)
|
|
550
|
+
and not self.decode_headers_only
|
|
551
|
+
):
|
|
552
|
+
raise DecodedValueValidationError(
|
|
553
|
+
"Validation failed. Incomplete decoding in data section."
|
|
554
|
+
)
|
|
555
|
+
return next_offset
|
|
556
|
+
|
|
557
|
+
def _decode_data_header(self, f):
|
|
558
|
+
next_offset, _, xstep, ystep = unpack_autosize("<IIff", f)
|
|
559
|
+
return next_offset, xstep, ystep
|
|
560
|
+
|
|
561
|
+
def _decode_roi(self, f):
|
|
562
|
+
"""
|
|
563
|
+
Decode ROI section.
|
|
564
|
+
|
|
565
|
+
Parameters
|
|
566
|
+
----------
|
|
567
|
+
f : BinaryIO
|
|
568
|
+
File object to be decoded.
|
|
569
|
+
"""
|
|
570
|
+
# Decode unidentified data stream (skip)
|
|
571
|
+
if self.ROI_MARKER != f.read(8):
|
|
572
|
+
raise DecodedValueValidationError("Unknown data is not properly aligned.")
|
|
573
|
+
(
|
|
574
|
+
next_offset,
|
|
575
|
+
value1,
|
|
576
|
+
value2,
|
|
577
|
+
col_min,
|
|
578
|
+
col_max,
|
|
579
|
+
row_min,
|
|
580
|
+
row_max,
|
|
581
|
+
) = self._decode_roi_header(
|
|
582
|
+
f
|
|
583
|
+
) # It seems to be first 3 values are important. Role of first value is unknown.
|
|
584
|
+
|
|
585
|
+
# The offset between next section and current position is close to the multiplication of value1 and value2.
|
|
586
|
+
# Therefore, we can skip the unknown metadata. Assume data stream after the metadata stream.
|
|
587
|
+
f.seek(next_offset - (value1 * value2))
|
|
588
|
+
|
|
589
|
+
unknown_v = unpack_autosize(
|
|
590
|
+
f"<{value1 * value2}B", f
|
|
591
|
+
) # Read the unknown data (char data is the only selection)
|
|
592
|
+
if not self.decode_headers_only:
|
|
593
|
+
self.roi = [
|
|
594
|
+
unknown_v[i : i + value1] for i in range(0, len(unknown_v), value1)
|
|
595
|
+
]
|
|
596
|
+
self.decoded_sections["ROI"] = True # Update the decoding status
|
|
597
|
+
|
|
598
|
+
# Sanity check: if the all decoding went well then the cursor should be at the end of section.
|
|
599
|
+
if (
|
|
600
|
+
not self._end_of_section_checker(f, next_offset)
|
|
601
|
+
and not self.decode_headers_only
|
|
602
|
+
):
|
|
603
|
+
raise DecodedValueValidationError(
|
|
604
|
+
"Validation failed. Incomplete decoding in ROI section."
|
|
605
|
+
)
|
|
606
|
+
return next_offset
|
|
607
|
+
|
|
608
|
+
def _decode_roi_header(self, f):
|
|
609
|
+
(
|
|
610
|
+
next_offset,
|
|
611
|
+
_,
|
|
612
|
+
value1,
|
|
613
|
+
value2,
|
|
614
|
+
col_min,
|
|
615
|
+
col_max,
|
|
616
|
+
row_min,
|
|
617
|
+
row_max,
|
|
618
|
+
) = unpack_autosize("<IIIIffff", f)
|
|
619
|
+
return next_offset, value1, value2, col_min, col_max, row_min, row_max
|
|
620
|
+
|
|
621
|
+
def _decode_hough(self, f):
|
|
622
|
+
"""
|
|
623
|
+
Decode Hough section.
|
|
624
|
+
|
|
625
|
+
Parameters
|
|
626
|
+
----------
|
|
627
|
+
f : BinaryIO
|
|
628
|
+
File object to be decoded.
|
|
629
|
+
"""
|
|
630
|
+
if self.HOUGH_MARKER != f.read(8):
|
|
631
|
+
raise DecodedValueValidationError("Hough data is not properly aligned.")
|
|
632
|
+
|
|
633
|
+
(next_offset,) = self._decode_hough_header(f)
|
|
634
|
+
|
|
635
|
+
f.seek(f.tell() + 68)
|
|
636
|
+
hough = []
|
|
637
|
+
if not self.decode_headers_only:
|
|
638
|
+
for _ in range(self.metadata["N_DATA"]):
|
|
639
|
+
_, num_bands = unpack_autosize("<II", f)
|
|
640
|
+
|
|
641
|
+
rho_theta_width_mag = unpack_autosize(f"<{num_bands * 4}f", f)
|
|
642
|
+
hough.append(
|
|
643
|
+
[num_bands]
|
|
644
|
+
+ [
|
|
645
|
+
rho_theta_width_mag[i : i + 4]
|
|
646
|
+
for i in range(0, len(rho_theta_width_mag), 4)
|
|
647
|
+
]
|
|
648
|
+
)
|
|
649
|
+
self.hough = hough
|
|
650
|
+
self.decoded_sections["HOUGH"] = True # Update the decoding status
|
|
651
|
+
|
|
652
|
+
# Sanity check: if the all decoding went well then the cursor should be at the end of section.
|
|
653
|
+
if (
|
|
654
|
+
not self._end_of_section_checker(f, next_offset)
|
|
655
|
+
and not self.decode_headers_only
|
|
656
|
+
):
|
|
657
|
+
raise DecodedValueValidationError(
|
|
658
|
+
"Validation failed. Incomplete decoding in hough section."
|
|
659
|
+
)
|
|
660
|
+
return next_offset
|
|
661
|
+
|
|
662
|
+
def _decode_hough_header(self, f):
|
|
663
|
+
next_offset, _ = unpack_autosize("<II", f)
|
|
664
|
+
return (next_offset,)
|
|
665
|
+
|
|
666
|
+
def _decode_eds(self, f):
|
|
667
|
+
"""
|
|
668
|
+
Decode EDS section.
|
|
669
|
+
|
|
670
|
+
Parameters
|
|
671
|
+
----------
|
|
672
|
+
f : BinaryIO
|
|
673
|
+
File object to be decoded.
|
|
674
|
+
"""
|
|
675
|
+
if self.EDS_MARKER != f.read(8):
|
|
676
|
+
raise DecodedValueValidationError("Hough data is not properly aligned.")
|
|
677
|
+
|
|
678
|
+
try:
|
|
679
|
+
next_offset, n_eds = self._decode_eds_header(f)
|
|
680
|
+
except FaultyOffsetError:
|
|
681
|
+
return self._get_filesize(f)
|
|
682
|
+
|
|
683
|
+
elements = []
|
|
684
|
+
for phase_id in range(n_eds):
|
|
685
|
+
(name,) = unpack_autosize("<256s", f)
|
|
686
|
+
elements.append(string_processor(name))
|
|
687
|
+
self.metadata["EDS_ELEMENTS"] = elements
|
|
688
|
+
|
|
689
|
+
if not self.decode_headers_only:
|
|
690
|
+
self.eds_data = dict()
|
|
691
|
+
for element in elements:
|
|
692
|
+
self.eds_data[element] = unpack_autosize(
|
|
693
|
+
f"<{self.metadata['N_DATA']}I", f
|
|
694
|
+
)
|
|
695
|
+
self.decoded_sections["EDS"] = True # Update the decoding status
|
|
696
|
+
|
|
697
|
+
# Sanity check: if the all decoding went well then the cursor should be at the end of section.
|
|
698
|
+
if (
|
|
699
|
+
not self._end_of_section_checker(f, next_offset)
|
|
700
|
+
and not self.decode_headers_only
|
|
701
|
+
):
|
|
702
|
+
raise DecodedValueValidationError(
|
|
703
|
+
"Validation failed. Incomplete decoding in EDS section."
|
|
704
|
+
)
|
|
705
|
+
return next_offset
|
|
706
|
+
|
|
707
|
+
def _decode_eds_header(self, f):
|
|
708
|
+
(next_offset, _, n_eds) = unpack_autosize("<III", f)
|
|
709
|
+
if next_offset <= f.tell():
|
|
710
|
+
raise FaultyOffsetError
|
|
711
|
+
return next_offset, n_eds
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
class OSCVariantA(OSC):
|
|
715
|
+
def _decode_phase_header(self, f):
|
|
716
|
+
next_offset, _, num_phases = unpack_autosize("<III", f)
|
|
717
|
+
return next_offset, num_phases
|
|
718
|
+
|
|
719
|
+
def _decode_data_header(self, f):
|
|
720
|
+
next_offset, xstep, ystep = unpack_autosize("<Iff", f)
|
|
721
|
+
return next_offset, xstep, ystep
|
|
722
|
+
|
|
723
|
+
def _decode_hough_header(self, f):
|
|
724
|
+
(next_offset,) = unpack_autosize("<I", f)
|
|
725
|
+
return (next_offset,)
|
|
726
|
+
|
|
727
|
+
def _decode_roi_header(self, f):
|
|
728
|
+
(
|
|
729
|
+
next_offset,
|
|
730
|
+
value1,
|
|
731
|
+
value2,
|
|
732
|
+
col_min,
|
|
733
|
+
col_max,
|
|
734
|
+
row_min,
|
|
735
|
+
row_max,
|
|
736
|
+
) = unpack_autosize("<IIIffff", f)
|
|
737
|
+
return next_offset, value1, value2, col_min, col_max, row_min, row_max
|
|
738
|
+
|
|
739
|
+
def _decode_eds_header(self, f):
|
|
740
|
+
# TODO: Confirm that this is the correct assumption. All other header decoders ignore unidentified value (_),
|
|
741
|
+
# if this trend is the same for this method then it may be possible to override the EDS header decoder.
|
|
742
|
+
# Need a file to test.
|
|
743
|
+
(next_offset, n_eds) = unpack_autosize("<II", f)
|
|
744
|
+
return next_offset, n_eds
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
class OSCVariantAPh(OSCVariantA): # Variant A + additional mutation at Phase section --> APh.
|
|
748
|
+
def _decode_phase_header(self, f):
|
|
749
|
+
(
|
|
750
|
+
next_offset,
|
|
751
|
+
_,
|
|
752
|
+
num_phases,
|
|
753
|
+
) = unpack_autosize("<III", f)
|
|
754
|
+
return next_offset, num_phases
|
|
755
|
+
|
|
756
|
+
def _decode_phase(self, f):
|
|
757
|
+
if self.PHASE_MARKER != f.read(8):
|
|
758
|
+
raise DecodedValueValidationError("Phases are not properly aligned.")
|
|
759
|
+
next_offset, num_phases = self._decode_phase_header(f)
|
|
760
|
+
for phase_id in range(num_phases):
|
|
761
|
+
name, sym_code, a, b, c, alpha, beta, gamma, nfamily = unpack_autosize(
|
|
762
|
+
"<256sIffffffI", f
|
|
763
|
+
)
|
|
764
|
+
hkl_triplets = unpack_autosize(f"<{nfamily * 3}i", f)
|
|
765
|
+
hkl_triplets = [
|
|
766
|
+
hkl_triplets[i : i + 3] for i in range(0, len(hkl_triplets), 3)
|
|
767
|
+
]
|
|
768
|
+
f.read(1280) # Ignore chemistry entry
|
|
769
|
+
flags = unpack_autosize(f"<{nfamily}I", f)
|
|
770
|
+
float_value = unpack_autosize(f"<{nfamily}f", f)
|
|
771
|
+
|
|
772
|
+
# Pass unknown 184 bytes
|
|
773
|
+
f.seek(f.tell() + 184)
|
|
774
|
+
|
|
775
|
+
flags_2 = unpack_autosize(f"<{nfamily}I", f)
|
|
776
|
+
|
|
777
|
+
# Pass unknown 148 bytes.
|
|
778
|
+
f.read(4)
|
|
779
|
+
elastic_constants = unpack_autosize(f"<36f", f)
|
|
780
|
+
elastic_constants = [elastic_constants[i : i + 6] for i in range(0, 36, 6)]
|
|
781
|
+
self.phases[phase_id + 1] = {
|
|
782
|
+
"MaterialName": string_processor(name),
|
|
783
|
+
"Symmetry": sym_code,
|
|
784
|
+
"LatticeConstants": [a, b, c, alpha, beta, gamma],
|
|
785
|
+
"NumberFamilies": nfamily,
|
|
786
|
+
"hklFamilies": list(zip(hkl_triplets, flags, float_value, flags_2)),
|
|
787
|
+
"Formula": None,
|
|
788
|
+
"Categories0": None, # Not implemented.
|
|
789
|
+
"ElasticConstants": elastic_constants, # Not implemented.
|
|
790
|
+
"LaueClass": SYMMETRY_CODE[sym_code].laue_class, # Additional metadata
|
|
791
|
+
"ReferenceFrame": (
|
|
792
|
+
SYMMETRY_CODE[sym_code].x,
|
|
793
|
+
SYMMETRY_CODE[sym_code].y,
|
|
794
|
+
SYMMETRY_CODE[sym_code].z,
|
|
795
|
+
), # Additional metadata
|
|
796
|
+
"LatticeSystem": SYMMETRY_CODE[
|
|
797
|
+
sym_code
|
|
798
|
+
].lattice_system, # Additional metadata
|
|
799
|
+
}
|
|
800
|
+
self.decoded_sections["PHASE"] = True # Update the decoding status
|
|
801
|
+
return next_offset
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: open_osc
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Open source binary decoder for OSC file format.
|
|
5
|
+
Author-email: Sang-Hyeok Lee <lee@imm.rwth-aachen.de>
|
|
6
|
+
Maintainer-email: Sang-Hyeok Lee <lee@imm.rwth-aachen.de>
|
|
7
|
+
Project-URL: Homepage, https://git.rwth-aachen.de/imm_git/openosc
|
|
8
|
+
Keywords: file reader,osc,development
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: documentation
|
|
20
|
+
Requires-Dist: numpydoc; extra == "documentation"
|
|
21
|
+
Requires-Dist: sphinx; extra == "documentation"
|
|
22
|
+
Requires-Dist: sphinx-autoapi; extra == "documentation"
|
|
23
|
+
Requires-Dist: sphinx-material; extra == "documentation"
|
|
24
|
+
Requires-Dist: jupyter; extra == "documentation"
|
|
25
|
+
Requires-Dist: nbsphinx; extra == "documentation"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# OpenOSC: OSC file reader
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
pip install open-osc
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Dependencies
|
|
37
|
+
|
|
38
|
+
No dependencies. This library only uses Python standard library for normal use.
|
|
39
|
+
|
|
40
|
+
## Capability
|
|
41
|
+
|
|
42
|
+
The software can decode different sections of the OSC file, not just the EBSD data. The software can decode the following sections:
|
|
43
|
+
|
|
44
|
+
- EBSD data (Euler angles, X, Y, ...)
|
|
45
|
+
- Hough points
|
|
46
|
+
- EDS (ROI integration) data, if available
|
|
47
|
+
- ROI (region of interest) data, if available. Basically high resolution detector signal data in 8 bit grey scale image.
|
|
48
|
+
- Phases
|
|
49
|
+
- Header
|
|
50
|
+
|
|
51
|
+
This software does not decode all the fields in the OSC file. It only decodes the data identified by the authors/contributors. Use the software at your own risk.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from open_osc import load_osc
|
|
57
|
+
|
|
58
|
+
# Load
|
|
59
|
+
osc_file = load_osc('path/to/file.osc')
|
|
60
|
+
|
|
61
|
+
# Interact with the decoded data
|
|
62
|
+
ebsd_data = osc_file.data_as_dictionary()
|
|
63
|
+
euler1 = ebsd_data['phi1']
|
|
64
|
+
euler2 = ebsd_data['phi']
|
|
65
|
+
euler3 = ebsd_data['phi2']
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Stage
|
|
69
|
+
|
|
70
|
+
- The software can decode most publicly available OSC files.
|
|
71
|
+
- Not ready for production. Use at your own risk.
|
|
72
|
+
|
|
73
|
+
## Developments
|
|
74
|
+
|
|
75
|
+
### Known bugs
|
|
76
|
+
|
|
77
|
+
- Inference of NCOL_EVEN and NCOL_ODD is sometimes faulty.
|
|
78
|
+
|
|
79
|
+
### Todo
|
|
80
|
+
|
|
81
|
+
- Identify the field for the elastic modulus
|
|
82
|
+
- Decode the hough indexing parameters.
|
|
83
|
+
- Identify the header fields. It is largely unknown.
|
|
84
|
+
|
|
85
|
+
## Bug / Incompatibility Reporting
|
|
86
|
+
|
|
87
|
+
If you encounter an incompatibility with the OSC file, please open a new issue and attach the following files:
|
|
88
|
+
|
|
89
|
+
- The *.OSC file in question.
|
|
90
|
+
- The corresponding *.ANG file, directly exported from the manufacturer software.
|
|
91
|
+
|
|
92
|
+
To ensure proper testing, submitted files may be uploaded to the Git repository and released under the same license as this repository. (MIT) as this repository. Please submit the file only if you agree to this condition, and the file you submit MUST be owned by you, or you have the right to distribute/license it. If possible, please submit a small osc file (< 3 MB).
|
|
93
|
+
|
|
94
|
+
Please also provide the following information:
|
|
95
|
+
|
|
96
|
+
- The manufacturer-software version.
|
|
97
|
+
- The instrument used to measure the data (electron microscope, EBSD detector, ...).
|
|
98
|
+
- If applicable, the context of the data. In the case of someone who might want to use the data for their own purposes (the MIT licence does not prohibit off-purpose use).
|
|
99
|
+
|
|
100
|
+
## Acknowledgement
|
|
101
|
+
|
|
102
|
+
### Test data sources
|
|
103
|
+
|
|
104
|
+
Test datasets are not yet included in this repository, though they will be bundled in ./tests/data/ for testing purposes. These files will originate either from our research group or from external sources under compatible licenses (e.g., MIT, Public Domain), with *.bibtex files alongside them detailing original sources and licenses.
|
|
105
|
+
|
|
106
|
+
### Funding
|
|
107
|
+
|
|
108
|
+
Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) as part of Collaborative Research Centre CRC 1394 - Structural and Chemical Atomic Complexity - From Defect Phase Diagrams to Material Properties (project number 409476157) and under the National Research Data Infrastructure – NFDI 38/1 (project number 460247524)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
open_osc/__init__.py,sha256=lIXJ_lhSVqxhb0ARonwhF4v0-DGV-w0ENJgMe71R88Y,63
|
|
2
|
+
open_osc/_decode.py,sha256=MPsOSln4RsA36xsWzChkc_bFubo2KthtCafwx_gSzPM,29550
|
|
3
|
+
open_osc-0.0.0.dist-info/licenses/LICENSE,sha256=_gva6Pik7fkzBUYB34itY9fZ5eGWjbx3oUFnAfoxHx0,1086
|
|
4
|
+
open_osc-0.0.0.dist-info/METADATA,sha256=UZvtvj6OGLLs0csTarnkWIEjXbDf8_aKVeOsm046F1E,4179
|
|
5
|
+
open_osc-0.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
open_osc-0.0.0.dist-info/top_level.txt,sha256=AbgRan_tLF2rDc3GgJ2FwJF9rRCJ3x07xnnYj-VQoYQ,9
|
|
7
|
+
open_osc-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sang-Hyeok Lee, Khalil Rejiba
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
open_osc
|