def is_npy(filename):
    from numpy.lib.format import MAGIC_PREFIX
    with open(filename, 'rb') as infile:
        return infile.read(6) == MAGIC_PREFIX
The first bytes are: x93NUMPY
dataset/ETHPy150Open glue-viz/glue/glue/core/data_factories/npy.py/is_npy