Generate TIFF from file

Using program main.py on my GitHub I created .bin file with command

value = values[0]
        print(pos, ix, iy, iz, value, thisTime)
        dataValues[ix][iy][iz] = value
        iy += 1
        timeLeft = (maxSteps - stepsTaken) * (totalElapsed / stepsTaken) / 60 / 60
        print(">>>>>>>>>>>> Estimated time left: [" + str(timeLeft) + "hr], Per Step: [" + str(totalElapsed / stepsTaken) + "s][" + str(thisTime) + "], Total Elapsed: [" + str(totalElapsed) + "s], Steps taken: [" + str(stepsTaken) + "] out of: [" + str(maxSteps) + "]")
        stepsTaken += 1

    ix += 1
    pickle.dump(dataValues, open('dataValues.bin', 'wb'))
iz += 1
pickle.dump(dataValues, open('dataValues.bin', 'wb'))

The program which generates tiff image is image.py:

# %%

import matplotlib.pyplot as plt
import numpy as np
import time
from PIL import Image
import math
import numpy as np
import json
import pickle
import matplotlib.cm as cm
import PIL.ImageOps
#from libtiff import TIFFfile, TIFFimage
import tifffile

def micronToStep(v):
    #approximately 62nm/step
    return round((v * 1000)/62)

def normalizeData(data):
    return (data - np.min(data)) / (np.max(data) - np.min(data))

def moving_average(x, w):
    return np.convolve(x, np.ones(w), 'valid') / w

def annot_max(x,y, ax=None):
    xmax = x[np.argmax(y)]
    ymax = y.max()
    text= "x={:.3f}, y={:.3f}".format(xmax, ymax)
    if not ax:
        ax=plt.gca()
    bbox_props = dict(boxstyle="square,pad=0.3", fc="w", ec="k", lw=0.72)
    arrowprops=dict(arrowstyle="->",connectionstyle="angle,angleA=0,angleB=60")
    kw = dict(xycoords='data',textcoords="axes fraction",
              arrowprops=arrowprops, bbox=bbox_props, ha="right", va="top")
    ax.annotate(text, xy=(xmax, ymax), xytext=(0.94,0.96), **kw)


fo = open('saveData2.bin', 'rb')
data = pickle.load(fo)
fo.close()


print("xyStep: ", data['xyStep'])
print("xRange: ", data['xRange'])
print("yRange: ", data['yRange'])
print("zRange: ", data['zRange'])
print("zBase: ", data['zBase'])

dimX = math.ceil(data['xRange'] / data['xyStep'])
dimY = math.ceil(data['yRange'] / data['xyStep'])
print(dimX, dimY)
img = np.zeros((dimX, dimY)).astype('uint16')

zRange = data['zRange']
imgData = data['data']
minValue = 999999999
maxValue = -999999999




for i in range(0, dimX):
    for j in range(0, dimY):
        if type(imgData[i][j]) is np.ndarray:

            try:
                smoothed = moving_average(imgData[i][j], 10)
                height = smoothed.argmax() # / smoothed.shape[0]) * zRange
            except TypeError:
                height = 0

            #if imgData[i][j] is None:
            #    height = 0
            #    print("none", i,j)
            #else:
            #    height = imgData[i][j].argmax()

            img[i][j] = height
            minValue = min(minValue, height)
            maxValue = max(maxValue, height)
            
            #xs = np.linspace(data['zBase'], data['zBase'] + data['zRange'], imgData[i][j].shape[0])
            #plt.plot(xs, imgData[i][j], "o")
            #new_y = moving_average(imgData[i][j], 5)
            #new_x = np.linspace(data['zBase'], data['zBase'] + data['zRange'], new_y.shape[0])
            #plt.plot(new_x, new_y, "-r")
            #annot_max(new_x,new_y)
            #plt.show()
            



print("Min: ", minValue)
print("Max: ", maxValue)


tifffile.imwrite('saveData2.tif', img)




#img -= minValue
#img -= img.min()
#print(img)
#img_normalized = (256*(img - np.min(img))/np.ptp(img)).astype(int)     
#print(img_normalized)

#im = Image.fromarray(np.uint8(img_normalized), 'L')
#im.save("out_big.png")
#im.show()

#final = np.zeros([dimX, dimY], dtype=np.uint16)
#for x, i in enumerate(img):
#    for y, j in enumerate(i):
#        final[x][y] = j
        
#tiff = TIFFimage(final, description='')
#tiff.write_file('saveData3.tif', compression='lzw')




#final = np.zeros([dimX,dimY,3])
#img = normalizeData(img)
#for x, i in enumerate(img):
#    for y, j in enumerate(i):
#        v = cm.BuPu(j)

#        final[x][y][0] = round(v[0] * 256)
#        final[x][y][1] = round(v[1] * 256)
#        final[x][y][2] = round(v[2] * 256)



#im = Image.fromarray(final, 'RGB')
#im = im.rotate(-90)
#im = im.transpose(Image.FLIP_LEFT_RIGHT)


#im = PIL.ImageOps.invert(im)
#im.save("bupu.png")
#im.show()
# %%

Program image.py nicely generates line TIFF image from the file linescan.bin

But running it with file dataValues.bin I get an error:

Traceback (most recent call last):
  File "image.py", line 44, in <module>
    print("xyStep: ", data['xyStep'])
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

How to correct it to get a picture like in the case of linescan.bin file?

The error occurs in the first thing that you do after reading the file. It must be about how pickle.load is interpreting your binary file.

The linescan.bin looks like this:

