Procedures and functions not found while executing GDL commands - procedure

I've installed GDL recently, since I don't have a license for IDL.
I was trying to run and IDL (.pro) script for simulate exoplanetary transit (with exomoon) and I got some issues:
GDL> .reset_session
(gdl:16530): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
GDL>
GDL> restore, 'paramk63.save', /v
% Procedure not found: RESTORE
% Execution halted at: $MAIN$
GDL>
GDL> Per = PER
GDL> ap = A
% Variable is undefined: A
% Execution halted at: $MAIN$
GDL> Rplan = RP
% Variable is undefined: RP
% Execution halted at: $MAIN$
GDL> inc = INC
GDL> Pm = 1
GDL> Rmoon = 0.03
GDL> dmoon = 4.0
GDL> tetam0 = 0.0
GDL> dt = 1.0
GDL> wl = WL
GDL>
GDL> eclipse_moon,Per,ap,Rplan,inc,Pm,Rmoon,dmoon,tetam0,dt,wl,/plot
% Compiled module: ECLIPSE_MOON.
% ECLIPSE_MOON: Ambiguous: Variable is undefined: MEAN or: Function not found: MEAN
% Execution halted at: ECLIPSE_MOON 23 /home/fabian/Downloads/eclipse_moon.pro
% $MAIN$
GDL> 0:45 / 9:10
% ECLIPSE_MOON: Parser syntax error: unexpected token: 0
GDL>
I ran this same code on linux with IDL installed and it was perfectly fine.
It seems I have to install some more stuff. Is that right?

Looks like it couldn't find a function called MEAN. Make sure it is in your !path and that you are calling it properly. When IDL (or GDL) runs a function or program, it searches all of the directories in the variable !path to find it. If it is found, IDL will load the function and continue compiling. In this case I expect that the function ECLIPSE_MOON calls MEAN on line 23. But MEAN (which is usually built in in IDL) is not found in GDL. So you need to make sure it can be found.
To check what your path, in a GDL session type print,!path and make sure the function MEAN is in one of those directories.

Related

Moses tuning fails to run extractor

When I attempt to tune my Moses tuner (according to the moses baseline), it reaches the end of my tuning dataset (75k lines) and then exits on the code:
Executing: /home/alexm/Desktop/dissertation/models/cy-en/transsystem/mert-work/extractor.sh > extract.out 2> extract.err
Exit code: 127
ERROR: Failed to run '/home/alexm/Desktop/dissertation/models/cy-en/transsystem/mert-work/extractor.sh'. at ../../../mosesdecoder/scripts/training/mert-moses.pl line 1775.
It exits without giving the current tuning weights too, causing the loss of hours of progress.
It seems like you're missing some file or access to it
127 typically means command not found
Are you missing the file /home/alexm/Desktop/dissertation/models/cy-en/transsystem/mert-work/extractor.sh ?

Why -l option in lua interpreter acts strangely?

You can execute a sequence of chunks by giving them all as arguments
to the stand-alone interpreter, with the -l option. For instance, if
you have a file a with a single statement x=1 and another file b with
the statement print(x), the command line
prompt> lua -la -lb
will run the chunk in a, then the one in b, which will print the
expected 1.
The above is from the following link: https://www.lua.org/pil/1.1.html. Yet, when I was trying it out, I got a syntax error.
So, in file a.lua, I have only one line, which is a=1. Then in file b.lua, I have also only one line print("the value of a is:",a) . Then,
:~$ lua -i -la -lb
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
the value of a is: true
>
:~$
:~$ lua -la -lb
the value of a is: true
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
>
Why did it print out "the value of a is: true"? rather than "the value of a is: 1"?
Any comments are greatly appreciated.
The error is because you are use a = 1 in your file a.lua, unlike in the example where a.lua contains x = 1 and b.lua contains print(x).
Using a rather then x means your using the same a variable being written to when -la completes, changing it to true.
This happens because the option -l name is equal to name = require("name"). When require completes, on a file that returns no result to it, require will return true.
your command lua -la -lb would look something like this to lua:
a = require("a") --this returning true after it completes
b = require("b") --this printing the value of `a` which will always be `true`
Sources:
Similar question answered on Lua-Users: command-line -l option issue
Egor Skriptunoff's Comment on this question

Failed to compare images with Imagemagick with robot framework on Windows environment

I am using Imagemagick to compare two screenshots in windows environment.
https://blog.codecentric.de/en/2017/09/robot-framework-compare-images-screenshots/
*** Settings ***
Library String
Library OperatingSystem
*** Variables ***
${IMAGE_COMPARATOR_COMMAND} C:\\"Program Files"\\ImageMagick-7.0.7-Q16\\convert.exe
*** Test Cases ***
Image Comparison Ok
Compare Images C:/Users/user/imagecompare/Test/src/reference-screenshots/reference-1.png C:/Users/user/imagecompare/Test/src/test-screenshots/test-1.png 0.1
Image Comparison NOk
Compare Images C:/Users/user/imagecompare/Test/src/reference-screenshots/reference-1.png C:/Users/user/imagecompare/Test/src/test-screenshots/test-1.png 0.1
*** Keywords ***
Compare Images
[Arguments] ${Reference_Image_Path} ${Test_Image_Path} ${Allowed_Threshold}
${TEMP}= Replace String ${IMAGE_COMPARATOR_COMMAND} __REFERENCE__ ${Reference_Image_Path}
${COMMAND}= Replace String ${TEMP} __TEST__ ${Test_Image_Path}
Log Executing: ${COMMAND}
${RC} ${OUTPUT}= Run And Return Rc And Output ${COMMAND}
Log Return Code: ${RC}
Log Return Output: ${OUTPUT}
${RESULT} Evaluate ${OUTPUT} < ${Allowed_Threshold}
Should be True ${RESULT}
But getting the following issue:
KEYWORD BuiltIn . Log Return Output: ${OUTPUT}
Documentation:
Logs the given message with the given level.
Start / End / Elapsed: 20171016 15:45:38.561 / 20171016 15:45:38.562 / 00:00:00.001
15:45:38.561 INFO Return Output: The system cannot find the path specified.
00:00:00.003KEYWORD ${RESULT} = BuiltIn . Evaluate ${OUTPUT} < ${Allowed_Threshold}
Documentation:
Evaluates the given expression in Python and returns the results.
Start / End / Elapsed: 20171016 15:45:38.562 / 20171016 15:45:38.565 / 00:00:00.003
15:45:38.563 FAIL Evaluating expression 'The system cannot find the path specified. < 0.1' failed: SyntaxError: invalid syntax (<string>, line 1)
If you want to use the "legacy" convert command with ImageMagick v7, you need to click the option during installation of ImageMagick that says "Install legacy tools".
Or, use the new command which is:
magick input.png ... output.png
rather than:
convert input.png ... output.png
So, if you know how to change your configuration variable IMAGE_COMPARATOR_COMMAND to C:\\"Program File"\\ImageMagick-7.0.7-Q16\\magick, you can do it without re-installing ImageMagick.
${IMAGE_COMPARATOR_COMMAND} C:/"Program Files"/ImageMagick-7.0.10-Q16/convert.exe REFERENCE TEST -metric RMSE -compare -format "%[distortion]" info:
replace with above IMAGE_COMPARATOR_COMMAND with suitable changes for your path.
It worked for me.
Thanks

Scala import issue with PredictionIO Universal Recommender integration test

