Skip to content

Commit

Permalink
Merge pull request #210 from MannLabs/temmmap_improvements
Browse files Browse the repository at this point in the history
add support for fixed string arrays
  • Loading branch information
mschwoer authored Nov 6, 2024
2 parents b7a8e68 + 0544a3d commit 2792468
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions alphabase/io/tempmmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def array(shape: tuple, dtype: np.dtype, tmp_dir_abs_path: str = None) -> np.nda

with h5py.File(temp_file_name, "w") as hdf_file:
array = hdf_file.create_dataset("array", shape=shape, dtype=dtype)
array[0] = 0
array[0] = np.string_("") if isinstance(dtype, np.dtypes.StrDType) else 0
offset = array.id.get_offset()

with open(temp_file_name, "rb+") as raw_hdf_file:
Expand Down Expand Up @@ -225,7 +225,7 @@ def create_empty_mmap(

with h5py.File(temp_file_name, "w") as hdf_file:
array = hdf_file.create_dataset("array", shape=shape, dtype=dtype)
array[0] = 0
array[0] = np.string_("") if isinstance(dtype, np.dtypes.StrDType) else 0

return temp_file_name

Expand Down

0 comments on commit 2792468

Please sign in to comment.