Plot function not working in Octave - macos

I was trying to use plot(x,y) function of octave but couldn't use it.
Keep getting this error:
warning: function ./test.m shadows a core library function
Fontconfig warning: ignoring UTF-8: not a valid region tag
Tried using setenv("GNUTERM","X11"); before using plot(x,y) function, that didn't work.
Saw some couple of stackoverflow and other solutions (this, this, this and this) but didn't help much.
There wer some site which talks about adding something like this setenv GNUTERM x11to append in .octaverc file, but unfortunately I don't have .octaverc.
ikis-MacBook-Pro:Cellar ikis $ find octave -name ".octaverc"
ikis-MacBook-Pro:Cellar ikis $
Can any one help with this.
OS: Yosemite
Octave version: GNU Octave, version 4.0.0

Related

Installing Perl and PDL

I am currently trying - unsuccessfully to install perl PDL as I would like to automate some of my data analysis and graphics generation.
Unfortunately I seem unable to even install the necessary modules without issue, let alone create a small script to deal with my data files.
I have some rudementary experience with Perl but Nothing fancy and am using Windows 10 x64.
Initially I went for the x64 strawberry perl v5.24 installation, followed by ppm installations of Astro::FITS::Header, Convert::UU, OpenGL and PDL - as instructed here http://pdl.perl.org/?page=install. However, there were issues with the installation of Inline::C and after trying the example listed on page 5 of the PDL_Book_Latest http://sourceforge.net/projects/pdl/files/PDL/2.4.10/PDL-Book-20120205.pdf/download there wasn't any image appearing, nor image file in any location I could think to search. Back to Google and still no luck finding any information on the source of this issue so I decided to go back to square one and use an older version in the hopes that it would be more well documented.
So, uninstallation of strawberry perl through Windows installed programs dialog, deletion of strawberry folder and registry entries containing "strawberry". Then a new installation of perl, with the Padre IDE, v5.14 - maybe some debugging fonctionality will help pinpoint the errors. Started installing the same modules (Astro::FITS::Header, Convert::UU, OpenGL, PGPLOT). Astro and Convert worked fine, but the OpenGL started throwing errors about ExtUtils::F77 which I am apparently missing after a few more hours searching. I go to install this module and it keeps giving errors about 'gfortan' being an unknown command... It was my understanding that the idea of PDL was to avoid fortran and C, and I have found next to no information about this installation problem so far.
So i decided to try an alternative approach. I installed the ppm module from cpan and repeated the initial installation process through the ppm command. This time i get:
"Unknown element 'PROVIDE' found inside SOFTPKG. at C:/Dwimperl/perl/site/lib/PPM.pm line 1462."
So my question is as follows:
Am I missing some critical step in the installation process? Is my system just handing this really badly, and if so is there any sort of possible work around? Is the fact that I tried two different versions liable to create path issues that could be at the root of this problem?
Could anyone provide an alternative and preferably not too complex route to install PDL with a given perl installation on Windows 10?
EDIT 1:
Here is the code for the error I got trying to install Inline::C, an apparent pre-requisite for PDL
code deleted to make space for updates...
EDIT 3:
I reinstalled GnuWin32 in the directory specified by PATH, rather that changing PATH, and the tried the installation again. Inline::C gave the same 'diff' and 'rm' errors. So i ran "cpanm --notest 'package'" to install Inline::C and then PDL, both said they were successful. However, even using '--notest' cpanm could not install OpenGL and PGPLOT.
The final objectif is to be able to produce graphics using the fonctions from PGPLOT: for example
# use PDL;
# use PDL::Graphics::PGPLOT;
# imag(sin(rvals(200,200)+1));
yet this doesn't work of course if PGPLOT can't install.
EDIT 4:
Tried the fix found by #Dr.Avalange at sourceforge https://sourceforge.net/p/pogl/bugs/26/ and noticed that I seem to have multiple copies of this file.
Here
Is this normal...?
EDIT 5:
So i uninstalled perl, deleted any lingering files I could find in %APPDATA%, %USERPROFILE% and C:/DWIM, and then ran ccleaner just in case I missed anything.
I then downloaded Strawberry perl 5.24.1 x64 for Windows and installed it.
After this, I ran 'cpanm Astro::FITS::Header', cpanm 'Convert-UU' and 'cpanm OpenGL' as per http://pdl.perl.org/?page=install. This all worked fine. Then I ran 'cpanm PDL' which installed Inline, Pegex, Win32::Mutex and Module::Compile dependencies. However, if had the same error with Inline::C that you mentioned previously.
I already had GetGnuWin32 installed before so not sure why this isn't working. The Windows 'Path' environment (not PATH - this doesn't exist according to the advaced system dialogue) is noted as
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
In this directory I have the folder GetGnuWin32 which should have installed all the packages from the link you provided, unless there is a supplementary step that I missed to install this correctly? So I redownloaded the DiffUtils setup and ran that, installing to \programfiles(x86) (default option). I then reran 'cpanm PDL'.
I still get the same 'diff' error message. So is DiffUtils, not installing properly? (I did close and re-open the commandline between tries and after the installation)
EDIT 6:
So after installing PDL and PGPLOT with --notest I tried to run the following test and it failed. See below
C:\Windows\system32>perldl
perlDL shell v1.357
PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
'COPYING' in the PDL distribution. This is free software and you
are welcome to redistribute it under certain conditions, see
the same file for details.
ReadLines, NiceSlice, MultiLines enabled
Reading PDL/default.pdl...
Found docs database C:/Strawberry/perl/site/lib/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.017 (supports bad values)
Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)
pdl> use PDL::Graphics//PLplot
Unknown regexp modifier "/P" at (eval 62) line 4, at end of line
Unknown regexp modifier "/L" at (eval 62) line 4, at end of line
Unknown regexp modifier "/t" at (eval 62) line 4, at end of line
BEGIN not safe after errors--compilation aborted at (eval 62) line 5, <DATA> line 207.
pdl> use PDL::Graphics::PLplot
Can't locate PDL/Graphics/PLplot.pm in #INC (you may need to install the PDL::Graphics::PLplot module) (#INC contains: C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib .) at (eval 72) line 5.
BEGIN failed--compilation aborted
pdl> use PDL
pdl> use lib 'C:/Strawberry/perl/site/lib/PDL/Graphics'
pdl> use PGPLOT
pdl> use PDL::Graphics::PGPLOT
pdl> imag(sin(rvals(200,200)+1))
Undefined subroutine &PDL::Graphics::PGPLOT::pgqinf called at C:/Strawberry/perl/site/lib/PDL/Graphics/PGPLOT.pm line 408, <DATA> line 90.
pdl> exit
C:\Windows\system32>cpanm PDL::Graphics::PGPLOT::pgqinf
! Finding PDL::Graphics::PGPLOT::pgqinf on cpanmetadb failed.
! Finding PDL::Graphics::PGPLOT::pgqinf () on mirror http://www.cpan.org failed.
! Couldn't find module or a distribution PDL::Graphics::PGPLOT::pgqinf
C:\Windows\system32>cpan PDL::Graphics::PGPLOT::pgqinf
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: CPAN::SQLite loaded ok (v0.211)
Database was generated on Thu, 13 Apr 2017 13:49:14 GMT
C:\Windows\system32>
There was already a directory problem but I managed to point it in th right direction I had thought. Also tried installing the PLplot 'cpanm' said the installation was successful but there is no .pm file, only a .pd in another directory and so the use PDL::Graphics::PLplot fails as there is no .pm file to find.
EDIT: 7
So retrying ppm install http://www.sisyphusion.tk/ppm/PGPLOT.ppd seemed to work this time as the links int he explanation you provided are no longer in use
http://www.kalinabears.com.au/w32perl/pgplot-5.2.2-mingw32.tar.bz2
http://jrfonseca.home.dyndns.org/projects/gnu-win32/software/ported/patches/pgplot-5.2.2-mingw32.diff.gz
And while this seemed to work, there are no traces of the files that were listed as necessary for the installation, unless they were just for this specific method?
pgplot/bin/cpgplot.dll
pgplot/bin/pgplot.dll
pgplot/bin/grfont.dat
pgplot/include/cpgplot.h
pgplot/lib/cpgplot.a
pgplot/lib/pgplot.a
finally, trying the example again gives the following; no errors, but no image either...
Microsoft Windows [version 10.0.14393]
(c) 2016 Microsoft Corporation. Tous droits réservés.
C:\Windows\system32>perldl
perlDL shell v1.357
PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
'COPYING' in the PDL distribution. This is free software and you
are welcome to redistribute it under certain conditions, see
the same file for details.
ReadLines, NiceSlice, MultiLines enabled
Reading PDL/default.pdl...
Found docs database C:/Strawberry/perl/site/lib/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.017 (supports bad values)
Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)
pdl> use PDL
pdl> use PDL::Graphics::PGPLOT
pdl> imag(rvals(200,200)+1)
%PGPLOT, Unable to read font file: grfont.dat
%PGPLOT, Use environment variable PGPLOT_FONT to specify the location of the PGPLOT grfont.dat file.
Displaying 200 x 200 image from 1 to 142.421356201172, using 240 colors (16-255)...
pdl> $ENV{PGPLOT_FONT} = "C:/Strawberry/perl/site/lib/PGPLOT/pgplot_supp"
pdl> imag(rvals(200,200)+1)
Displaying 200 x 200 image from 1 to 142.421356201172, using 240 colors (16-255)...
pdl>
After translating from French I can see that you don't have diff in your system. Either install diff (part of gnu32: http://gnuwin32.sourceforge.net/) or just skip the tests. See also:
https://github.com/ingydotnet/inline-c-pm/issues/60
With Strawberry 5.24.1 simply type the following from the command prompt:
cpanm --notest PDL
or if you want to watch everything that's going on:
cpanm -v --notest PDL
This will take some time to run.

Clojure fireplace in vim asking for python

Trying to get get fireplace set up in vim but having trouble with some error messages.
When I type cpr in a clojure buffer the following error shows up:
Error detected while processing function <SNR>53_RunTests..fireplace#capture_te
st_run..<SNR>53_eval..fireplace#client..fireplace#platform..fireplace#register_
port_file..fireplace#nrepl_connection#open..fireplace#nrepl#for..<SNR>75_nrepl_
process..<SNR>75_nrepl_message..<SNR>75_nrepl_call..<SNR>74_nrepl_transport_cal
l..<SNR>74_nrepl_transport_dispatch:
line 6:
E605: Exception not caught: nREPL: zsh:1: command not found: python^#
Error detected while processing function <SNR>53_RunTests..fireplace#capture_te
st_run..<SNR>53_eval..fireplace#client..fireplace#platform:
line 9:
E171: Missing :endif
The thing I understand is that it cant find python. In my shell I can start python with the python command which will fire up 3.4.2.
Im using nixos
:echo has('python') returns 0
echo $PATH and :! echo $PATH return the same path.
What can I try in order to find what is actually causing this error?
You have to install/compile vim with python support for vim-fireplace to work, and this may not be the default on your system. I believe typing :help python will do this for you. If you don't get anything, you may have to recompile vim with python support, for which I'll direct you towards Google for now.
Another option if you have pip installed is to consider switching to neovim. Installing neovim with pip install neovim will get you python support. I've been using neovim lately, and it's worked pretty well for me.

