Feb-01-2021, 10:29 AM
for 2d array, I'd use something like below
But you have a single dimension array, so you're way ahead of me on this.
But you have a single dimension array, so you're way ahead of me on this.
import numpy as np from scipy.ndimage.interpolation import rotate import os # make sure file can be found in script directory os.chdir(os.path.abspath(os.path.dirname(__file__))) def rotate_and_save(infilename, outfilename, rotation_angle_degrees=90): orig_array = np.fromfile(infilename, dtype=np.int64) print(f"\noriginal array\n{orig_array}") new_array = rotate(orig_array, angle=rotation_angle_degrees) print(f"\nnew array\n{new_array}") np.tofile(outfilename, dtype=np.int64) def main(): # Use any desired angle rotate_and_save('channel_order.bin', 'rotated_channel_order.bin', rotation_angle_degrees=180) if __name__ == '__main__': main(