Closed mantielero closed 4 years ago
Thanks for your bug reports, they help to get GRM to a usable state. Could you attach a code example to reproduce the effect? Which version of GR did you use for your test?
I am using aur/gr-framework 0.49.0-1
from ArchLinux.
Regarding the code, it is Nim but I believe it is understandable:
import gr
import sequtils, sugar, math, random
let n = 100
var x = newSeq[float](n)
for i in 0..<n:
x[i] = rand(1.0) * 2.0 - 1.0
histogram(x, nbins=19)
discard readLine(stdin)
grm_finalize()
Within histogram
I do exactly the same as with the other examples that they are working. Internally in Nim, the function histogram
does:
proc histogram*(x:seq[float]; nbins:int = 10) =
##[
Histogram
]##
var args = grm_args_new()
discard grm_args_push(args, "kind".cstring, "s".cstring, "hist".cstring)
discard grm_args_push(args, "x".cstring, "nD".cstring, x.len.cint, cast[ptr cdouble](x[0].unsafeAddr) )
discard grm_args_push(args, "nbins".cstring, "i".cstring, nbins.cint )
discard grm_plot(args)
grm_args_delete(args)
The only thing that I do differently to the other functions is the line:
discard grm_args_push(args, "nbins".cstring, "i".cstring, nbins.cint )
GRM expected the histogram to be already calculated by the wrapper. Therefore x
and y
values. Since it was planned to change this behaviour anyway we changed it in this commit, meaning it is fixed in todays release v0.50.0
.
When I try to create an histogram using GRM I get the following error: