Commit e426ec6e authored by Bryce Hepner's avatar Bryce Hepner

end of day, no major findings

parent 824f26de
from functools import singledispatchmethod
from cv2 import mean
import numpy as np
from WorkingPyDemo import *
from Remove_Noise import *
......@@ -13,7 +11,7 @@ from sklearn.metrics import mean_squared_error
scenes = remote_file_extractor("/media/elphel/NVME/lwir16-proc/te0607/scenes/")
images = remote_image_extractor(scenes)
images = find_only_in_channel(images, "5")
# images = find_only_in_channel(images, "5")
sftp_client = setup_remote_sftpclient()
image_array = np.array(Image.open(sftp_client.open(images[250])))
# image_array = np.array(Image.open(images[250])).astype(np.uint16)
......@@ -52,22 +50,30 @@ def intarray_to_uint32(int_array):
# print(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[0:6])
frame_spacings = []
signaltonoise = []
information_array = np.zeros((len(images),3))
information_array = np.zeros((len(images),5))
def celcius_to_kelvin(celcius):
return celcius + 273.15
for i in range(len(images)):
last_image = np.array(Image.open(sftp_client.open(images[0]))).astype(np.uint16)
for i in range(1,3000):
image_array = np.array(Image.open(sftp_client.open(images[i]))).astype(np.uint16)
current_frame_count = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[84:88])
frame_count_at_FFC = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[88:92])
# signaltonoise.append(1/np.std(image_array[1:]))
information_array[i,0] = current_frame_count - frame_count_at_FFC
# information_array[i,-1] = 1/np.std(image_array[1:])
information_array[i,-1] = mean_squared_error(gaussian_filter(image_array[1:],sigma=.4),image_array[1:])
information_array[i,-1] = 4096/np.std(image_array[1:])
information_array[i,-2] = mean_squared_error(gaussian_filter(image_array[1:],sigma=.4),image_array[1:])
# print(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[76:77])
# print("start")
information_array[i,1] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[94:96]) - \
celcius_to_kelvin(intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[162:166]))
# information_array[i,1] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[94:96]) - \
# celcius_to_kelvin(intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[162:166]))
information_array[i,1] = mean_squared_error(gaussian_filter(last_image[1:],sigma=.4),last_image[1:])
# information_array[i,2] = 20*np.log10(np.std(image_array[1:]))
if images[i][-7] == "1":
information_array[i,2] = images[i][-7:-5]
else:
information_array[i,2] = images[i][-6:-5]
# print(information_array[i,2])
# information_array[i,3] = np.std(image_array[1:])
# information_array[i,2] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[96:98])
# information_array[i,2] = celcius_to_kelvin(intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[162:166]))
# information_array[i,4] = information_array[i,1] - information_array[i,2]
......@@ -75,6 +81,7 @@ for i in range(len(images)):
# information_array[i,4] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[170:174])
# information_array[i,5] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[174:178])
# frame_spacings.append(current_frame_count - frame_count_at_FFC)
last_image = np.array(Image.open(sftp_client.open(images[i]))).astype(np.uint16)
# print(np.argmin(signaltonoise))
# print(np.argmax(signaltonoise))
# print(np.min(abs(np.array(frame_spacings))))
......@@ -82,11 +89,25 @@ for i in range(len(images)):
mask = information_array[:,0] > 0
information_df = pd.DataFrame(information_array[mask],columns=["Frame_Spacing","Curr_Temp_Diff","Signal_to_Noise"])
information_df.to_csv("information_weird_array.csv")
information_df = pd.read_csv("information_weird_array.csv")
information_df = pd.DataFrame(information_array[mask],columns=["Frame_Spacing","Last_MSE","ImageName","Signal_to_Noise","MSE"])
information_df.to_csv("smaller_information_weird_array.csv")
information_df = pd.read_csv("smaller_information_weird_array.csv",index_col=0)
information_array = information_df.values
print(information_array[0,2])
plt.scatter(information_array[:,0],information_array[:,-1],s=1)
plt.legend()
plt.xlabel("Frame_Spacing")
plt.ylabel("Signal_to_Noise")
plt.show()
colors = ["red","blue","green","orange","purple","brown","pink","black","grey","cyan","magenta","yellow","white","lime","teal","olive","maroon","navy","silver","gold","indigo","violet"]
secondmask = information_array[:,1] < 30000
print(np.unique(information_array[:,2]))
for g in np.unique(information_array[:,2]):
i = np.where(information_array[:,2] == g)
print(g)
plt.scatter(information_array[:,1][secondmask][i],information_array[:,4][secondmask][i],s=1,label=g,color = colors[int(g)])
plt.legend()
plt.xlabel("Frame_Spacing")
plt.ylabel("Signal_to_Noise")
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment