Installation of Rainflow algorithm for Octave - octave

I woud like to ask you a question regarding of installation of Rainflow package from this site: https://github.com/AmritaLonkar/rainflow-octave
I should be this https://de.mathworks.com/matlabcentral/fileexchange/3026-rainflow-counting-algorithm modified Matlab package for Octave, but it does not work.
Installation is written here, but I am not able to do so. I am NOT a programmer, so I would like to ask you for help and detailed procedure of installation.
Compilation and installation for GNU Octave
Do the following to create a compiled mex-file from "rainflow.c" and to test the result:
$ cd ./rainflow-octave$ make$ ls ./src/rainflow.mexrainflow.mex$ make test
Move files: rainflow.mex, rainflow.m and sig2ext.m to a place where GNU Octave can find them.
Octave will locate oct- or mex- files automatically if they are in a directory listed in the search path. To figure out the search path, do:
$ octaveoctave> path Octave's search path contain the following directories:
.
/usr/local/share/octave/site-m
Please do not hesitate to ask more questions if needed.
Best regards
Michal
My system
OS: e.g. **Windows 10
Octave version: e.g. Version 6.1.0
Installation method: e.g. Downloaded" from https://github.com/AmritaLonkar/rainflow-octave

I was able to build and run the rainflow package just using Octave 6.2.0 on my Windows 10 system.
Octave is capable of performing some compilation internally in order to build packages. I have no idea how to use the rainflow tool once built, but the following process worked to create it:
download the rainflow source tree and unzip it to it's own folder. This is normally the purpose of the git program mentioned above. It downloads and manages source code. Instead, manually download the source code.
Start from the rainflow page
click the Green button that says Code
click Download ZIP, save the file in a folder named rainflow where you'll be able to find it again. I used C:\Octave\rainflow\.
Now open Octave. You can use the pkg tool to build an installable package from the downloaded source code and then install it. This package is simple enough that the Octave-Windows environment is sufficient to perform the build:
in Octave, use either the cd command or the folder tree in the upper left of Octave to navigate to the folder where you saved rainflow. In my case, using the cd command I would type cd c:\octave\rainflow\. Yours might be different.
the only file in that folder should be rainflow-octave-master.zip
now, use the pkg tool to compile the package using the command pkg build . rainflow-octave-master.zip (the . means it will save the package in the current folder.)
When it finishes there should now be a second file in that folder named rainflow-1.0.2-x86_64-w64-mingw32-api-v55.tar.gz
install the package using the command pkg install rainflow-1.0.2-x86_64-w64-mingw32-api-v55.tar.gz (It will give some warnings about documentation, but the package should still install.)
verify installation by listing installed packages using the command pkg list. you should see rainflow in the list of packages. if not, try pkg rebuild then another pkg list. In my case, I see partway down the list:
rainflow | 1.0.2 | C:\Users\USERNAME\octave\rainflow-1.0.2
You can now use the package by first loading it using the command pkg load rainflow.
Testing it out a bit:
octave:76> rainflow
error: rainflow: RAINFLOW requires at least one input argument.
octave:77> rainflow(1)
ans = [](3x0)
octave:78> A = magic(3)
A =
8 1 6
3 5 7
4 9 2
octave:79> rainflow(A)
ans =
0.5000 2.0000 0.5000 0.5000 3.5000
3.5000 3.0000 8.5000 6.5000 5.5000
1.0000 1.0000 0.5000 1.0000 0.5000
The only issue I see is that afterward help rainflow does not show the help from rainflow.m, I suspect it should be included in the rainflow.c file. maybe this has to do with a change in octave since rainflow was created? if you want to read the help, you need to navigate to the package installation location or the location of the source files you unzipped and type help rainflow, at which point it will show:
octave:49> help rainflow
'rainflow' is a script from the file C:\octave\rainflow\src\rainflow.m
RAINFLOW cycle counting.
RAINFLOW counting function allows you to extract
cycle from random loading.
SYNTAX
rf = RAINFLOW(ext)
rf = RAINFLOW(ext, dt)
rf = RAINFLOW(ext, extt)
OUTPUT
rf - rainflow cycles: matrix 3xn or 5xn dependend on input,
rf(1,:) Cycles amplitude,
rf(2,:) Cycles mean value,
rf(3,:) Number of cycles (0.5 or 1.0),
rf(4,:) Begining time (when input includes dt or extt data),
rf(5,:) Cycle period (when input includes dt or extt data),
INPUT
ext - signal points, vector nx1, ONLY TURNING POINTS!,
dt - sampling time, positive number, when the turning points
spaced equally,
extt - signal time, vector nx1, exact time of occurrence of turning points.
See also SIG2EXT, RFHIST, RFMATRIX, RFPDF3D.
those other functions appear to be included as well and the help works, so you can try help sig2ext, help rfhist, help rfmatrix, and help rfpdf3d. I have not tested to see if they all actually work. But this will get the package up and running for you to start using. Good luck!

This worked for me. I'm on linux, but process should be the same on windows.
mkdir TempFolder
cd TempFolder
git clone https://github.com/AmritaLonkar/rainflow-octave.git
cd rainflow-octave
make # for some reason this places the .tar.gz package in the PARENT folder
cd .. # so let's go there
octave # and let's start octave from this directory
now from inside octave:
pkg prefix /path/where/you/want/the/package/to/be/installed
pkg install rainflow-octave-1.0.2.tar.gz
pkg load rainflow # to load the package and test it
rfctest # run the test to ensure it works

Related

FPC IDE: Can't find unit system

I just installed FPC 3.2.0 (on Linux Mint 19.3) and trying to use FPC IDE. I launched the IDE from the bin installation subfolder as ./fp, written a simplest program in IDE
program hello;
begin
writeln('hello');
end.
saved the program as hello.pas and when I compile it I get
(3,1) Fatal: Can't find unit system used by hello
(0) Fatal: Compilation aborted
This is strange because system is the compiler's unit, not a user's unit.
I tried to google the issue, found several posts in different forums, one question was dated back to 2007 year, and none of the questions was answered.
Is where a way to solve the issue or FPC IDE is dead for about 15 years?
Check the unit directories in options->directories -> unit directories.
The package configuration should have put a line like
/usr/lib/fpc/$FPCVERSION/units/$FPCTARGET/*
The dollar values are builtins (respectively 3.2.0 and i386-linux or x86_64-linux). Please verify that the directories with prebuilt .ppu .o are there.
Try to fix your installation of FPC or you can fix it manually by calling fpcmkcfg
fpcmkcfg -d "basepath=path/to/fpc/3.3" -o path/to/fpc.cfg
For instance, if the compiler is in /usr/local/bin, it will look in
/usr/local/etc.
Had the same problem on Ubuntu 20.04. To solve it, I had to create the file fp.cfg in my project's folder with the following content:
-Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget/*
If this will not work, it means unit path on your system is different. You may use something like
dpkg -L fp-units-base-3.0.4 | grep .ppu
to find out where units are actually stored. Replace 3.0.4 with your actual Free Pascal version. If you do not know exact version, use
sudo apt install apt-show-versions
apt-show-versions fpc
It will show something like
fpc:all/focal 3.0.4+dfsg-23 uptodate
3.0.4 is the version number you need.
Another way of getting needed paths is running this command:
cat /etc/fpc.cfg | grep -- -Fu | head -2
So you may just run
cat /etc/fpc.cfg | grep -- -Fu | head -2 > fp.cfg
in your project's folder to have the problem solved.
How to use Free Pascal (Lazarus) on Linux - no install solution:
If not already installed, install "GNU binutils" (sudo apt-get install binutils)
Dowload the latest version of Free Pascal (Lazarus): from the Downloads section of the Lazarus Home page (Lazarus is a professional open-source cross platform IDE powered by Free Pascal):
2.1. In case of a Debian based Linux system (such as Ubuntu): the .deb package could be downloaded ("fpc-laz_<version> ... .deb" (replace <version> with an actual version number))
2.2. In case of a RPM based Linux system (such as Fedora): the .rpm package could be downloaded ("fpc-<version> ... .rpm" (replace <version> with an actual version number))
Extract the downloaded package:
3.1. Place the downloaded .deb / .rpm package in the folder where you are going to extract it
3.2. Extract the downloaded .deb / .rpm package by Right-Click-ing it and then choosing Extract Here
3.3. Rename the extracted folder, as you desire, for example "fpc"; Further we denote this folder as "<BASEFOLDER>" and its path as - "<BASEFOLDER_PATH>"
In the case of a .deb package: Open the extracted <BASEFOLDER> and then, extract "data.tar.xz" - by Right-Click-ing it and then choosing Extract Here
Launch the Free Pascal window by typing the next command in the terminal - this command may vary according to the terminal used - replace <terminal> with the terminal used (by default: for Gnome based Desktop Environments -> gnome-terminal; for KDE based Desktop Environments -> konsole; for Xfce based Desktop Environments -> xfce4-terminal; for the MATE Desktop Environment -> mate-terminal; ...):
<terminal> -e '<BASEFOLDER_PATH>/usr/bin/fp'
OR:
<terminal> -- '<BASEFOLDER_PATH>/usr/bin/fp'
To add the units folders: From the Free Pascal Menu, access: Options -> Directories -> and copy (CTRL + C to Copy from outside the IDE, and (FN + )SHIFT + Insert to Paste inside the IDE) to the "Units" tab, the next three lines, each on a new line (replace <BASEFOLDER_PATH> with its corresponding value, and replace <LIB_FOLDER> with: lib in case of a .deb package or lib64 in case of a .rpm package):
<BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget
<BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget\*
<BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget\rtl
Please note that by moving the files from the <BASEFOLDER> directory to other <BASEFOLDER_PATH>, you'll have to update the above three lines so that they contain the new <BASEFOLDER_PATH>, otherwise you might get errors like:
"Fatal: Can't find unit ..."
For navigation inside the IDE using keyboard - the following shortcuts can be used: Alt + Highlighted-letter, Highlighted-letter(s), Tab / Shift + Tab, Arrows, Enter, Esc
For Official Online Documentation see:
Online Documentation

TCL_LIB_SPEC missing in modules install

I'm trying to install modules from SourceForge and I'm getting an error that a variable named TCL_LIB_SPEC is not set. What is this supposed to be set to?
The answer here is to install the TCL development package
% yum install tcl-devel
This gives you a tclConfig.sh file at /usr/lib64/tcl8.5
So
% cd /usr/lib64/tcl8.5
% . ./tclConfig.sh
Then configure works.
It's supposed to be set to the instructions to use with your compiler for linking against the Tcl C library, and it should (conventionally) be generated by running the relevant configure script inside a Tcl source distribution. Or a distribution of Tcl (e.g., on Linux perhaps called tcl-dev) may have alternate correct values already set up.

How do I make Octave see installed Shogun libraries in Ubuntu 16.04?

I copied the commands (from these instructions: http://www.shogun-toolbox.org/install#ubuntu) into the terminal and they seem to have worked, but there is no documentation on how to make Octave find the libraries. I have tried modshogun and init_shogun but Octave cannot find them. I do have the libraries in usr/lib, and I have put that directory on PATH. I have even set usr/lib as my working directory in Octave and that did not help. As far as I have found, there is no Shogun documentation on what to do at this point.
I have also tried compiling Shogun from source, but configure couldn't find GCC. Apparently, this is a known problem with newer versions of GCC. I decided to ask for help with the former method because at least I have the libraries with that.
Edit: I am following the instructions here http://www.shogun-toolbox.org/install#manual-basics
When i do cd build and then "cmake -DINTERFACE_OCTAVE=ON" it tells me there is no cmakelists.txt. There is one in in the above folder, but when I go to that directory and do "cmake -DINTERFACE_OCTAVE=ON" again, it tells me "Shogun can only be built with GPL codes if the source files are in /home/derose/shogun/src/shogun/src/gpl. Please download or disable with LICENSE_GPL_SHOGUN=OFF."
However, when I add -LICENSE_GPL_SHOGUN=OFF as an option, i get the error "CMake Error: The source directory "/home/derose/shogun/src/shogun/-LICENSE_GPL_SHOGUN=OFF" does not exist."
You've linked to the Ubuntu install instructions. From there
These currently do contain the C++ library and Python bindings..
No word that this would include the GNU Octave binding. See below on the same page:
The native C++ interface is always included. The cmake options for building interfaces are -DINTERFACE_PYTHON=ON -DINTERFACE_R .. etc. For example, replace the cmake step above by cmake -DINTERFACE_PYTHON=ON...
So you have to grab the source and fire up cmake with something like -DINTERFACE_OCTAVE=ON
Steps to build the bleeding edge of shogun (the github repo) and the Octave interface:
git clone https://github.com/shogun-toolbox/shogun && cd shogun
git submodule update --init
mkdir build && cd build
cmake .. -DINTERFACE_OCTAVE=ON
make -j4

`mcu8051ide` on Linux mint 19 not working or opening

mcu8051ide on Linux mint 19 not working or opening, all dependencies are installed but when I check libraries, itcl is not present is the error.
I am confused what to do?
I installed Linux mint 19 in a virtual machine to check out what's going on.
The Itcl 3.4 pkgIndex.tcl file has the following contents:
# Tcl package index file, version 1.0
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded Itcl 3.4 [list load [file join /usr lib x86_64-linux-gnu "libitcl3.4.so.1"] Itcl]
This means that Itcl will only be available with Tcl 8.6. However, mcu8051ide specifically starts tclsh8.5. That's the reason it can't find Itcl.
The mcu8051ide command is a very short shell script that only starts tclsh8.5 and passes /usr/share/mcu8051ide/lib/main.tcl as the script to run. If instead you run that script with tclsh (which is a symbolic link that points to tclsh8.6), it seems to work at first glance.
So, you can either modify the original startup script, or put a modified copy in your own bin directory.
go to /usr/local/share/mcu8051ide/lib
(or to /usr/share/mcu8051ide/lib depending on config during cmake)
and then edit the main.tcl file
using sudo nano main.tcl
On the 51st line,
change the value for MIN_TCL_VER from 8.5 to 8.6.

adding RMySQL package to R fails (on Windows)?

I can't figure out why my RMySQL package won't install - here's what I get:
> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb
* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'
The downloaded packages are in '(foo)'
Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had non-zero exit status
I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:
> Sys.getenv('MYSQL_HOME')
MYSQL_HOME "C:/PROGRA~1/MySQL/MYSQLS~1.1/"
> readRegistry("SOFTWARE\\MySQL AB", hive="HLM", maxdepth=2)
$`MySQL Server 5.1`
$`MySQL Server 5.1`$DataLocation
[1] "C:\\Documents and Settings\\All Users\\Application Data\\MySQL\\MySQL Server 5.1\\"
$`MySQL Server 5.1`$FoundExistingDataDir
[1] "0"
$`MySQL Server 5.1`$Location
[1] "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"
$`MySQL Server 5.1`$Version
[1] "5.1.54"
Puzzled. Any help would be greatly appreciated!
The basic process is described here, but there are several hints, So I will describe the whole solution (please change the R version and paths if needed):
Install latest RTools from here
install MySQL or header and library files of mysql
create or edit file C:\Program Files\R\R-2.12.1\etc\Renviron.site and add line like MYSQL_HOME=C:/mysql (path to your mysql files)
copy libmysql.lib from mysql/lib to mysql/lib/opt to meet dependencies.
copy libmysql.dll to C:\Program Files\R\R-2.12.1\bin or to windows/system32 directory.
run install.packages('RMySQL',type='source') and wait while compilation will end.
This worked for me on Windows 7 64 bit, so there should be no problems with 32 bit versions
Initialy posted here (similar question).
First I would try following the directions on this page: http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL
Then, ensure that you actually have a MySQL client on your computer, not just the server itself. I've had a problem myself where I had to use an older binary for the client, but you can download these from mysql website.
I created a binary which might work for people:
http://kenahoo.blogspot.com/2011/09/rmysql-binary-for-windows-7.html
I basically followed all these directions, including the ones at the Vanderbilt page, but for one reason or another it doesn't always seem to work. Anyway, hope this might be helpful for people who have the same versions of stuff I used.
I was having this same problem on Windows 7 with R 2.12.1 x64 and resolved it by:
Changing the R directory in my PATH variable to C:\Program Files\R\R-2.12.1\bin\x64 (rather than just ...\R-2.12.1\bin).
Copying ...\MySQL Server 5.5\lib\libmysql.dll to ...\MySQL Server 5.5\bin\.
Running R CMD INSTALL RMySQL_0.7-5.tar.gz in cmd.exe (install.packages('RMySQL',type='source') in R still would not work).
I came across this step-by-step guide to install RMySQL under Windows7 64bit.
http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/
The software I used are:
Windows 8 OS
R3.0.2 - 64bit
Rtools 3.1
MySQL Server Community Edition 5.6 - 64bit
Following the above guide (with screenshots provided), my installation and loading of the RMySQL package works.
Many thanks to Arne Hendrik Schulz!
As Marek said. There is no windows binary for this package. I had similar troubles on my Mac when I tried to install RPostgreSQL (because there's no binary for Mac) in the end I had to compile it on my own and modify several files.
For the MySQL part(if you don't know much about MySQL), you might want to use WAMP which is admittedly more than you need, but easy to install and to start and shut down.
For some compiling help you might be interested in Rtools
HTH
BTW: What kind of windows do you run (sry, if I missed it)
You however there is one additional requirement at present (with the MySQL server version 5.5 & R2.12.1) follow thehttp://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL instructions at present as the locations of the libmySQL.dll differs to what is expected in the package.
i.e. for the 64bit compiling.
it expects the libmySQL.dll to be in "${MYSQL_HOME}"/bin/libmySQL.dll
so simply copy the dll over to the /bin dir and it will now compile.
for the 32bit compilling.
the libmySQL.lib is expected in "${MYSQL_HOME}"/lib/opt/libmysql.lib
again moving this should solve the problem.
Alternatively, if you don't want to or can't move these files. Then you can edit the source code files:
Makevars.win
Makevars.win32
Makevars.win64
appropriately pointing to /lib/libmysql.dll /lib/libmysql.lib
Add MySQL and RTools directory to the PATH!
Here is my PATH ; ~blah~;C:\Program Files\MySQL\MySQL Server 5.5\bin;c:\rtools\bin;C:\Rtools\gcc-4.6.3\bin;
I was working for last 2 days on Installation of R with RMySQL package, finally got the solution for that, here are the steps to install RMySQL package:-
DOWNLOAD SOFTWARE FROM THE FOLLOWING LINKS:
*a. R2.13.2: Download R from http://cran.stat.sfu.ca/index.html
b. RTools 214: Download RTools from http://cran.cict.fr
c. RMySQL 0.8-0.tar.gz: Download RMySQL from
http://biostat.mc.vanderbilt.edu/wiki/main/RMySQL/RMySQL_0.8-0.tar.gz
d. MySQL Server 5.0: download it from http://dev.mysql.com
e. RSTUDIO (optional): download it from http://rstudio.org*
SET THE FOLLOWING ENVIRONMENT VARIABLES
* a. MYSQL_HOME : <drive>/path to MySQL installation folder
e.g. MYSQL_HOME= C:\Program Files\MySQL\MySQL Server 5.5\
b. R_HOME: <drive>/path to R installation
e.g. R_HOME=C:\Program Files\R\R-2.13.2\
c. PATH: Modify path to accommodate the above variables. *
Be sure that the following paths areincluded in your Windows PATH variable:
\Rtools\2.14\bin
\Rtools\2.14\MinGW\bin
\Rtools\2.14\MinGW64\bin
CREATE FOLDER AND COPY FILES
a. OPT: Create a folder OPT under C:\Program Files\MySQL\MySQL Server 5.5\lib and copy
MYSQLLIB.LIB the above path. Also copy libmysql.dll to \\R\R-2.14.0\bin\ (64 bit) Or \\R\R-2.14.0\bin\i386\ (32 bit) and to C:\Windows\System32.
b. Renviron.site: create or edit a file \\R\R-2.14.0\etc\Renviron.site and add a
line: MYSQL_HOME =”C:/Program Files/MySQL/MySQL Server 5.5/”
NB: USE FORWARD SLASH AND DOUBLE QUOTES HERE
c. libMySQL.dll: Copy this file to C:\Program Files\R\R-2.13.2\bin\i386 as well as C:\Program
Files\R\R-2.13.2\bin
RUN COMMANDS
a. Install.Packages: Run R GUI by clicking on the R icon on desktop or from Start menu. Type
INSTALL.PACKAGES(“RMySQL”,type=”Sources”). This will download the required software from repositories.
b. Command Prompt: Copy the downloaded zip file (in step 4.a.) and paste it under R
installation folder. Go to start menu and open Command Prompt. Go to the R installation folder and type R CMD INSTALL RMySQL_0.8-0.tar.gz
*COMMANDS:
>library(RMySQL)
>drv = dbDriver("MySQL")
>con = dbConnect(drv,host="localhost",dbname="test",user="root",pass="root")
>album = dbGetQuery(con,statement="select * from t_master")
>album*
18 months later, new laptop, same problem. Returning to the scene of the crime - sorry January 2011 self; we're in the future, and this installation still isn't any fun.
Lessons learned:
-Updated RTools are essential. Get them.
-Are you seeing an error along the lines of .onLoad failed in loadNamespace() for 'RMySQL', details? This seems to mean that there's a problem with your system environment variables.
In R, run
Sys.getenv('MYSQL_HOME')
If it spits back a path like
[1] "C:\\Program Files\\MySQL\\MySQL Server 5.6"
you're good. But if it gives you empty string, you need to set this.
These are all Windows 7 directions, but the process is pretty similar in XP, if memory serves.
1) Bring up System Properties > Advanced > Environment Variables.
2) In the lower 'System Variables' pane, click 'New'.
3) Variable name is MYSQL_HOME and value is whatever the path is to your MySQL installation - mine was C:\Program Files\MySQL\MySQL Server 5.6
Newer versions of MySQL don't seem to create an environment variable on install - that and the lack of binaries for RMySQL explain why this questions has garnered 8,000 hits.
-Still stuck? Here are two additional in-depth writeups: 1, 2
Following worked for me in red hat linux
wget http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz
sudo R CMD INSTALL --configure-args='--with-mysql-inc=/usr/include/mysql' --configure-args='--with-mysql-lib=/usr/lib64/mysql' RMySQL_0.9-3.tar.gz