import dascore as dc
patch1 = dc.get_example_patch()
patch2 = dc.get_example_patch()
# Test equality
are_equal = patch1.equals(patch2)
# Test with modified patch
modified = patch1.update_attrs(custom_attr="test")
equal_ignoring_custom = patch1.equals(modified, only_required_attrs=True)
# Test with close comparison for numerical data
noisy = patch1.new(data=patch1.data + 1e-10)
close_equal = patch1.equals(noisy, close=True)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. |