Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for fixed string arrays #210

Merged
merged 4 commits into from
Nov 6, 2024
Merged

Conversation

sophiamaedler
Copy link
Collaborator

currently the memory mapped temp arrays only work with arrays of numeric types
This adds support for fixed string types.

For e.g.:

#create an empty memory mapped array
dt = np.dtype(f'S{fixed_length}')
self._tmp_single_cell_index_path = create_empty_mmap(
                                        shape=single_cell_index_shape,
                                        dtype=dt,
                                        tmp_dir_abs_path=self._tmp_dir_path,
                                    )

#reconnect to the array (potentially from a different process)
 _tmp_single_cell_index = mmap_array_from_path(self._tmp_single_cell_index_path)

#add results to the array
_tmp_single_cell_index[save_index] = [save_index, cell_id]. #typing is enforced automatically here no need to convert to fixed string before hand

alphabase/io/tempmmap.py Outdated Show resolved Hide resolved
alphabase/io/tempmmap.py Outdated Show resolved Hide resolved
alphabase/io/tempmmap.py Outdated Show resolved Hide resolved
use np.dtypes.StrDType instead of np.dtypes.ObjectDType
@mschwoer mschwoer merged commit 2792468 into development Nov 6, 2024
2 checks passed
@mschwoer mschwoer deleted the temmmap_improvements branch November 6, 2024 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants