Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
image-compression
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
image-compression
Commits
5981345f
Commit
5981345f
authored
Jul 28, 2022
by
Bryce Hepner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Probably small rerun
parent
2aee9566
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
31 deletions
+32
-31
MetadataAnalyzer.py
MetadataAnalyzer.py
+32
-31
No files found.
MetadataAnalyzer.py
View file @
5981345f
...
@@ -13,7 +13,7 @@ from sklearn.metrics import mean_squared_error
...
@@ -13,7 +13,7 @@ from sklearn.metrics import mean_squared_error
scenes
=
remote_file_extractor
(
"/media/elphel/NVME/lwir16-proc/te0607/scenes/"
)
scenes
=
remote_file_extractor
(
"/media/elphel/NVME/lwir16-proc/te0607/scenes/"
)
images
=
remote_image_extractor
(
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
()
sftp_client
=
setup_remote_sftpclient
()
image_array
=
np
.
array
(
Image
.
open
(
sftp_client
.
open
(
images
[
250
])))
image_array
=
np
.
array
(
Image
.
open
(
sftp_client
.
open
(
images
[
250
])))
# image_array = np.array(Image.open(images[250])).astype(np.uint16)
# image_array = np.array(Image.open(images[250])).astype(np.uint16)
...
@@ -56,7 +56,7 @@ information_array = np.zeros((len(images),5))
...
@@ -56,7 +56,7 @@ information_array = np.zeros((len(images),5))
def
celcius_to_kelvin
(
celcius
):
def
celcius_to_kelvin
(
celcius
):
return
celcius
+
273.15
return
celcius
+
273.15
last_image
=
np
.
array
(
Image
.
open
(
sftp_client
.
open
(
images
[
0
])))
.
astype
(
np
.
uint16
)
last_image
=
np
.
array
(
Image
.
open
(
sftp_client
.
open
(
images
[
0
])))
.
astype
(
np
.
uint16
)
for
i
in
range
(
1
,
300
0
):
for
i
in
range
(
20
,
4
0
):
image_array
=
np
.
array
(
Image
.
open
(
sftp_client
.
open
(
images
[
i
])))
.
astype
(
np
.
uint16
)
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
])
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
])
frame_count_at_FFC
=
intarray_to_uint32
(
repopulate_array_with_bitstring
(
uint16_array_to_bitstring
(
image_array
[
0
]))[
88
:
92
])
...
@@ -64,7 +64,8 @@ for i in range(1,3000):
...
@@ -64,7 +64,8 @@ for i in range(1,3000):
information_array
[
i
,
0
]
=
current_frame_count
-
frame_count_at_FFC
information_array
[
i
,
0
]
=
current_frame_count
-
frame_count_at_FFC
information_array
[
i
,
-
1
]
=
4096
/
np
.
std
(
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
:])
information_array
[
i
,
-
2
]
=
mean_squared_error
(
gaussian_filter
(
image_array
[
1
:],
sigma
=
.4
),
image_array
[
1
:])
print
(
intarray_to_uint32
(
repopulate_array_with_bitstring
(
uint16_array_to_bitstring
(
image_array
[
0
]))[
110
:
111
]))
# print(bin(intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[110:112]))[2:].zfill(8))
print
(
bin
(
intarray_to_uint32
(
repopulate_array_with_bitstring
(
uint16_array_to_bitstring
(
image_array
[
0
]))[
110
:
114
]))[
2
:]
.
zfill
(
8
))
# print(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[76:77])
# print(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[76:77])
# print("start")
# print("start")
# information_array[i,1] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[94:96]) - \
# information_array[i,1] = intarray_to_uint32(repopulate_array_with_bitstring(uint16_array_to_bitstring(image_array[0]))[94:96]) - \
...
@@ -91,38 +92,38 @@ for i in range(1,3000):
...
@@ -91,38 +92,38 @@ for i in range(1,3000):
# print("middle")
# print("middle")
mask
=
information_array
[:,
0
]
>
0
#
mask = information_array[:,0] > 0
information_df
=
pd
.
DataFrame
(
information_array
[
mask
],
columns
=
[
"Frame_Spacing"
,
"Last_MSE"
,
"ImageName"
,
"Signal_to_Noise"
,
"MSE"
])
#
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.to_csv("smaller_information_weird_array.csv")
information_df
=
pd
.
read_csv
(
"smaller_information_weird_array.csv"
,
index_col
=
0
)
#
information_df = pd.read_csv("smaller_information_weird_array.csv",index_col=0)
information_array
=
information_df
.
values
#
information_array = information_df.values
print
(
information_array
[
0
,
2
])
#
print(information_array[0,2])
plt
.
scatter
(
information_array
[:,
0
],
information_array
[:,
-
1
],
s
=
1
)
#
plt.scatter(information_array[:,0],information_array[:,-1],s=1)
plt
.
legend
()
#
plt.legend()
plt
.
xlabel
(
"Frame_Spacing"
)
#
plt.xlabel("Frame_Spacing")
plt
.
ylabel
(
"Signal_to_Noise"
)
#
plt.ylabel("Signal_to_Noise")
plt
.
show
()
#
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"
]
#
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
#
secondmask = information_array[:,1] < 30000
print
(
np
.
unique
(
information_array
[:,
2
]))
#
print(np.unique(information_array[:,2]))
for
g
in
np
.
unique
(
information_array
[:,
2
]):
#
for g in np.unique(information_array[:,2]):
i
=
np
.
where
(
information_array
[:,
2
]
==
g
)
#
i = np.where(information_array[:,2] == g)
print
(
g
)
#
print(g)
plt
.
scatter
(
information_array
[:,
1
][
secondmask
][
i
],
information_array
[:,
4
][
secondmask
][
i
],
s
=
1
,
label
=
g
,
color
=
colors
[
int
(
g
)])
#
plt.scatter(information_array[:,1][secondmask][i],information_array[:,4][secondmask][i],s=1,label=g,color = colors[int(g)])
plt
.
legend
()
#
plt.legend()
plt
.
xlabel
(
"Frame_Spacing"
)
#
plt.xlabel("Frame_Spacing")
plt
.
ylabel
(
"Signal_to_Noise"
)
#
plt.ylabel("Signal_to_Noise")
plt
.
show
()
#
plt.show()
# print(np.max(information_array[:,0]))
#
#
print(np.max(information_array[:,0]))
# print(information_array[-5:-1,0])
#
#
print(information_array[-5:-1,0])
X
=
sm
.
add_constant
(
information_df
.
drop
([
"Signal_to_Noise"
],
axis
=
1
))
#
X = sm.add_constant(information_df.drop(["Signal_to_Noise"],axis=1))
y
=
information_df
[
"Signal_to_Noise"
]
#
y = information_df["Signal_to_Noise"]
end_result
=
sm
.
OLS
(
y
,
X
)
.
fit
()
#
end_result = sm.OLS(y,X).fit()
print
(
end_result
.
summary
())
#
print(end_result.summary())
sftp_client
.
close
()
sftp_client
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment