Skip to content

Instantly share code, notes, and snippets.

View pspoerri's full-sized avatar
🏔️
🏂

Pascal Spörri pspoerri

🏔️
🏂
View GitHub Profile
### Keybase proof
I hereby claim:
* I am pspoerri on github.
* I am inf (https://keybase.io/inf) on keybase.
* I have a public key whose fingerprint is 1FF4 61B8 D73C 9712 FB2E 65AE 89C9 1086 6368 D948
To claim this, I am signing this object:
@pspoerri
pspoerri / Compare.py
Last active December 20, 2016 09:48
Serialbox Compare Arrays
import numpy as np
def match_arrays(a, b, threshold=0.0):
diff = np.abs(a - b)
if diff.min() <= diff.max() and diff.max() <= threshold:
return True, ""
return False, "abs(a-b): min= {min} max= {max}".format(min=diff.min(), max=diff.max())
def compare_dicts(a, b, fun, ident=""):
for k, v in b.items():
### Keybase proof
I hereby claim:
* I am minusinf on github.
* I am inf (https://keybase.io/inf) on keybase.
* I have a public key whose fingerprint is 1FF4 61B8 D73C 9712 FB2E 65AE 89C9 1086 6368 D948
To claim this, I am signing this object: