#!/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('aj.csv', deletechars=',')

nsize = isqrt(len(A2))

print(A2.shape)

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

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

#%%
