Closed VargBurz closed 4 years ago
This PR adds parent Stair class for Jump and Drop models.
Stair
Jump
Drop
Jump and Drop models are almost identical. We need to remove code duplication which presents because Jump algorithm is a reverted Drop algorithm.
StairModel
models/jump_model.py
models/drop_model.py
do_fit
do_detect
filter_detection
get_extremum_type
models/model.py
ModelType
jump
drop
peak
trough
general
ExtremumType
min
max
get_model_type
remove_duplicates_and_sort
list(set(array[]))
_update_fiting_result
_update_fitting_result
utils/common.py
find_drop
find_jump
get_stair_indexes
get_parameters_from_segments
model_type
tests/test_models.py
tests/test_utils.py
what about "ExtremumType"
This PR adds parent
Stair
class forJump
andDrop
models.Motivation:
Jump
andDrop
models are almost identical. We need to remove code duplication which presents becauseJump
algorithm is a revertedDrop
algorithm.Changes:
StairModel
classmodels/jump_model.py
,models/drop_model.py
:Jump
/Drop
classes fromStairModel
classJump
/Drop
methodsdo_fit
,do_detect
,filter_detection
areStairModel
class methods nowget_extremum_type
methodmodels/model.py
:ModelType
enum:jump
,drop
,peak
,trough
,general
ExtremumType
enum:min
ormax
, used to connect models with utils algorithmsget_model_type
method returnsModelType
remove_duplicates_and_sort
utils method instead oflist(set(array[]))
_update_fiting_result
->_update_fitting_result
utils/common.py
:find_drop
andfind_jump
methods toStair
model, rename toget_stair_indexes
remove_duplicates_and_sort
methodget_parameters_from_segments
: remove unusedmodel_type
argtests/test_models.py
: tests forget_stair_indexes
methodtests/test_utils.py
: test forremove_duplicates_and_sort
method