wecopttool.core.subset_close

subset_close(set_a, set_b, rtol=1e-05, atol=1e-08, equal_nan=False)[source]

Check if the first set set_a is contained, to some tolerance, in the second set set_b.

Parameters:
  • set_a (FloatOrArray) – First array which is tested for being subset.

  • set_b (FloatOrArray) – Second array which is tested for containing set_a.

  • rtol (float) – The relative tolerance parameter. Passed to numpy.isclose().

  • atol (float) – The absolute tolerance parameter. Passed to numpy.isclose().

  • equal_nan (bool) – Whether to compare NaNs as equal. Passed to numpy.isclose().

Returns:

  • subset – Whether the first array is a subset of the second array.

  • ind – List with integer indices where the first array’s elements are located inside the second array. Only contains values if subset==True.

Raises:

ValueError – If either of the two arrays contains repeated elements.

Return type:

tuple[bool, list]