How to write llvm pass in Mac OS X 10.9

I built my pass on Linux and it worked there correctly. Now when I brought in my code to Mac OS X 10.9 on Mac Airbook, its not working anymore. I am describing below the steps I took for building my llvm pass.
My source tree is llvm-3.4 and llv-3.4/tools/clang-3.4
I ran ./configure --prefix=/some-path --enable-targets=host which was successful.
Then I ran make && make install which completed without any errors.
I exported the bin path export PATH=/some-path/bin:$path and checked for which clang which opt and they pointed to my installation.
Now when I tried to load hello pass opt -load /some-path/lib/LLVMHello.dylib -hello <fac.bc >/dev/null I get the following error
Error opening '/some-path/lib/LLVMHello.dylib': dlopen(/some-path/lib/LLVMHello.dylib, 9): Symbol not found: __ZN4llvm12FunctionPass17assignPassManagerERNS_7PMStackENS_15PassManagerTypeE
Referenced from: /some-path/lib/LLVMHello.dylib
Expected in: flat namespace
in /some-path/lib/LLVMHello.dylib
-load request ignored.
opt: Unknown command line argument '-hello'. Try: '/some-path/bin/opt -help'
opt: Did you mean '-help'?
Can someone help me fix this issue or at least point in the right direction.
In my case, the dynamic LLVM library, which is required for dynamically loaded passes, was missing. I solved it by configuring LLVM with --enable-shared. I also had --enable-keep-symbols set, but I don't think this is necessary. The full configure command I used:
./configure --enable-shared --enable-keep-symbols
I know I'm a bit late with the answer, but I recently ran into the same problem. And since I spent quite some time solving the issue, I wanted to pass on my findings. Hope it helps.
Cheers, Marcus

How can I train Tesseract on Windows

