Add some descriptor scripts for enrichment tests
This commit is contained in:
parent
2370a79b21
commit
eb6a39896c
34
Descriptors/dfc_base.py
Normal file
34
Descriptors/dfc_base.py
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file dfc_base.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 27 août 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
import ld2dap
|
||||
|
||||
def run(rasters, treshold=1e4):
|
||||
# Parse parameters type
|
||||
treshold = float(treshold)
|
||||
|
||||
# Pipelines
|
||||
loader = ld2dap.LoadTIFF(rasters)
|
||||
dfc_filter = ld2dap.Treshold(treshold)
|
||||
dfc_filter.input = loader
|
||||
out_vectors = ld2dap.RawOutput()
|
||||
out_vectors.input = dfc_filter
|
||||
|
||||
# Compute vectors
|
||||
out_vectors.run()
|
||||
|
||||
return out_vectors.data
|
||||
|
||||
def version():
|
||||
return 'v0.0'
|
41
Descriptors/dfc_daps.py
Normal file
41
Descriptors/dfc_daps.py
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file dfc_daps.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 27 août 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
import ld2dap
|
||||
|
||||
def run(rasters, treshold=1e4, areas=None, sd=None, moi=None):
|
||||
# Parse parameters type
|
||||
treshold = float(treshold)
|
||||
areas = None if areas is None else np.array(areas).astype(np.float).astype(np.int)
|
||||
sd = None if sd is None else np.array(sd).astype(np.float)
|
||||
moi = None if moi is None else np.array(moi).astype(np.float)
|
||||
|
||||
# Pipelines
|
||||
loader = ld2dap.LoadTIFF(rasters)
|
||||
dfc_filter = ld2dap.Treshold(treshold)
|
||||
dfc_filter.input = loader
|
||||
aps = ld2dap.AttributeProfiles(area=areas, sd=sd, moi=moi)
|
||||
aps.input = dfc_filter
|
||||
differential = ld2dap.Differential()
|
||||
differential.input = aps
|
||||
out_vectors = ld2dap.RawOutput()
|
||||
out_vectors.input = differential
|
||||
|
||||
# Compute vectors
|
||||
out_vectors.run()
|
||||
|
||||
return out_vectors.data
|
||||
|
||||
def version():
|
||||
return 'v0.0'
|
41
Descriptors/dfc_dsdaps.py
Normal file
41
Descriptors/dfc_dsdaps.py
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file dfc_dsdaps.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 28 août 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
import ld2dap
|
||||
|
||||
def run(rasters, treshold=1e4, areas=None, sd=None, moi=None):
|
||||
# Parse parameters type
|
||||
treshold = float(treshold)
|
||||
areas = None if areas is None else np.array(areas).astype(np.float).astype(np.int)
|
||||
sd = None if sd is None else np.array(sd).astype(np.float)
|
||||
moi = None if moi is None else np.array(moi).astype(np.float)
|
||||
|
||||
# Pipelines
|
||||
loader = ld2dap.LoadTIFF(rasters)
|
||||
dfc_filter = ld2dap.Treshold(treshold)
|
||||
dfc_filter.input = loader
|
||||
sdaps = ld2dap.SelfDualAttributeProfiles(area=areas, sd=sd, moi=moi)
|
||||
sdaps.input = dfc_filter
|
||||
differential = ld2dap.Differential()
|
||||
differential.input = sdaps
|
||||
out_vectors = ld2dap.RawOutput()
|
||||
out_vectors.input = differential
|
||||
|
||||
# Compute vectors
|
||||
out_vectors.run()
|
||||
|
||||
return out_vectors.data
|
||||
|
||||
def version():
|
||||
return 'v0.0'
|
57
Descriptors/dfc_lfaps.py
Normal file
57
Descriptors/dfc_lfaps.py
Normal file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file dfc_lfaps.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 27 août 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
import ld2dap
|
||||
|
||||
# TODO: Add param percentile?
|
||||
|
||||
dispatcher = {
|
||||
'mean': np.mean, # Arithmetic mean
|
||||
'median': np.median, # Median
|
||||
'average': np.average, # Weighted average (=mean ?)
|
||||
'std': np.std, # Standard deviation
|
||||
'var': np.var, # Variance
|
||||
'amax': np.amax, # Maximum
|
||||
'amin': np.amin, # Minimum
|
||||
'ptp': np.ptp, # Range of values (max - min)
|
||||
}
|
||||
|
||||
def run(rasters, treshold=1e4, areas=None, sd=None, moi=None, features=['mean'], patch_size=3):
|
||||
# Parse parameters type
|
||||
treshold = float(treshold)
|
||||
areas = None if areas is None else np.array(areas).astype(np.float).astype(np.int)
|
||||
sd = None if sd is None else np.array(sd).astype(np.float)
|
||||
moi = None if moi is None else np.array(moi).astype(np.float)
|
||||
patch_size = int(patch_size)
|
||||
features = [dispatcher[x] for x in features]
|
||||
|
||||
# Pipelines
|
||||
loader = ld2dap.LoadTIFF(rasters)
|
||||
dfc_filter = ld2dap.Treshold(treshold)
|
||||
dfc_filter.input = loader
|
||||
aps = ld2dap.AttributeProfiles(area=areas, sd=sd, moi=moi)
|
||||
aps.input = dfc_filter
|
||||
local_features = ld2dap.LocalFeatures(features, patch_size)
|
||||
local_features.input = aps
|
||||
out_vectors = ld2dap.RawOutput()
|
||||
out_vectors.input = local_features
|
||||
|
||||
# Compute vectors
|
||||
out_vectors.run()
|
||||
|
||||
return out_vectors.data
|
||||
|
||||
def version():
|
||||
return 'v0.0'
|
||||
|
57
Descriptors/dfc_lfsdaps.py
Normal file
57
Descriptors/dfc_lfsdaps.py
Normal file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file dfc_lfsdaps.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 28 août 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
import ld2dap
|
||||
|
||||
# TODO: Add param percentile?
|
||||
|
||||
dispatcher = {
|
||||
'mean': np.mean, # Arithmetic mean
|
||||
'median': np.median, # Median
|
||||
'average': np.average, # Weighted average (=mean ?)
|
||||
'std': np.std, # Standard deviation
|
||||
'var': np.var, # Variance
|
||||
'amax': np.amax, # Maximum
|
||||
'amin': np.amin, # Minimum
|
||||
'ptp': np.ptp, # Range of values (max - min)
|
||||
}
|
||||
|
||||
def run(rasters, treshold=1e4, areas=None, sd=None, moi=None, features=['mean'], patch_size=3):
|
||||
# Parse parameters type
|
||||
treshold = float(treshold)
|
||||
areas = None if areas is None else np.array(areas).astype(np.float).astype(np.int)
|
||||
sd = None if sd is None else np.array(sd).astype(np.float)
|
||||
moi = None if moi is None else np.array(moi).astype(np.float)
|
||||
patch_size = int(patch_size)
|
||||
features = [dispatcher[x] for x in features]
|
||||
|
||||
# Pipelines
|
||||
loader = ld2dap.LoadTIFF(rasters)
|
||||
dfc_filter = ld2dap.Treshold(treshold)
|
||||
dfc_filter.input = loader
|
||||
sdaps = ld2dap.SelfDualAttributeProfiles(area=areas, sd=sd, moi=moi)
|
||||
sdaps.input = dfc_filter
|
||||
local_features = ld2dap.LocalFeatures(features, patch_size)
|
||||
local_features.input = sdaps
|
||||
out_vectors = ld2dap.RawOutput()
|
||||
out_vectors.input = local_features
|
||||
|
||||
# Compute vectors
|
||||
out_vectors.run()
|
||||
|
||||
return out_vectors.data
|
||||
|
||||
def version():
|
||||
return 'v0.0'
|
||||
|
40
Descriptors/dfc_sdaps.py
Normal file
40
Descriptors/dfc_sdaps.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# \file dfc_sdaps.py
|
||||
# \brief TODO
|
||||
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
||||
# \version 0.1
|
||||
# \date 27 août 2018
|
||||
#
|
||||
# TODO details
|
||||
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
import ld2dap
|
||||
|
||||
def run(rasters, treshold=1e4, areas=None, sd=None, moi=None):
|
||||
# Parse parameters type
|
||||
treshold = float(treshold)
|
||||
areas = None if areas is None else np.array(areas).astype(np.float).astype(np.int)
|
||||
sd = None if sd is None else np.array(sd).astype(np.float)
|
||||
moi = None if moi is None else np.array(moi).astype(np.float)
|
||||
|
||||
# Pipelines
|
||||
loader = ld2dap.LoadTIFF(rasters)
|
||||
dfc_filter = ld2dap.Treshold(treshold)
|
||||
dfc_filter.input = loader
|
||||
sdaps = ld2dap.SelfDualAttributeProfiles(area=areas, sd=sd, moi=moi)
|
||||
sdaps.input = dfc_filter
|
||||
out_vectors = ld2dap.RawOutput()
|
||||
out_vectors.input = sdaps
|
||||
|
||||
# Compute vectors
|
||||
out_vectors.run()
|
||||
|
||||
return out_vectors.data
|
||||
|
||||
def version():
|
||||
return 'v0.0'
|
||||
|
Loading…
Reference in New Issue
Block a user