Skip to content

Commit

Permalink
fix: better default suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
jokasimr committed Oct 26, 2023
1 parent 1d2b612 commit 6f9ec49
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/scippnexus/nxdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def assemble(self, dg: sc.DataGroup) -> Union[sc.DataArray, sc.Dataset]:
return array_or_dataset

@staticmethod
def transform_bitmask_to_dict_of_masks(bitmask: sc.Variable, suffix: str = None):
def transform_bitmask_to_dict_of_masks(bitmask: sc.Variable, suffix: str = ''):
bit_to_mask_name = {
0: 'gap',
1: 'dead',
Expand All @@ -627,9 +627,7 @@ def transform_bitmask_to_dict_of_masks(bitmask: sc.Variable, suffix: str = None)
# Check if the mask associated with the current `bit` is present
mask_is_present = (masks_present >> steps_to_first_bit) % 2
if mask_is_present:
name = bit_to_mask_name.get(bit, f'undefined_bit{bit}') + (
suffix if suffix is not None else ''
)
name = bit_to_mask_name.get(bit, f'undefined_bit{bit}') + suffix
masks[name] = sc.array(
dims=bitmask.dims,
values=(bitmask.values >> (steps_to_first_bit)) % 2,
Expand Down

0 comments on commit 6f9ec49

Please sign in to comment.