Python 3.9.10 (main, Feb  9 2022, 00:00:00) 
[GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import time
>>> from PIL import Image
>>> import math
>>> import numpy as np
>>> import json
>>> import pickle
>>> import matplotlib.cm as cm
>>> import PIL.ImageOps
>>> import tifffile
>>> fo = open('linescan.bin', 'rb')
>>> data = pickle.load(fo)
>>> fo.close()
>>> print(data)
{'xyStep': 20, 'xRange': 8000, 'yRange': 20, 'zRange': 1000, 'zBase': 677, 'data': [[array([4657, 4718, 5130, ..., 3323, 3068, 3039], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([7389, 6827, 6789, ..., 3698, 3385, 3422], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([ 9484,  9481, 10282, ...,  2287,  2223,  2124], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([11237, 11037, 11112, 12040, 11088, 11078, 11293, 11845, 10941,
       11060, 11437, 11729, 10717, 10638, 10500, 11391, 10649, 10445,
       10585, 11101, 10259, 10213, 10439, 11039, 10155, 10056, 10270,
       10796,  9983, 10057, 10516, 10870, 10122, 10090, 10622, 10589,
       10069, 10097, 10653, 10731, 10156, 10149, 10586, 10644, 11083,
       10350, 10344, 10720, 10983,  9829, 10650, 10838, 10313, 10246,
       10871, 10832, 10408, 10326, 10737, 11039, 10350, 10342, 10752,
       16442, 15677, 15527, 16478, 16011, 15426, 15240, 16034, 15878,
       15267, 15097, 16012, 15665, 15103, 15022, 16100, 15613, 14841,
       15583, 14895, 15008, 15951, 15326, 14467, 14271, 15367, 15193,
       14415, 14274, 14639, 15446, 13908, 13667, 14427, 13689, 13705,
       14589, 13777, 13445, 13531, 14218, 14036, 13374, 13574, 13316,
       14334, 13438, 13206, 13251, 14255, 13452, 13164, 13310, 14190,
       13101, 14160, 13148, 13056, 13577, 13688, 13072, 12948, 13485,
       13789, 12858, 12850, 13408, 13486, 12854, 12642, 13374, 13320,
       12777, 12638, 12639, 13760, 12944, 12705, 12796, 13704, 12826,
       12710, 12918, 13862, 12705, 12677, 12832, 13786, 12796, 12730,
       13105, 13841, 12733, 12700, 12937], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([11821, 11873, 12803, 11920, 11748, 11853, 12603, 11801, 11722,
       11968, 12722, 11957, 11832, 12028, 12680, 11646, 11685, 11999,
       12665, 11543, 11599, 12012, 12577, 11679, 11644, 12139, 12221,
       12598, 11652, 11803, 12397, 12543, 11731, 11768, 12361, 12536,
       11835, 11904, 12575, 12454, 11787, 11739, 12596, 12249, 11680,
       11739, 12543, 12340, 11891, 11830, 12751, 12308, 11901, 11907,
       12683, 12238, 11770, 11714, 12594, 12109, 11812, 11872, 12847,
       12213, 12017, 12125, 13040, 12213, 12041, 12239, 13167, 12062,
       11921, 12461, 12041, 12850, 12495, 12002, 11999, 12939, 12477,
       11709, 12857, 12375, 12009, 11893, 12958, 12320, 12022, 12144,
       13066, 12543, 12261, 12169, 13156, 12451, 12230, 12392, 13321,
       12452, 12362, 12351, 13332, 12446, 12248, 12642, 13346, 12326,
       12272, 12569, 13140, 12138, 12248, 12900, 13290, 12310, 12451,
       12860, 13611, 12591, 12723, 13285, 13433, 12586, 12618, 13253,
       13498, 12779, 12719, 13462, 13317, 12895, 12755, 12852, 13957,
       18207, 17492, 16467, 16506, 17215, 17156, 16159, 15791, 15821,
       16721, 15315, 14783, 14860, 15926, 14191, 14237, 15524, 14568,
       14235, 14157, 15159, 14151, 13861, 14112, 14944, 13905, 13841,
       14067, 15002, 14058, 13744, 14791, 13414, 13437, 14020, 14193,
       13117, 13173, 13562, 14133, 13174, 13088, 13352, 14142, 13139,
       13023, 13193, 13459, 13416, 12686, 12622, 13596, 13304, 12699,
       12567, 13153, 12943, 12443, 12401, 13325, 12897, 12269, 12324,
       13362, 12631, 12302, 12396, 13468, 12669, 12750, 12817, 13403,
       12611, 12423, 12668, 12816], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([12320, 12133, 12290, 13179, 12374, 12220, 12532, 13235, 12182,
       12286, 12612, 13102, 12118, 12541, 12913, 11908, 11864, 12368,
       12640, 11863, 11822, 12448, 12396, 11765, 11578, 11929, 12616,
       11806, 11582, 11785, 12089, 12573, 12131, 11765, 11742, 12668,
       11990, 11748, 11816, 12722, 11349, 12737, 11711, 11838, 12250,
       12574, 11803, 11791, 12225, 12479, 11698, 11806, 12265, 12584,
       15645, 15337, 14708, 14424, 15629, 15395, 14766, 14499, 15255,
       15464, 14591, 14683, 15625, 15509, 14828, 14766, 15738, 15501,
       14776, 14836, 15954, 15436, 14902, 14764, 15627, 16113, 15026,
       14927, 15154, 16344, 15069, 14941, 15287, 16102, 14893, 14823,
       15597, 16039, 15126, 15078, 15886, 16215, 15185, 15135, 15861,
       16269, 15266, 15356, 16101, 16404, 15515, 15516, 16587, 16196,
       15998, 15460, 15412, 16014, 16505, 15602, 15663, 16409, 16683,
       15758, 16656, 15865, 15805, 16478, 16135, 17113, 16140, 15790,
       15991, 17142, 16177, 15946, 16280, 17343, 16013, 15913, 16766,

       13160, 13749], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([12452, 13355, 12752, 12329, 12517, 13590, 12726, 12409, 12365,
       13210, 12821, 12429, 12430, 13402, 12825, 12878, 12611, 12511,
       13010, 13299, 12454, 12384, 13025, 13002, 12472, 12553, 13226,
       13231, 12566, 12632, 13160, 13064, 13553, 12461, 12495, 12758,
       13585, 12594, 12669, 13134, 13376, 12664, 12640, 13171, 13401,
       12617, 12650, 13402, 13199, 12878, 12687, 12644, 13730, 12973,
       12784, 13381, 12677, 12638, 13893, 12815, 12662, 12935, 14043,
       12833, 12900, 13211, 13974, 12982, 12903, 13313, 14043, 12907,
       12925, 13474, 13763, 12897, 13013, 13554, 13000, 13883, 13776,
       13172, 13184, 13980, 13707, 13137, 13172, 14008, 13808, 13286,
       32574, 32767, 31237, 32767, 31255, 31042, 32425, 32249, 30005,
       31359, 29806, 29820, 31964, 28881, 28826, 29547, 30250, 28031,
       27705, 28001, 29555, 26339, 26024, 26700, 28452, 26724, 25460,
       25398, 26808, 24463, 23943, 24292, 25808, 23588, 23396, 23294,
       24205, 22406, 22275, 23312, 22796, 21729, 21303, 22897, 21186,
       19984, 19788, 21392, 19599, 19015, 19113, 19904, 18000, 17635,
       17442, 18040, 17377, 16570, 16282, 17610, 16655, 15988, 15579,
       16160, 16760, 15225, 15234, 15369, 16234, 15950, 14855, 14701,
       15647, 14912, 14414, 14307, 15356, 14589, 14056, 14015, 15087,
       14148, 13593, 13684, 14571, 13732, 13304, 13690, 13273, 13681,
       13893, 13190, 13173, 13579, 13858, 12648, 12778, 13200, 13201,
       12366, 12378, 12887, 12923, 12098, 12138, 12797, 12599, 11997,
       12066, 12825, 12797, 12203, 12074, 13172, 12831, 12331, 12325,
       12869, 13907, 13079, 12790], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([13015, 12934, 12324, 12334, 13038, 12801, 12270, 12118, 13065,
       12781, 12264, 12191, 13149, 12719, 12417, 12350, 13361, 12531,
       12221, 12348, 12801, 12163, 12577, 12990, 12153, 12348, 12238,
       17604, 17086, 17611, 17851, 17474, 17125, 17170, 18780, 17770,
       31478, 30730, 31839, 31499, 29738, 29270, 30968, 30893, 29305,
       28857, 30352, 28007, 27803, 29202, 26281, 25923, 25969, 27456,
       25336, 25070, 25400, 26529, 23873, 24725, 24168, 23094, 22685,
       22029, 20901, 22683, 20930, 20240, 20953, 22319, 19917, 19672,
       20214, 20622, 19352, 18866, 18857, 18527, 19659, 18920, 17993,
       18291, 18368, 19361, 18241, 18218, 18054, 18427, 16924, 16927,
       17935, 16810, 17058, 17959, 16360, 16009, 16253, 16602, 15373,
       15287, 15621, 15887, 14857, 14803, 15212, 15388, 14402, 14404,
       14830, 15060, 14183, 14050, 14635, 14592, 13954, 13809, 14454,
       14329, 13624, 13520, 14959, 13697, 13808, 13516, 13840, 13512,
       13449, 14203, 12931, 12807, 13110, 13697, 12752, 12644, 13122,
       13326, 12520, 12505, 13157, 12801, 12340, 12217, 12934, 12842,
       12260, 12221, 13131, 12928, 12367, 12384, 13418, 12624, 12337,
       12416, 13477], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([12758, 13080, 12309, 12301, 12954, 12859, 12141, 12227, 12847,
       12882, 12245, 12346, 12904, 12969, 12200, 12222, 12950, 12799,
       12240, 12428, 12754, 12425, 13408, 12708, 12499, 12570, 13490,
       12792, 12465, 12583, 13670, 12622, 12434, 12823, 13541, 12564,
       21281, 19513, 19021, 19042, 19311, 17928, 17711, 18250, 18567,
       17190, 17459, 17681, 17382, 16457, 15905, 16652, 16404, 15234,
       15500, 16848, 15887, 14723, 14519, 15367, 14825, 14240, 14051,
       14891, 13883, 13432, 13123, 14151, 13546, 13074, 13008, 13930,
       13199, 12836, 12724, 13676, 12706, 12337, 12747, 13539, 12140,
       12463, 12440, 11983, 12684, 12453, 11817, 11916, 12424, 11617,
       12609, 11394, 11534, 12364, 12408, 11914, 12481, 12191, 12051,
       13525, 12522, 12415, 12726, 12917], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([12421, 12052, 11958, 13072, 12424, 11979, 12018, 13035, 12216,
       12072, 12033, 13003, 12362, 12115, 12018, 12682, 12432, 12069,
       11971, 13068, 12347, 12076, 12170, 13161, 11941, 12162, 12267,
       13150, 12237, 12101, 12229, 13256, 12222, 12286, 12685, 13144,
       12199, 12265, 12637, 13219, 12245, 12228, 12799, 13087, 12377,
       12378, 12979, 13225, 12296, 13356, 12480, 12547, 13054, 13548,
       12490, 13268, 12675, 12757, 12728, 13798, 12886, 12835, 13187,
       18217, 18641, 19535, 18114, 18207, 18900, 19387, 17992, 18181,
       32767, 32577, 32407, 32767, 32630, 32539, 32767, 32607, 32767,
       32087, 32767, 31924, 31548, 32767, 30923, 30925, 31772, 32767,
       30072, 30142, 31252, 31892, 29583, 28558, 29824, 29707, 27396,
       26851, 28201, 27191, 25797, 25573, 27221, 26253, 24853, 24410,
       26167, 24875, 24115, 23458, 24340, 23099, 22494, 22131, 23762,
       22604, 22424, 21500, 21402, 22796, 21635, 20911, 20352, 21911,
       20588, 20138, 20042, 20997, 19719, 19781, 18895, 19651, 20686,
       20160, 18816, 18426, 18989, 18923, 17835, 17570, 18274, 18233,
       16824, 16448, 16811, 16796, 15513, 15114, 16047, 15891, 15122,
       15036, 15753, 15145, 14386, 14189, 14745, 14833, 13771, 13211,
       13984, 13901, 13150, 13082, 13975, 13654, 13096, 12948, 13331,
       13775, 12898, 12745, 13303, 13092, 13044, 12783, 12413, 13039,
       12953, 12243, 12194, 12265, 13028, 12011, 11928, 12333, 12812,
       11980, 12025, 12458, 12892, 12076, 11982, 12543, 12658, 11968,
       12007, 12748], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [array([11793, 12768, 12093, 11732, 11743, 12774, 12061, 11760, 11808,
       12776, 11761, 12562, 11642, 11775, 12283, 12485, 11637, 11773,
       12200, 12782, 11839, 12025, 12471, 12739, 11881, 11926, 12491,
       12778, 11958, 12243, 11964, 12533, 12820, 12092, 12152, 12767,
       12618, 12067, 12095, 12835, 12600, 12182, 12246, 12999, 12878,
       12391, 12387, 13385, 12955, 12574, 13138, 12417, 12480, 13402,
       15171, 16121, 15644, 15074, 15235, 16562, 15581, 15315, 15341,
       16842, 15733, 15563, 15651, 16845, 15765, 16119, 17017, 15577,
       15714, 16462, 15778, 16718, 16600, 15828, 15870, 16500, 16992,
       15910, 15917, 16704, 16743, 15867, 15997, 16671, 17035, 16023,
       16077, 16816, 17055, 16135, 16080, 17113, 16789, 16066, 16046,
       17169, 16583, 16100, 16107, 17357, 16654, 16236, 16213, 17448,
       16677, 16215, 16676, 16321, 17561, 16648, 16288, 16546, 17805,
       16505, 16471, 16871, 17764, 16490, 16407, 16682, 17809, 16745,
       16491, 16900, 18044, 16972, 16869, 17147, 17678, 17783, 16836,
       16962, 17461, 17086, 18257, 17016, 16976, 17410, 18241, 16926,
       17024, 17894, 16951, 17581, 18382, 16996, 17142, 17557, 18772,
       14342, 14816, 13401, 13485, 13373, 14060, 12865, 12666, 12614,
       13606, 12582, 12452, 12548, 13392, 12356, 12073, 12046, 12216,
       12366, 11397, 11346, 11725, 11974, 11140, 11771, 11175, 11182,
       11937, 11842, 11350, 11443, 12354, 11885, 11487, 11543, 12488,
       12006, 12128, 12215, 13273, 12566, 12228], dtype=int32), [array([2823, 2790, 3064, ..., 5393, 5815, 5724], dtype=int32), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]}

while the dataValues.bin looks like this:

Python 3.9.10 (main, Feb  9 2022, 00:00:00) 
[GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import time
>>> from PIL import Image
>>> import math
>>> import numpy as np
>>> import json
>>> import pickle
>>> import matplotlib.cm as cm
>>> import PIL.ImageOps
>>> import tifffile
>>> fo = open('dataValues', 'rb')
>>> data = pickle.load(fo)
>>> fo.close()
>>> print(data)
[[[25103. 22739. 25191. 25313. 22338. 22040. 24238. 25049. 25165.     0.]
  [24551. 25130. 22559. 20837. 20452. 23132. 23490. 25049. 25129.     0.]
  [25211. 25211. 25373. 24060. 22675. 25105. 23020. 22145. 20837.     0.]
  [25009. 21020. 24766. 20574. 24118. 22930. 20332. 21789. 20655.     0.]
  [25070. 24523. 22032. 21060. 24482. 24682. 21971. 23531. 21445.     0.]
  [22194. 23308. 24746. 21404. 25292. 21080. 23915. 25252. 23500.     0.]
  [21404. 21125. 25130. 22609. 25233. 23490. 25090. 25427. 21141.     0.]
  [20856. 22546. 24077. 20509. 23378. 23652. 25252. 22882. 25313.     0.]
  [24893. 21263. 22690. 22761. 23450. 25110. 24364. 20245. 25313.     0.]
  [25070. 21642. 21465. 21954. 21080. 20535. 21716. 21384. 24889.     0.]]

 [[25151. 23551. 25211. 21653. 22736. 24766. 21734. 21566. 20492.     0.]
  [20817. 20858. 25130. 20675. 25171. 24948. 21951. 25171. 24604.     0.]
  [20777. 24017. 24948. 20999. 21313. 25171. 23156. 25171. 25313.     0.]
  [22181. 24806. 25252. 22298. 20493. 24989. 25333. 24074. 25082.     0.]
  [23442. 24017. 25070. 24645. 20303. 25252. 24829. 21843. 20367.     0.]
  [25151. 25272. 25272. 24196. 20777. 24347. 23306. 23774. 24887.     0.]
  [25009. 24685. 24401. 22705. 25159. 25049. 20491. 25353. 25151.     0.]
  [24746. 24300. 21364. 21899. 22462. 22596. 23490. 25105. 24071.     0.]
  [25292. 20308. 24482. 24501. 22591. 20959. 25353. 23310. 20270.     0.]
  [24442. 22914. 21101. 20574. 23348. 22133. 25232. 20513. 23936.     0.]]

 [[25373. 20734. 23006. 25171. 20979. 21695. 24939. 25211. 23024.     0.]
  [23060. 25394. 25191. 25171. 22335. 22877. 22396. 25110. 20756.     0.]
  [25191. 21020. 20468. 25044. 24563. 25151. 20696. 24566. 21809.     0.]
  [23348. 23753. 20520. 25066. 25353. 25151. 23531. 20756. 25151.     0.]
  [20613. 22920. 21668. 24390. 24514. 23142. 25211. 22901. 23743.     0.]
  [23682. 23348. 22214. 22476. 25212. 20513. 23520. 25110. 22920.     0.]
  [23341. 21141. 24057. 21402. 24019. 20798. 20716. 25251. 21303.     0.]
  [22740. 23612. 22923. 20777. 20472. 20898. 21566. 21116. 25252.     0.]
  [24633. 21668. 22274. 21263. 21737. 21749. 23672. 20372. 25142.     0.]
  [25211. 20540. 22550. 21222. 22784. 25049. 21627. 25272. 24327.     0.]]

 [[24867. 22417. 24258. 24158. 20531. 22316. 23860. 23111. 20716.     0.]
  [21040. 25292. 24774. 23270. 24724. 23703. 25130. 23488. 20696.     0.]
  [23187. 25333. 25110. 23099. 24408. 23612. 23385. 20534. 25211.     0.]
  [23571. 25373. 25130. 22018. 24738. 21465. 25394. 22619. 23086.     0.]
  [21235. 25270. 25110. 21387. 23067. 23774. 23510. 22845. 20421.     0.]
  [25185. 24968. 24985. 20594. 20574. 25232. 25171. 24835. 22891.     0.]
  [25292. 21445. 25116. 20887. 21007. 23450. 24874. 25009. 25029.     0.]
  [25009. 25090. 25029. 21728. 20478. 23281. 23693. 21344. 25107.     0.]
  [25090. 25191. 25029. 23242. 23470. 20655. 20412. 24725. 20675.     0.]
  [20393. 25373. 24525. 24320. 25252. 22925. 23510. 25191. 23219.     0.]]

 [[20518. 21333. 25313. 23713. 25151. 20351. 21789. 25029. 20959.     0.]
  [24563. 24058. 25333. 21880. 25272. 20402. 25292. 21131. 24834.     0.]
  [22412. 24858. 25009. 20366. 25373. 25029. 24834. 20696. 22194.     0.]
  [21121. 25272. 25191. 20209. 25312. 25232. 20493. 24563. 25049.     0.]
  [20736. 25353. 25130. 21242. 25029. 25252. 22453. 25110. 22622.     0.]
  [22116. 25090. 25151. 20391. 23813. 25377. 23571. 25311. 20655.     0.]
  [25029. 25110. 25211. 23045. 22723. 24763. 25049. 22351. 21425.     0.]
  [24285. 24989. 25049. 22110. 20694. 23393. 25414. 23915. 25049.     0.]
  [25063. 25333. 24787. 20675. 20777. 20939. 25252. 25130. 25373.     0.]
  [25009. 25090. 21404. 25353. 22877. 20594. 20425. 24176. 22350.     0.]]

 [[21020. 20858. 25252. 22757. 23325. 21627. 24503. 22229. 23000.     0.]
  [22756. 22635. 21303. 25137. 21182. 23040. 25130. 23551. 24260.     0.]
  [23157. 21603. 25252. 23763. 20727. 20351. 25292. 22073. 25231.     0.]
  [23206. 22638. 25171. 23611. 22384. 21728. 25304. 24482. 22710.     0.]
  [23525. 21504. 25110. 21627. 22579. 23308. 21485. 25211. 25272.     0.]
  [25292. 21404. 25373. 20878. 24746. 25292. 25170. 24809. 23875.     0.]
  [24990. 21455. 25313. 23380. 25029. 25394. 20485. 20777. 25414.     0.]
  [25353. 20675. 24941. 20817. 24683. 24710. 22854. 20949. 24075.     0.]
  [25275. 20999. 23862. 22799. 23459. 23494. 21931. 23855. 20554.     0.]
  [25009. 21404. 24066. 20696. 20736. 20554. 25009. 25049. 23976.     0.]]

 [[20979. 23875. 24911. 24745. 22263. 23774. 25292. 25272. 25333.     0.]
  [22725. 25130. 21668. 20756. 23409. 20817. 25393. 22737. 24932.     0.]
  [24861. 24766. 25171. 20493. 20756. 22428. 24331. 21736. 21550.     0.]
  [25052. 21141. 25313. 25272. 20367. 22700. 20777. 21101. 23290.     0.]
  [24710. 25151. 24923. 20508. 22655. 25252. 25191. 24462. 25292.     0.]
  [25353. 23855. 24689. 22462. 23733. 25394. 24239. 25172. 23470.     0.]
  [25110. 24766. 24206. 23308. 25191. 23922. 25191. 23070. 20878.     0.]
  [25272. 25130. 24151. 22474. 25191. 21323. 24795. 20858. 23672.     0.]
  [22833. 21263. 21556. 23369. 25272. 20898. 22115. 23181. 25213.     0.]
  [22898. 21425. 22938. 25353. 22413. 21344. 20478. 25029. 22833.     0.]]

 [[23470. 20550. 20837. 25313. 25029. 23875. 25313. 24521. 25031.     0.]
  [21613. 25090. 22860. 21364. 20837. 21182. 23996. 22032. 25373.     0.]
  [25110. 25049. 22760. 24847. 24559. 23104. 24395. 23409. 23614.     0.]
  [23915. 25252. 22999. 23713. 23267. 25333. 21704. 25353. 21607.     0.]
  [24887. 25211. 24543. 25171. 22724. 25353. 24993. 25252. 25313.     0.]
  [22678. 25232. 25313. 25090. 21830. 24556. 24077. 25233. 25002.     0.]
  [23080. 24563. 25373. 25110. 21263. 21475. 25353. 23551. 25130.     0.]
  [20614. 24503. 24523. 24239. 22771. 23043. 25003. 20756. 20492.     0.]
  [22734. 25009. 24138. 22670. 25353. 20573. 22504. 22862. 23794.     0.]
  [21242. 25333. 24543. 25151. 25009. 21566. 21101. 24867. 25171.     0.]]

 [[24989. 22599. 24220. 21030. 21992. 21263. 21425. 25151. 21613.     0.]
  [25211. 20918. 24034. 22335. 22214. 22761. 24523. 25313. 22405.     0.]
  [23693. 20777. 20387. 23429. 21131. 25232. 25186. 20584. 21222.     0.]
  [23126. 20473. 22028. 25353. 24725. 25292. 23167. 23055. 24179.     0.]
  [22012. 20635. 20533. 25049. 23014. 23774. 20858. 21723. 25151.     0.]
  [21566. 22331. 21222. 25088. 25333. 21101. 22884. 24734. 22603.     0.]
  [20464. 21818. 22038. 24063. 24364. 20713. 24989. 21771. 21992.     0.]
  [22434. 21546. 20898. 21202. 24279. 21944. 25333. 23753. 25232.     0.]
  [23906. 20979. 20463. 20511. 22488. 21708. 23340. 23261. 24686.     0.]
  [25270. 21652. 21182. 22234. 22135. 22900. 20453. 25252. 20999.     0.]]

 [[21999. 23875. 25313. 21627. 25009. 24604. 25110. 25009. 24017.     0.]
  [21242. 23207. 25130. 24615. 22310. 25191. 20655. 24227. 22563.     0.]
  [21121. 22861. 25171. 20473. 21957. 25394. 25171. 22133. 25211.     0.]
  [20696. 22603. 25373. 20700. 20916. 25393. 25203. 24300. 20736.     0.]
  [20464. 23037. 24928. 21668. 23004. 21997. 23026. 25171. 22608.     0.]
  [20372. 23105. 23046. 21931. 25434. 20696. 20320. 20999. 25414.     0.]
  [20686. 22984. 24792. 23733. 25151. 22862. 23227. 22352. 23166.     0.]
  [21574. 22857. 25239. 24381. 21384. 25171. 25313. 24989. 20655.     0.]
  [23187. 22741. 24804. 25049. 24486. 25353. 25191. 25146. 23009.     0.]
  [23531. 22625. 24256. 25353. 22197. 23510. 24639. 24893. 25373.     0.]]]

How to correct main.py to save data in the same format for generating image like in case of linescan.bin?

This is a pickle.load question, not really about the microscope. Something about your two .bin files means that pickle.load has attribute values 'xystep' etc in the loaded data for one but not for the other.