I am trying to train tesseract for work on windows. The process finish well but when I make the call to
tesseract.exe file.tiff out
after this the run, file is empty.
I don´t know what is happen here, I did the same process under linux and work perfectly.
I think that the problem could be the generation with the mftraining.exe.
It throw this messages:
Warning: no protos/configs for a in CreateIntTemplates()
Warning: no protos/configs for f in CreateIntTemplates()
Warning: no protos/configs for l in CreateIntTemplates()
Warning: no protos/configs for o in CreateIntTemplates()
Warning: no protos/configs for r in CreateIntTemplates()
Error: no configs for class a in mftraining
Error: no configs for class f in mftraining
Error: no configs for class l in mftraining
Error: no configs for class o in mftraining
Error: no configs for class r in mftraining
any other end without problems
Somebody can help me please?
I know the question is old, but if you're looking for a way to train current version of Tesseract (4+) on Windows, I have created a GUI that automates all the process. It requires Python 3. Here is my GitHub repository that contains all the sources and compiled portable executable file.
did you try to follow this manuel from google on how to train tesseract ?
https://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3
According to here:
Training is not supported on windows.
If you want to test/fix something, use the current code from repository (it should be posible to build it with msys2 on windows)
Training tools are only included in Tesseract 3.03+. Separate commands are used to build the main program tesseract.exe and the training tools. Shown as below.
I have successfully built the main program on Windows 7 with MSYS2. But I failed to build the training tools.
Update
Now I have turned to use Xubuntu to build both the main program and the training tools. And the training process can be carried out. Though there's a lot of details to be tuned.

Octave + GNUPlot + Aquaterm + Mac OS 10.6

I'm attempting to do all of my MatLab based homework assignments in Octave - the opensource representation of MatLab.
However, I'm having problems getting graphs to plot and I think it's a simple linking problem. I am running:
-Mac OS X Snow Leopard (10.6)
-Octave 3.2.2
-Aquaterm 1.0.1
-GNUPlot 4.0
Here is an example of the errors that I am getting from my shell:
Mr-Buffalo:~ buffingtonr$ gnuplot
dyld: Library not loaded: /usr/local/lib/libaquaterm.1.0.0.dylib
Referenced from: /usr/local/bin/gnuplot
Reason: image not found
Trace/BPT trap
octave-3.2.2:1> f = inline('x^2')
f(x) = x^2
octave-3.2.2:5> ezplot(f)
dyld: Library not loaded: /usr/local/lib/libaquaterm.1.0.0.dylib
Referenced from: /usr/local/bin/gnuplot
Reason: image not found
dyld: Library not loaded: /usr/local/lib/libaquaterm.1.0.0.dylib
Referenced from: /usr/local/bin/gnuplot
Reason: image not found
error: you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function
octave-3.2.2:6>
I don't have the unix foundation necessary to trouble shoot this. Any suggestions/fixes?
the problem could be related to this
http://macresearch.org/gnuplot-aquaterm-snow-leopard-1061
in the answer: Fri, 2009-09-18 01:59 — TeGa
You have aquaterm 1.0.1 installed, and gnuplot is referencing 1.0.0, which you apparently do not have installed on your system.
I'm not terribly familiar with installing a library on a Mac, but you might be able to just grab the 1.0.0 .dmg file from the Aquaterm files page on Sourceforge.
Alternatively, the newest version of octave or gnuplot might reference the newer library, so you might be able to just upgrade one of those instead.
It's a real hack, but I saw a couple places (including this mailing list) suggesting you just link 1.0.0 to your 1.0.1 library. This isn't usually acceptable, because there's no guarantee the libraries are cross-compatible. It would at least be a quick fix so you can get your homework done in time!
New Progress
When I investigated '/usr/local/lib/', I found that there was a symbolic-link in the directory:
aquaterm-1.0.0 -> /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm
So I created a similar sym-link to make the file gnuplot is looking for (...1.0.1) point to the default AquaTerm location:
aquaterm-1.0.1 -> /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm
This fixes the gnuplot launching issue. I verified that gnuplot successfully plots on its own by plotting a function:
Terminal type set to 'x11'
gnuplot> plot sin(x)
Now I get new errors in Octave:
octave-3.2.2:7> ezplot(f=inline('sin(x)'))
gnuplot> set terminal aqua enhanced title "Figure 1"
^
line 0: You can't change the terminal in multiplot mode
gnuplot> if (exists("GPVAL_TERM")) print GPVAL_TERM; else print NaN
^
line 0: invalid expression
error: Invalid call to strcat. Correct usage is:
-- Function File: strcat (S1, S2, ...)
However, I have verified that gnuplot 4.0 is installed and does, in fact, plot graphs. So now it seems the error is in the communication between Octave and GNUPlot. I will try updating to a newer version of gnuplot if possible and report back.
-Buffalo
This worked for me:
Step 1:
Replace /Library/Frameworks/AquaTerm.framework with /opt/local/Library/Frameworks/AquaTerm.framework. This will ensure that the correct 64 bit AquaTerm libraries get referenced by the gnuplot compilation
Step 2:
Replace /Applications/AquaTerm.app with /Applications/MacPorts/AquaTerm.app. This will ensure that the correct 64-bit AquaTerm binary is in the correct location
source:
http://slashusr.wordpress.com/2010/01/17/gnuplot-with-aquaterm-on-osx-snow-leopard/

Resources