#!/usr/bin/env python

#%%

import numpy as np
import h5py
import matplotlib.pyplot as plt
from numpy import genfromtxt

def isqrt(n):
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x

A2 = genfromtxt('log', deletechars=',')

nsize = isqrt(len(A2))

print(A2.shape)

#%%
A2 = A2.reshape((nsize,nsize))
# A2 = np.sqrt(A2)

#%%
plt.imshow(A2)
plt.colorbar()
plt.clim([1400,1600])
plt.xlim([-0.5, 255.5])
plt.ylim([511.5, 255.5 ])
plt.grid()
plt.show()

#%%
