mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-06-02 00:41:35 +00:00
Workaround for numpy treating indexed arrays as copies: operate on original array using indexes
This commit is contained in:
parent
4c4882b2b3
commit
ee030df3e1
14
atrcopy.py
14
atrcopy.py
|
@ -322,8 +322,18 @@ class RawSectorsSegment(DefaultSegment):
|
||||||
|
|
||||||
class IndexedByteSegment(DefaultSegment):
|
class IndexedByteSegment(DefaultSegment):
|
||||||
def __init__(self, byte_order, bytes, **kwargs):
|
def __init__(self, byte_order, bytes, **kwargs):
|
||||||
data = bytes[byte_order]
|
self.order = byte_order
|
||||||
DefaultSegment.__init__(self, 0, data, **kwargs)
|
DefaultSegment.__init__(self, 0, bytes, **kwargs)
|
||||||
|
|
||||||
|
def __getitem__(self, index):
|
||||||
|
return self.data[self.order[index]]
|
||||||
|
|
||||||
|
def __setitem__(self, index, value):
|
||||||
|
self.data[self.order[index]] = value
|
||||||
|
self._search_copy = None
|
||||||
|
|
||||||
|
def tostring(self):
|
||||||
|
return self.data[self.order[:]].tostring()
|
||||||
|
|
||||||
|
|
||||||
class AtariDosFile(object):
|
class AtariDosFile(object):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user