Created
December 19, 2020 11:15
-
-
Save insaneyilin/940c99d9ea5b531aa3ec9a69bc9b6fd9 to your computer and use it in GitHub Desktop.
compare two numpy arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
{Description} | |
""" | |
from __future__ import print_function | |
import os | |
import sys | |
import argparse | |
import numpy as np | |
def get_args(): | |
parser = argparse.ArgumentParser( | |
description=__doc__, | |
formatter_class=argparse.RawDescriptionHelpFormatter) | |
parser.add_argument('infile1', help="Input file", | |
type=str) | |
parser.add_argument('infile2', help="Input file", | |
type=str) | |
return parser.parse_args() | |
def main(): | |
args = get_args() | |
# print(args) | |
arr1 = np.loadtxt(args.infile1) | |
arr2 = np.loadtxt(args.infile2) | |
np.testing.assert_allclose(arr1, arr2, rtol=1e-3, atol=1e-5) | |
print('check pass!') | |
return 0 | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment