I have a binary np array below:
arr = [0. 0. 1. ... 0. 1. 1.]
I would like to write it into a bin file (the output file name is 'test.bin'). I tried to use the command like this:
arr.astype('int8').tofile('test.bin')
But I found that each value in arr is converted to 8 bits.I do not want to use 8 bits to represent one number because I need to do the NIST sp800-22 randomness test, the input file must be a bin file. Could you give me some suggestions, so that I can use one bit in the bin file to represent one number in arr?
Thanks