zero_fill_with_mask#

openstef_core.utils.zero_fill_with_mask(values: ndarray) tuple[ndarray, ndarray][source]#

Split an array into a zero-filled copy and a finiteness mask.

Non-finite entries (NaN or infinities) are replaced with 0.0 in the returned values; the mask is 1.0 exactly where the original entry was finite. This is the common “feed raw values, tell the model which are real” step for masked model inputs.

Parameters:
  • values (ndarray) – Array of any shape.

  • values

Returns:

Tuple (filled, mask), both float32 and the same shape as values. filled has non-finite entries zeroed; mask is 1.0 where values was finite, 0.0 otherwise.

Return type:

tuple[ndarray, ndarray]