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

fix(tod.concatenate): Convert index map to unicode. #201

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions caput/tod.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,21 @@ def dataset_filter(d):
for axis, index_map in first_data.index_map.items():
if axis in concatenation_axes:
# Initialize the dataset.
dtype = index_map.dtype
if convert_dataset_strings:
dtype = memh5.dtype_to_unicode(index_map.dtype)
else:
dtype = index_map.dtype
out.create_index_map(
axis, np.empty(shape=(stop[axis] - start[axis],), dtype=dtype)
)
else:
# Just copy it.
out.create_index_map(axis, index_map)
out.create_index_map(
axis,
memh5.ensure_unicode(index_map)
if convert_dataset_strings
else index_map,
)

# Copy over the reverse maps.
for axis, reverse_map in first_data.reverse_map.items():
Expand Down Expand Up @@ -395,7 +403,11 @@ def dataset_filter(d):
current_concat_index_start[axis],
current_concat_index_n[axis],
)
out.index_map[axis][out_slice] = data.index_map[axis][in_slice]
out.index_map[axis][out_slice] = (
memh5.ensure_unicode(data.index_map[axis][in_slice])
if convert_attribute_strings
else data.index_map[axis][in_slice]
)
# Now copy over the datasets and flags.
this_dataset_names = _copy_non_time_data(
data,
Expand Down