#!/usr/bin/bash

import os,sys,math
import numpy as np
import matplotlib.pyplot as plt

from amsbinarrayrw import *

def plot_random1():

    fp = open("./build_linux64/tmp_testrand.bin","r+b")
    data = fread_dndarray(fp)
    N1 = data.shape[0]
    N2 = int(math.sqrt(N1))
    N3 = N2*N2
    data = data[0:N3]
    data = data.reshape([N2,N2])
    q = np.zeros([N2,N2,3])
    q[:,:,0] = data[:,:]
    q[:,:,1] = data[:,:]
    q[:,:,2] = data[:,:]
    
    hf = plt.figure(1)
    plt.imshow(q)
    plt.show()
    fp.close()

if(__name__=="__main__"):
    plot_random1()

    pass