scitiff.concat_mask_as_channels#

scitiff.concat_mask_as_channels(da, mask_name)[source]#

Concatenate intensities and a mask into channel dimension.

Parameters:
  • da (DataArray) – The DataArray to retrieve a mask. If the mask cannot be determined, it will raise an error.

  • mask_name (str | None) – The name of the mask to be concatenated as a separate channel. If None, it will try to find a single mask with the same size as the da. If there are multiple masks with the same size, it will raise.

Returns:

DataArray – The DataArray with the mask concatenated in channel dimension. The intensities will lose the matching mask as they are concatenated as channels. It will have c coordinate with the size of corresponding channels.

Raises:

ValueError – If the DataArray has variances.

Tip

Use scipp.values() to drop variances

Tip

Use concat_stdevs_and_mask_as_channels() to concatenate both stdevs and a mask.