import dascore as dc
= dc.get_example_patch()
patch1 = dc.get_example_patch()
patch2
# Test equality
= patch1.equals(patch2)
are_equal
# Test with modified patch
= patch1.update_attrs(custom_attr="test")
modified = patch1.equals(modified, only_required_attrs=True)
equal_ignoring_custom
# Test with close comparison for numerical data
= patch1.new(data=patch1.data + 1e-10)
noisy = patch1.equals(noisy, close=True) close_equal
equals
equals(
self: Patch ,
other: Any ,
only_required_attrs = True,
close = False,
)-> ‘bool’
Determine if the current patch equals another.
Parameters
Parameter | Description |
---|---|
other | A Patch (could be equal) or some other type (not equal) |
only_required_attrs |
If True, only compare required attributes. This helps avoid issues with comparing histories or custom attrs of patches, for example. |
close |
If True, the data can be “close” using np.allclose, otherwise all data must be equal. |