#!/usr/bin/env python
+#
+# Copyright
"IBW -> ASCII conversion"
from .base import Record, UnknownRecord, UnusedRecord
from .variables import VariablesRecord
-from .history import HistoryRecord
+from .history import HistoryRecord, RecreationRecord, GetHistoryRecord
from .wave import WaveRecord
-from .recreation import RecreationRecord
from .procedure import ProcedureRecord
-from .gethistory import GetHistoryRecord
from .packedfile import PackedFileRecord
from .folder import FolderStartRecord, FolderEndRecord
class UnusedRecord (Record):
pass
+
+
+# Copyright
+
+from .base import Record
+
+
+class TextRecord (Record):
+ def __init__(self, *args, **kwargs):
+ super(TextRecord, self).__init__(*args, **kwargs)
+ self.text = str(self.data).replace('\r\n', '\n').replace('\r', '\n')
+++ /dev/null
-# Copyright
-
-from .base import Record
-
-
-class GetHistoryRecord (Record):
- pass
# Copyright
-from .base import Record
+from .base import TextRecord
-class HistoryRecord (Record):
+class HistoryRecord (TextRecord):
+ pass
+
+
+class RecreationRecord (TextRecord):
+ pass
+
+
+class GetHistoryRecord (TextRecord):
pass
+++ /dev/null
-# Copyright
-
-from .base import Record
-
-
-class RecreationRecord (Record):
- pass
'userStrs': {},
'userVars': {}}
record 31:
-<HistoryRecord ...>
+'\x95 Polar Graphs Demo, v3.01\n\n'
record 32:
(array([ 0.30000001, 0.5448544 , 0.77480197, 0.97584349, 1.13573945,
1.24475539, 1.2962544 , 1.28710103, 1.21785283, 1.09272552,
record 47:
<FolderEndRecord ...>
record 48:
-<RecreationRecord ...>
+'| Platform=Windows95, IGORVersion=3.130\n\n\n\nMoveWindow/P 5.25,40.25,504.75,335\n...hook=PolarWindowHook\nEndMacro\n'
record 49:
-<GetHistoryRecord ...>
+''
record 50:
<ProcedureRecord ...>
"""
from igor.binarywave import load as loadibw
from igor.packed import load as loadpxp
+from igor.record.base import TextRecord
from igor.record.variables import VariablesRecord
from igor.record.wave import WaveRecord
records = loadpxp(path, strict=strict)
for i,record in enumerate(records):
print('record {}:'.format(i))
- if isinstance(record, VariablesRecord):
+ if isinstance(record, TextRecord):
+ pprint(record.text)
+ elif isinstance(record, VariablesRecord):
pprint(record.variables)
elif isinstance(record, WaveRecord):
pprint(record.wave)