Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beast with Octave 8.2 #11

Open
mariolino007 opened this issue Jul 6, 2023 · 9 comments
Open

Beast with Octave 8.2 #11

mariolino007 opened this issue Jul 6, 2023 · 9 comments

Comments

@mariolino007
Copy link

Hello, I would like to try your software with Windows 11 x64 + Octave 8.2, it doesn't work, does it need to be recompiled ? Can you make a script for recompilation ?

thanks

Mario Rossi

@zhaokg
Copy link
Owner

zhaokg commented Jul 7, 2023

Like said in my email, yes, it needs recompilation. I got the mex file compiled for Octave, but the matlab script (.m files) needs some changes too because matlab and octave treat strings slightly differently.

@zhaokg
Copy link
Owner

zhaokg commented Jul 7, 2023

Done! I added the octave-specific mex file ( Rbeast.mex under the matlab folder). I did some quick tests on my side and at least it is workable, thought there could be some unforeseen bugs given the imperfect compabibility between Octave and Matlab. In the command line of Octave, install using the following command:

beastPath = 'C:\beast\'  
eval( webread('http://b.link/rbeast') )  

Please do let me know if it is working appropriately on your end.

@mariolino007
Copy link
Author

thanks for the implentation, it seems to me that the calculation works correctly, the plotbeast(o) command in the various examples instead goes into error :

plotbeast(o)
error: mx_el_eq: nonconformant arguments (op1 is 1x37, op2 is 1x2)
error: called from
plotbeast at line 80 column 10

thanks

PS could you also post the ".m" file for self compilation in octave ?

@zhaokg
Copy link
Owner

zhaokg commented Jul 10, 2023

My best guess is that you just downloaded Rbeast.mex but kept the old plotbeast.m file, which would give you the error at line 80. For the octave version, I not just recompiled the mex file but also changed the plotbeast. m file (agian, because Matlab and Octave are not completely compatible when coming to string processing).. Please re-install the program and download all the files using "eval( webread('http://b.link/rbeast') ) ".

Below is what I did for getting the Rbeast.mex. I didn't use the mkoctfile or mex command because I couldn't figure out how to provide multiple files as inputs. Instead, I directly used the following command lines in a cmd console, assusming that you have all the source files (.c and .h) downloaded from the Source github folder to a local folder F:/src/.

gcc -c -fPIC  -pthread -O2 -DM_RELEASE -DO_INTERFACE -I"C:\Program Files\GNU Octave\Octave-8.2.0\mingw64\include\octave-8.2.0\octave"     f:/src/*.c 

g++  -pthread -fopenmp -g -O2  -o Rbeast.mex *.o  -shared -LC:\PROGRA~1\GNUOCT~1\OCTAVE~1.0\mingw64\lib\octave\8.2.0   -loctinterp -loctave    -Wl,--export-all-symbols    -lkernel32 -lgdi32 -luser32   

@mariolino007
Copy link
Author

the plot works you are right !!! Thanks
With the compliaction I have a problem from the command line....

C:\Program Files\GNU Octave\Octave-8.2.0_large\mingw64\bin>gcc -c -fPIC -pthread -O2 -DM_RELEASE -DO_INTERFACE -I "C:\Program Files\GNU Octave\Octave-8.2.0_large\mingw64\include\octave-8.2.0_large\ingw64\bin>gcc -c -fPIC -pthread -O2 -DM_RELEASE -DO_INTERFACE -I "C:\Program Files\GNU Octave\Octave-8.2.0_large\mingw64\include\octave-8.2.0_large\ingw64\bin>" P:/rbeast/Rbeast-master/Source/*.c

cc1.exe: fatal error: P:/rbeast/Rbeast-master/Source/*.c: Invalid argument
compilation terminated.

In octave I generally saw using a file like "compile_rbest_octave.m" that used commands like:

mex [options] file ...

https://docs.octave.org/v4.2.0/Getting-Started-with-Mex_002dFiles.html

thanks

@zhaokg
Copy link
Owner

zhaokg commented Jul 13, 2023

Yes, I had the same problem when using Octave's default gcc. THat is Octave's own gcc. Seems like that it does't support a wildcard ".c". LIke I said last time, the "mkoctfile " or "mex" (the two are the same) does't accept ".c", either. But I managed to find a solution ("https://stackoverflow.com/questions/76672265/in-octave-how-to-compile-a-mex-file-from-multiple-c-c-source-files").

Now the file "rbeast_mex_compile.m" should be working for Octave in Windows, at least for the several machines I tested.

Thanks a lot.

@mariolino007
Copy link
Author

thanks, I used "rbeast_mex_compile.m" it generated a mex file of very different size than your repository, as soon as octave calls it for any example octave crashes. Patience I use your mex file which works very well.
I ask you again for help attached there is a link to a wetrasnsfer inside there is a dataset dataset_time(sec)_vs_value_at_time.mat
I would like to analyze it with your program, it is absolutely irregular and unseasonal, the first column represents the time in seconds, the second column represents the value at that exact time. Now I would like to find all the "coordinates" of all the significant changes in the data somewhat like in the attached jpg.
thank you for your attention

https://we.tl/t-Qop4YAUhB5

@mariolino007
Copy link
Author

mariolino007 commented Aug 3, 2023 via email

@zhaokg
Copy link
Owner

zhaokg commented Aug 19, 2023

Dear mariolino007:

Thanks for the follow-up question. Sorry for not responding earlier because I have been out of town and was not on top of my emails/messages. Below is a quick test on your sample dataset:

load('_dataset_time(sec)_vs_value_at_time.mat')
t=mat(:,1)
y=mat(:,2)
plot(t,y);

o = beast_irreg(y, 'time',t,'season','none', 'tseg.min;',20, 'tcp.minmax',[0,20]);
plotbeast(o)

The most important two parameters are (1) tseg.min, which specifies the minium segment length in the unit of data points (tseg.min=20 means that two neigboring changepointa are separated apart by at least 20 data points), and (2) tcp.minmax, the min and max number of changepoints allowed to segment the 1D signal. You can try to pick up the best values of these parameters via trials-and-errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants