-
Notifications
You must be signed in to change notification settings - Fork 0
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
Admirable project but llthreads is incorrectly required #1
Comments
Thanks for pointing this out. I built the llthreads2 module manually to llthreads.dll. I will update the lua-plot code to require llthreads2. Before that can you please check if in your local lua-plot.lua file if you change llthreads to llthreads2 does it work then for you? |
Ya your plotting example works perfectly now with that fix. |
By-the-way is it possible to plot arrays against one another? I have solved an ordinary differential equation in Lua and I'd like to plot my y array against my x array. Is this possible? |
I have updated the code to look for llthreads2 as well. Please try it with the new code as well. The AddSeries function in the plot object as described here: https://www.amved.com/milindsweb/lua_plot.html#L5 can be called in 2 ways: The 1st way allows separate x value and y value arrays and the second method where you have a table of x,y points (this is how the example on the documentation page uses it). Example of the 1st method for the same example will be: If you are writing some code that may be helpful as a separate math package consider adding it to the LuaMath project here: https://github.com/aryajur/LuaMath Here I am consolidating all math routines I make and use to make a generalized math package to be used with any Lua version directly. lua-plot is included as a submodule in there also it has complex number support. |
I actually tried that syntax before I asked. It didn't work so I assumed I was using the wrong syntax. This is what I have to plot in my program: lp = require("lua-plot")
p = lp.plot{}
p:AddSeries(t, theta)
p:Redraw() The plot doesn't seem to start, I get GTK warnings at the command-line that suggest the plot is attempting to run but it doesn't launch as I can't see it. Here is exactly what I see at the command-line if you're wondering: (lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1036:92: Missing closing bracket at end of linear gradient
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1036:94: Expected semicolon
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1036:124: Expected semicolon
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1147:50: Expected semicolon
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:3129:50: Expected semicolon where t and theta are my coordinate arrays. |
Please can you also include a small sample of t and theta that doesn't work
so I can replicate the issue at my end?
…On Oct 17, 2017 11:11 AM, "BH2017" ***@***.***> wrote:
I actually tried that syntax before I asked. It didn't work so I assumed I
was using the wrong syntax. This is what I have to plot in my program:
lp = require("lua-plot")
p = lp.plot{}
p:AddSeries(t, theta)
p:Redraw()
The plot doesn't seem to start, I get GTK warnings at the command-line
that suggest the plot is attempting to run but it doesn't launch as I can't
see it. Here is exactly what I see at the command-line if you're wondering:
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1036:92: Missing closing bracket at end of linear gradient
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1036:94: Expected semicolon
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1036:124: Expected semicolon
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:1147:50: Expected semicolon
(lua:23005): Gtk-WARNING **: Theme parsing error: gtk.css:3129:50: Expected semicolon
where t and theta are my coordinate arrays.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHEBHZyLU0nh9yRqGjt0XATqYS7TCP3yks5stOyJgaJpZM4P6oP->
.
|
Full script is here https://github.com/fusion809/lua-scripts/blob/master/simple-pendulum-array.lua. |
So I looked at it. It seems that since the number of points were a million the plotting was having a problem. I added some code to basically sample 1 in every 10 points from the t and theta arrays and then it works. Also I committed an improvement to make the graph plotting of large data sets faster. Here is the updated code for your sample: --Plot theta against t
local nt,ntheta = {},{}
for i = 1,1000000,10 do
nt[#nt + 1] = t[i]
ntheta[#ntheta + 1] = theta[i]
end
lp = require("lua-plot")
p = lp.plot{}
p:AddSeries(nt, ntheta)
p:Show() |
I have redone the AddSeries function to allow very large data sets and now the million points also works. I will be committing it shortly. |
Ah for my program it still fails with the error: 6.6136225385094e-09
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1036:92: Missing closing bracket at end of linear gradient
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1036:94: Expected semicolon
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1036:124: Expected semicolon
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1147:50: Expected semicolon
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:3129:50: Expected semicolon
lua: simple-pendulum-array.lua:125: attempt to index a boolean value (global 'lp')
stack traceback:
simple-pendulum-array.lua:125: in main chunk
[C]: in ? |
Does it work if you just plot only 1000 points?
…On Tue, Oct 17, 2017 at 11:12 PM, BH2017 ***@***.***> wrote:
Ah for my program it still fails with the error:
6.6136225385094e-09
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1036:92: Missing closing bracket at end of linear gradient
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1036:94: Expected semicolon
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1036:124: Expected semicolon
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:1147:50: Expected semicolon
(lua:21267): Gtk-WARNING **: Theme parsing error: gtk.css:3129:50: Expected semicolon
lua: simple-pendulum-array.lua:125: attempt to index a boolean value (global 'lp')
stack traceback:
simple-pendulum-array.lua:125: in main chunk
[C]: in ?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHEBHdmJs12gNorVjzw_8kmXkzKAeRvqks5stZbdgaJpZM4P6oP->
.
|
Sounds like a good idea, but unfortunately with 1e3 points it just gives: 3.0182151926628e-05
(lua:4719): Gtk-WARNING **: Theme parsing error: gtk.css:1036:92: Missing closing bracket at end of linear gradient
(lua:4719): Gtk-WARNING **: Theme parsing error: gtk.css:1036:94: Expected semicolon
(lua:4719): Gtk-WARNING **: Theme parsing error: gtk.css:1036:124: Expected semicolon
(lua:4719): Gtk-WARNING **: Theme parsing error: gtk.css:1147:50: Expected semicolon
(lua:4719): Gtk-WARNING **: Theme parsing error: gtk.css:3129:50: Expected semicolon and exits. No graph, no nothing. |
I just committed the new version which is working for the million data points. You can try this. If this does not work can you try the plot using the following and see if this works: require("iuplua")
require("iuplua_plot")
plot = iup.plot{
-- TITLE = "Plot Test",
MARGINBOTTOM = 20,
}
plot:Begin(0)
for i = 1,1000000,1 do
plot:Add(t[i], theta[i])
end
plot:End()
dlg = iup.dialog{
TITLE = "Plot Test",
SIZE = "400x200",
plot,
}
dlg:showxy(iup.CENTER, iup.CENTER)
iup.MainLoop() |
This issue is really persistent your fix I just pulled and it doesn't work (same output as before). I tried this snippet of code and it too didn't work, gave this output: 3.0182151926628e-05
(lua:6375): Gtk-WARNING **: Theme parsing error: gtk.css:1036:92: Missing closing bracket at end of linear gradient
(lua:6375): Gtk-WARNING **: Theme parsing error: gtk.css:1036:94: Expected semicolon
(lua:6375): Gtk-WARNING **: Theme parsing error: gtk.css:1036:124: Expected semicolon
(lua:6375): Gtk-WARNING **: Theme parsing error: gtk.css:1147:50: Expected semicolon
(lua:6375): Gtk-WARNING **: Theme parsing error: gtk.css:3129:50: Expected semicolon
lua: simple-pendulum-array.lua:140: bad argument #2 to 'Add' (number expected, got nil)
stack traceback:
[C]: in function 'iuplua.PlotAdd'
simple-pendulum-array.lua:140: in main chunk
[C]: in ? |
Ok since the issue is still present when you run the plotting script I gave without using lua-plot it is not related to lua-plot but something to do with GTK. If you can run this script and increase COUNT by 10 every time and see when it fails would be helpful. Also the error messages if they are different from above: require("iuplua")
require("iuplua_plot")
plot = iup.plot{
-- TITLE = "Plot Test",
MARGINBOTTOM = 20,
}
COUNT = 10
plot:Begin(0)
for i = 1,COUNT do
plot:Add(i, 2*i)
end
plot:End()
dlg = iup.dialog{
TITLE = "Plot Test",
SIZE = "400x200",
plot,
}
dlg:showxy(iup.CENTER, iup.CENTER)
iup.MainLoop() |
I've managed to plot using Lua plot with your example at https://www.amved.com/milindsweb/lua_plot.html#L9. With N=100 it also does not work. Plotting in other programs (e.g. GNU Octave) with large number of steps works fine and my PC has pretty good specs 8 x 2394 MHz CPU cores and 16 GB RAM. Dual NVIDIA and Intel graphics cards. So I doubt it's my hardware. |
The GNU Octave program I ran to see whether plotting works in it is: clear all
t=linspace(0,350,100001);
lsode_options("relative tolerance", 1e-15);
y = lsode("lorenz",[ 1.0; 1.0; 1.0]',t);
figure(1)
subplot(221)
plot(y(:,1),y(:,2),'-');
xlabel('x(t)','FontSize',16);
ylabel('y(t)','FontSize',16);
subplot(222)
plot(y(:,1),y(:,3),'-');
xlabel('x(t)','FontSize',16);
ylabel('z(t)','FontSize',16);
subplot(223)
plot(y(:,2),y(:,3),'-');
xlabel('y(t)','FontSize',16);
ylabel('z(t)','FontSize',16); where lorenz is defined as: function dy = lorenz(y,t)
dy = zeros(3,1);
P = 10;
r = 28;
b = 8/3;
dy(1) = P*(y(2) - y(1));
dy(2) = -y(1)*y(3) + r*y(1) - y(2);
dy(3) = y(1)*y(2) - b*y(3); if you're wondering if I tested it thoroughly. |
I don't think it is a hardware issue at your end but something with the IUP library. So I wanted to see the result of the script (lets say for COUNT 10, 50 and 100) and see when it fails: require("iuplua")
require("iuplua_plot")
plot = iup.plot{
-- TITLE = "Plot Test",
MARGINBOTTOM = 20,
}
COUNT = 10
plot:Begin(0)
for i = 1,COUNT do
plot:Add(i, 2*i)
end
plot:End()
dlg = iup.dialog{
TITLE = "Plot Test",
SIZE = "400x200",
plot,
}
dlg:showxy(iup.CENTER, iup.CENTER)
iup.MainLoop()
|
Past tense makes me wonder if you're saying you've done this or you want me to do this? |
Sorry I want you to run this on your system and let me know for which COUNT magnitude it fails so I have better information to add to the issue on the IUP mailing list. I have already posted this error on the mailing list. |
Compiled it from source using the Arch User Repository (AUR) — https://aur.archlinux.org/packages/iup and https://aur.archlinux.org/packages/lua-iup. Your test works fine. No output at the command-line besides GTK warnings. |
Thanks for this info. Also when you say the test works fine does that mean the graph shows up even for COUNT = 100? If yes does it show up for COUNT=1000 |
COUNT=10 is what I used for COUNT=100 and 1000 it works fine though. |
Oh and COUNT=1e6 works fine too. |
Ok that is strange it works for all those points in the sample script. So now if you use this in pendulum does it work: require("iuplua")
require("iuplua_plot")
plot = iup.plot{
-- TITLE = "Plot Test",
MARGINBOTTOM = 20,
}
plot:Begin(0)
for i = 1,1000 do
plot:Add(t[i], theta[i])
end
plot:End()
dlg = iup.dialog{
TITLE = "Plot Test",
SIZE = "400x200",
plot,
}
dlg:showxy(iup.CENTER, iup.CENTER)
iup.MainLoop() |
Works fine. Thanks. |
Ok, so what if you plot the entire thing using this sample script, does this work: require("iuplua")
require("iuplua_plot")
plot = iup.plot{
-- TITLE = "Plot Test",
MARGINBOTTOM = 20,
}
plot:Begin(0)
for i = 1,#t do
plot:Add(t[i], theta[i])
end
plot:End()
dlg = iup.dialog{
TITLE = "Plot Test",
SIZE = "400x200",
plot,
}
dlg:showxy(iup.CENTER, iup.CENTER)
iup.MainLoop() |
Works fine, although the graph is very large given the fact SIZE is set at 400x200. |
oh ok, you can adjust the size. So now can you try the lua-plot way of plotting the same. Does this work: --Plot theta against t
local nt,ntheta = {},{}
for i = 1,1000 do
nt[#nt + 1] = t[i]
ntheta[#ntheta + 1] = theta[i]
end
lp = require("lua-plot")
p = lp.plot{}
p:AddSeries(nt, ntheta)
p:Show() |
That was interesting... A window popped up for a few milliseconds (so few that it disappeared before I could make anything out) then closed and the program exited. |
oh ok, can you try this then, I added io.read() in the end so that it waits for you to press enter before exiting the program: --Plot theta against t
local nt,ntheta = {},{}
for i = 1,1000 do
nt[#nt + 1] = t[i]
ntheta[#ntheta + 1] = theta[i]
end
lp = require("lua-plot")
p = lp.plot{}
p:AddSeries(nt, ntheta)
p:Show()
io.read() |
We just plotted 1000 points so I believe that was all there was. So now since this works can we try the full data now: --Plot theta against t
lp = require("lua-plot")
p = lp.plot{}
p:AddSeries(t, theta)
p:Show()
io.read() |
There it goes, it's now working fine and dandy. |
Great! I will close the issue now. Thank you for working with me on this! |
Hi,
The llthreads dependency seems to be required incorrectly as I have installed the llthreads2 (version 0.1.4) from the repository you linked in the documentation. It installs its crucial library to
/usr/lib/lua/5.3/llthreads2.so
with llthreads2.so being the notable part of that path. When I symlink this path to/usr/lib/lua/5.3/llthreads.so
I get yet another error when I try to load lua-plot:If I disable the use of llthreads by editing line 17 of lua-plot.lua changing
nil
to1
everything works, fine, however. So it is clearly with what's done with llthreads. If relevant my platform is Arch Linux and I installed llthreads2 with this PKGBUILD:Thanks for your time
The text was updated successfully, but these errors were encountered: