Skip to content

Commit

Permalink
Merge pull request #77 from deepanshs/djs/copy_frombuffer_data_when_l…
Browse files Browse the repository at this point in the history
…oading

djs/Copy `np.frombuffer` data when loading
  • Loading branch information
deepanshs authored Jul 3, 2023
2 parents d3c754c + c33520c commit 28294ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Bugfix
- Bugfix in serializing csdm #54
- You can multiply CSDM objects by a scalar to the right (`csdm * scalar`). The fix
now allows the multiplication of CSDM objects by a scalar to the left (`scalar * csdm`). #62
- Bugfix where csdm objects `.csdfe` files were immutable.

v0.5.0
------
Expand Down
2 changes: 2 additions & 0 deletions csdmpy/dependent_variable/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def decode_none(components, dtype, component_len=None):
def decode_raw(components, dtype, component_len=None):
"""Read components form a binary buffer"""
components = np.frombuffer(components, dtype=dtype)
if not components.flags["WRITEABLE"]:
components = components.copy()
size = int(components.size / component_len)
components = components.reshape(component_len, size)
return components
Expand Down

0 comments on commit 28294ec

Please sign in to comment.