From 6670245b5dc26db183a21f5d599d01868f70fc9b Mon Sep 17 00:00:00 2001 From: Kimoon Han <98246499+kmnhan@users.noreply.github.com> Date: Mon, 10 Jul 2023 16:05:50 +0900 Subject: [PATCH] feat(packed): enable specifying initial byte order --- igor2/packed.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/igor2/packed.py b/igor2/packed.py index 15c8cdf..caf413a 100644 --- a/igor2/packed.py +++ b/igor2/packed.py @@ -43,7 +43,7 @@ # a later record in the packed file. -def load(filename, strict=True, ignore_unknown=True): +def load(filename, strict=True, ignore_unknown=True, initial_byte_order=None): logger.debug('loading a packed experiment file from {}'.format(filename)) records = [] if hasattr(filename, 'read'): @@ -51,7 +51,8 @@ def load(filename, strict=True, ignore_unknown=True): else: f = open(filename, 'rb') byte_order = None - initial_byte_order = '=' + if initial_byte_order is None: + initial_byte_order = '=' try: while True: PackedFileRecordHeader.byte_order = initial_byte_order