Skip to content
GitLab
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
11f940f3
Commit
11f940f3
authored
Oct 26, 2017
by
Daniel Scheffler
Browse files
minor improvements.
Former-commit-id:
3728956d
Former-commit-id:
cd3c924c
parent
815bcd04
Changes
1
Hide whitespace changes
Inline
Side-by-side
gms_preprocessing/algorithms/L2B_P.py
View file @
11f940f3
...
...
@@ -11,6 +11,7 @@ import scipy as sp
import
matplotlib.pyplot
as
plt
from
sklearn.cluster
import
KMeans
from
pandas
import
DataFrame
from
typing
import
Union
# noqa F401 # flake8 issue
from
sklearn.cluster
import
k_means_
# noqa F401 # flake8 issue
from
geoarray
import
GeoArray
# noqa F401 # flake8 issue
...
...
@@ -33,7 +34,7 @@ class L2B_object(L2A_object):
self
.
proc_level
=
'L2B'
def
spectral_homogenization
(
self
,
subset
=
None
,
kind
=
'linear'
):
def
spectral_homogenization
(
self
,
kind
=
'linear'
):
src_cwls
=
self
.
meta_odict
[
'wavelength'
]
# FIXME exclude or include thermal bands; respect sorted CWLs in context of LayerBandsAssignment
tgt_cwls
=
CFG
.
usecase
.
target_CWL
...
...
@@ -57,7 +58,7 @@ class L2B_object(L2A_object):
@
staticmethod
def
interpolate_cube_linear
(
arrcube
,
source_CWLs
,
target_CWLs
):
# type: (np.ndarray,list,list) -> np.ndarray
# type: (
Union[
np.ndarray,
GeoArray],
list,
list) -> np.ndarray
assert
arrcube
is
not
None
,
\
'L2B_obj.interpolate_cube_linear expects a numpy array as input. Got %s.'
%
type
(
arrcube
)
orig_CWLs
,
target_CWLs
=
np
.
array
(
source_CWLs
),
np
.
array
(
target_CWLs
)
...
...
@@ -72,7 +73,7 @@ class SpectralResampler(object):
def
__init__
(
self
,
wvl_src
,
srf_tgt
,
wvl_unit
=
'nanometers'
,
logger
=
None
):
# type: (np.ndarray, SRF, str) -> None
"""Get an instance of the SpectralResampler
1D
class.
"""Get an instance of the SpectralResampler class.
:param wvl_src: center wavelength positions of the source spectrum
:param srf_tgt: spectral response of the target instrument as an instance of io.Input_reader.SRF.
...
...
@@ -261,7 +262,7 @@ class KMeansRSImage(object):
"""
plt
.
figure
(
figsize
=
figsize
)
rows
,
cols
=
self
.
im_clust
.
shape
[:
2
]
plt
.
imshow
(
self
.
im_clust
,
plt
.
cm
.
prism
,
interpolation
=
'none'
,
extent
=
(
0
,
cols
,
rows
,
0
))
plt
.
imshow
(
self
.
im_clust
,
plt
.
get_cmap
(
'
prism
'
)
,
interpolation
=
'none'
,
extent
=
(
0
,
cols
,
rows
,
0
))
plt
.
show
()
def
get_random_spectra_from_each_cluster
(
self
,
samplesize
=
50
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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