Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
geomultisens
gms_preprocessing
Commits
0bf1b8ce
Commit
0bf1b8ce
authored
Dec 08, 2017
by
Daniel Scheffler
Browse files
Fixed SRF class.
Former-commit-id:
a8c36936
parent
c11bf1d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
gms_preprocessing/algorithms/L2B_P.py
View file @
0bf1b8ce
...
...
@@ -714,6 +714,7 @@ class ReferenceCube_Generator(object):
self
.
logger
.
info
(
'Computing %s KMeans clusters from the input image %s...'
%
(
self
.
n_clusters
,
im2clust
.
basename
))
kmeans
=
KMeansRSImage
(
im2clust
,
n_clusters
=
self
.
n_clusters
,
CPUs
=
self
.
CPUs
,
v
=
self
.
v
)
kmeans
.
compute_clusters
()
if
self
.
v
:
kmeans
.
plot_cluster_centers
()
...
...
@@ -831,7 +832,7 @@ class RefCube(object):
def
add_spectra
(
self
,
spectra
,
src_imname
):
# type: (np.ndarray, str) -> None
"""
"""
Add a set of spectral signatures to the reference cube.
:param spectra: 2D numpy array with rows: spectral samples / columns: spectral information (bands)
:param src_imname: image basename of the source hyperspectral image
...
...
gms_preprocessing/io/input_reader.py
View file @
0bf1b8ce
...
...
@@ -236,6 +236,7 @@ class SRF(object):
return
self
.
from_dict
(
srf_dict
)
def
from_dict
(
self
,
srf_dict
):
# type: (collections.OrderedDict) -> SRF
"""Create an instance of SRF from a dictionary.
:param srf_dict: {'key_LayerBandsAssignment': <2D array: cols=[wvl,resp],rows=samples>}
...
...
@@ -249,8 +250,11 @@ class SRF(object):
wvl
=
np
.
arange
(
all_wvls
.
min
(),
all_wvls
.
max
()
+
self
.
specres_nm
,
self
.
specres_nm
).
astype
(
np
.
int16
)
df
=
DataFrame
(
index
=
wvl
)
for
band
in
srf_dict
:
bandnames
=
[]
for
band
in
srf_dict
:
# = OrderedDict -> order follows LayerBandsAssignment
bandname
=
band
if
not
self
.
format_bandnames
else
(
'B%s'
%
band
if
len
(
band
)
==
2
else
'B0%s'
%
band
)
bandnames
.
append
(
bandname
)
srfs
=
srf_dict
[
band
][:,
1
]
wvls
=
np
.
array
(
srf_dict
[
band
][:,
0
]
*
scale_factor
)
...
...
@@ -275,7 +279,7 @@ class SRF(object):
self
.
srfs
[
bN
]
=
srf
/
np
.
trapz
(
x
=
wvl
,
y
=
srf
)
# TODO seems like we NEED nanometers here; BUT WHY??
self
.
srfs_wvl
=
np
.
array
(
wvl
)
self
.
bands
=
list
(
srf_dict
.
keys
())
# = OrderedDict -> order follows LayerBandsAssignment
self
.
bands
=
bandnames
# FIXME this is not the GMS algorithm to calculate center wavelengths
# calculate center wavelengths
...
...
Daniel Scheffler
@danschef
mentioned in commit
2d939083
·
Mar 31, 2020
mentioned in commit
2d939083
mentioned in commit 2d939083ec6a2063c0dae89f30d0180adf62fa38
Toggle commit list
Write
Preview
Supports
Markdown
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