helske / rlibeemd Goto Github PK
View Code? Open in Web Editor NEWEnsemble Empirical Mode Decomposition (EEMD) and Its Complete Variant (CEEMDAN)
Ensemble Empirical Mode Decomposition (EEMD) and Its Complete Variant (CEEMDAN)
I came across an issue with the ceemdan()
function parameter setting num_imfs
. In the documentation, the default values of num_imfs=0
is said to correspond to a
maximal number of IMFs
. However, depending on other parameter settings (e.g. noise_strength
), this is not necessarily the case. A residual with two non-edge extrema, which could be further decomposed, is possible.
Then (for N>3), not num_imfs=emd_num_imfs(N)
(which seems to take floor(log2(N))
as the num_imfs
-value), but the smallest integer which is not less than log2(N), thus, num_imfs=ceiling(log2(N))
, appears to correspond to the maximal number of IMFs (meaning the residual has maximum one non-edge extremum). Whether floor(log2(N))
or ceiling(log2(N))
corresponds to the maximal number of IMFs depends on other parameter settings such as noise_strength
. Maybe the number of non-edge extrema should be checked to decide on either floor(log2(N))
or ceiling(log2(N))
for num_imfs
.
Attached I provide an example. An NDVI (Normalised Difference Vegetation Index) time series of length 340 (example_NDVI.txt). It is decomposed in R using ceemdan()
(ceemdan_issue.txt). When setting a noise_strength=0.3
, the default setting of num_imfs=0
results in a residual with two non-edge extrema.
I hope I am not missing anything/getting wrong and this information is of help. In case it is a bug, an edit would be appreciated.
These are my sessionInfo:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
packageVersion("Rlibeemd")
[1] ‘1.4.0’
Best, Katharina
I am wondering how to calculating and plot the spectrogram using the package of EMD and hht?
@helske Turned out, OpenMP detection does not work, at least in 1.4.3:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Rlibeemd configure 1.4.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = 10.6.shared
uname -m = x86_64
uname -r = 10.8.0
uname -s = Darwin
uname -v = Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64
Kernel configured for up to 8 processors.
8 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 153 tasks, 392 threads, 8 processors
Load average: 3.40, Mach factor: 4.68
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /bin
PATH: /sbin
PATH: /usr/bin
PATH: /usr/sbin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1685: checking for gsl-config
configure:1703: found /opt/local/bin/gsl-config
configure:1715: result: /opt/local/bin/gsl-config
configure:1889: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by Rlibeemd config.status 1.4.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on 10.6.shared
config.status:716: creating src/Makevars
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_GSL_CONFIG=/opt/local/bin/gsl-config
## ----------------- ##
## Output variables. ##
## ----------------- ##
DEFS='-DPACKAGE_NAME=\"Rlibeemd\" -DPACKAGE_TARNAME=\"rlibeemd\" -DPACKAGE_VERSION=\"1.4.2\" -DPACKAGE_STRING=\"Rlibeemd\ 1.4.2\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\"'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
GSL_CFLAGS='-I/opt/local/include'
GSL_CONFIG='/opt/local/bin/gsl-config'
GSL_LIBS='-L/opt/local/lib -lgsl -lgslcblas'
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME='Rlibeemd'
PACKAGE_STRING='Rlibeemd 1.4.2'
PACKAGE_TARNAME='rlibeemd'
PACKAGE_URL=''
PACKAGE_VERSION='1.4.2'
PATH_SEPARATOR=':'
SHELL='/bin/sh'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "Rlibeemd"
#define PACKAGE_TARNAME "rlibeemd"
#define PACKAGE_VERSION "1.4.2"
#define PACKAGE_STRING "Rlibeemd 1.4.2"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 0
Build is fine, but OpenMP is not used, despite being, obviously, supported by GCC.
Makevars
are written like:
GSL_CFLAGS = -I/opt/local/include
GSL_LIBS = -L/opt/local/lib -lgsl -lgslcblas
PKG_LIBS=$(GSL_LIBS) $(SHLIB_OPENMP_CFLAGS)
PKG_CFLAGS=$(GSL_CFLAGS) $(SHLIB_OPENMP_CFLAGS)
And then SHLIB_OPENMP_CFLAGS
are undefined. Should be -fopenmp
there instead for it to work.
I used install.packages("codetools") to install the parallel version to get the error "clang: error: unsupported option '-fopenmp'" LLVM has posted a fix for this at http://blog.llvm.org/2015/05/openmp-support_22.html. It will require making the installation code aware of its environment and acting accordingly.
Here's the command and the following error messages. I know the formatting is a little goofy: R colored its responses red.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib /Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Rlibeemd.so RcppExports.o bemd.o bemdR.o ceemdan.o ceemdanR.o eemdR.o eemd_routine.o emd.o emd_num_imfsR.o error.o extrema.o extremaR.o gslErrorHandlerOff.o printError.o spline.o version.o workspace.o -L/usr/local/lib -lgsl -lgslcblas -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
clang-7: error: no such file or directory: '/Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib'
make: *** [Rlibeemd.so] Error 1
ERROR: compilation failed for package ‘Rlibeemd’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rlibeemd’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rlibeemd’
Error: Failed to install 'Rlibeemd' from GitHub:
(converted from warning) installation of package ‘/var/folders/j1/f2wn1_k51dl2_wgn8m0b5m_00000gn/T//Rtmplmblob/filed2d4c395e77/Rlibeemd_1.4.1.tar.gz’ had non-zero exit status
I don't think this will be difficult, given the short MATLAB source code available at http://bioingenieria.edu.ar/grupos/ldnlys/metorres/metorres_files/ceemdan_v2014.m.
Reference: Colominas MA, Schlotthauer G, Torres ME. "Improve complete ensemble EMD: A suitable tool for biomedical signal processing," Biomedical Signal Processing and Control, vol. 14, pp. 19-29 (2014)
From latest CRAN checks:
src/Makevars.in: SHLIB_OPENMP_CFLAGS is included in PKG_LIBS but linking is by C++
src/Makevars.in: it is not portable to include multiple SHLIB_OPENMP_*' macros in PKG_LIBS
I tried several combinations of CFLAGS
and CXXFLAGS
no luck. At the moment it seems that I have to disable OpenMP with CRAN version and add a startup message which points to github for parallel version...
CRAN recommends installing from GH, but no 1.4.3 here.
https://cran.r-project.org/web/packages/Rlibeemd/index.html
vs
https://github.com/helske/Rlibeemd/tags
devtools::install_github("helske/Rlibeemd")
Downloading GitHub repo helske/Rlibeemd@HEAD
checking for file ‘/tmp/RtmptW0VkH/remotes777d3cfa4949/helske-Rlibeemd-a237af ✔ checking for file ‘/tmp/RtmptW0VkH/remotes777d3cfa4949/helske-Rlibeemd-a237af 1/DESCRIPTION’
─ preparing ‘Rlibeemd’:
✔ checking DESCRIPTION meta-information ...
─ cleaning src
─ running ‘cleanup’
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘Rlibeemd_1.4.1.tar.gz’
Installing package into ‘/home/lasorte/R_Libs’
(as ‘lib’ is unspecified)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.