I've tried to get the Universal Recommender template set up as per the instructions located at UR Quickstart. Getting an import error. Is there a dependency/step that I missed?
[ERROR] [Engine$] [error] \import org.apache.mahout.math.cf.{DownsamplableCrossOccurrenceDataset, SimilarityAnalysis}
[ERROR] [Engine$] [error] ^
[ERROR] [Engine$] [error] one error found
The relevant block in my build.sbt file is as follows:
libraryDependencies ++= Seq(
"org.apache.predictionio" %% "apache-predictionio-core" % pioVersion % "provided",
"org.apache.predictionio" %% "apache-predictionio-data-elasticsearch1" % pioVersion % "provided",
"org.apache.spark" %% "spark-core" % "1.4.0" % "provided",
"org.apache.spark" %% "spark-mllib" % "1.4.0" % "provided",
"org.xerial.snappy" % "snappy-java" % "1.1.1.7",
// Mahout's Spark libs
"org.apache.mahout" %% "mahout-math-scala" % mahoutVersion,
"org.apache.mahout" %% "mahout-spark" % mahoutVersion
exclude("org.apache.spark", "spark-core_2.10"),
"org.apache.mahout" % "mahout-math" % mahoutVersion,
"org.apache.mahout" % "mahout-hdfs" % mahoutVersion
exclude("com.thoughtworks.xstream", "xstream")
exclude("org.apache.hadoop", "hadoop-client"),
//"org.apache.hbase" % "hbase-client" % "0.98.5-hadoop2" %
"provided",
Please disregard. I'm not familiar with scala syntax so I didn't realize the incorrect inclusion of the backslash in the source file was problematic.
Consider this answer as an alternative for build PIO-UR engine.
Actually, I also had struggled with these dependency issues. What I am telling you is not the right solution for this. But this will provide you a working PredictionIO UR engine.
Use the docker image for the universal recommender template.
Use this link for getting PIO-UR docker image.
If you are not familiar with docker, use these links below :
INSTALLATIONS:
Docker for MAC
Docker for Windows
For Ubuntu, use automated script: curl -sSL https://get.docker.com/ | sh
Then use the above image from git for using the UR template. By using docker, we don't need to struggle with the dependencies. The readme file in the git repository is really helpful and use that as a guide. You can set the PIO engine up and run with 3 simple commands.

Missing nvcc compiler - theano

I use ubuntu 14.04 and cuda 7.5. I get cuda version information using $ nvcc --version :
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
$PATH and $LD_LIBRARY_PATH are below :
$ echo $PATH
/usr/local/cuda-7.5/bin:/usr/local/cuda-7.5/bin/:/opt/ros/indigo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ echo $LD_LIBRARY_PATH
/usr/local/cuda-7.5/lib64
I install theano. I use it with cpu but not gpu. This guide says that
Testing Theano with GPU¶
To see if your GPU is being used, cut and paste the following program into a file and run it.
from theano import function, config, shared, sandbox import
> theano.tensor as T import numpy import time
>
> vlen = 10 * 30 * 768 # 10 x #cores x # threads per core iters = 1000
>
> rng = numpy.random.RandomState(22) x =
> shared(numpy.asarray(rng.rand(vlen), config.floatX)) f = function([],
> T.exp(x)) print(f.maker.fgraph.toposort()) t0 = time.time() for i in
> range(iters):
> r = f() t1 = time.time() print("Looping %d times took %f seconds" % (iters, t1 - t0)) print("Result is %s" % (r,)) if
> numpy.any([isinstance(x.op, T.Elemwise) for x in
> f.maker.fgraph.toposort()]):
> print('Used the cpu') else:
> print('Used the gpu') The program just computes the exp() of a bunch of random numbers. Note that we use the shared function to make
> sure that the input x is stored on the graphics device.
If I run this program (in check1.py) with device=cpu, my computer
takes a little over 3 seconds, whereas on the GPU it takes just over
0.64 seconds. The GPU will not always produce the exact same floating-point numbers as the CPU. As a benchmark, a loop that calls
numpy.exp(x.get_value()) takes about 46 seconds.
$ THEANO_FLAGS=mode=FAST_RUN,device=cpu,floatX=float32 python
check1.py [Elemwise{exp,no_inplace}()]
Looping 1000 times took 3.06635117531 seconds Result is [ 1.23178029
1.61879337 1.52278066 ..., 2.20771813 2.29967761
1.62323284] Used the cpu
$ THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python
check1.py Using gpu device 0: GeForce GTX 580
[GpuElemwise{exp,no_inplace}(),
HostFromGpu(GpuElemwise{exp,no_inplace}.0)] Looping 1000 times took
0.638810873032 seconds Result is [ 1.23178029 1.61879349 1.52278066 ..., 2.20771813 2.29967761
1.62323296] Used the gpu Note that GPU operations in Theano require for now floatX to be float32 (see also below).
I run gpu version command without sudo, it throws permission denied error :
/theano/gof/cmodule.py", line 741, in refresh
files = os.listdir(root)
OSError: [Errno 13] Permission denied: '/home/user/.theano/compiledir_Linux-3.16--generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64/tmp077r7U'
If I use it with sudo, the compiler cannot find nvcc path.
ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.
How can I fix this error?
Try running
chown -R user /home/user/.theano
chmod -R 775 /home/user/.theano
this will change the permissions of the folder that your python script can't access. The first one will make the folder belong to your user and the second one will change the permissions to be readable, writable and executable by the user.
Regarding this error only:
You can check where your NVCC is installed , default path is '/usr/local/cuda/bin', if you could see it there then do as below:
$ export PATH="/usr/local/cuda/bin:$PATH"
$ source .bashrc
This worked for me and now I can use NVCC and it is no longer missing.

Resources