gplepage / vegas Goto Github PK
View Code? Open in Web Editor NEWAdaptive multidimensional Monte Carlo integration.
License: Other
Adaptive multidimensional Monte Carlo integration.
License: Other
Tried to install in mac with the four options: make install, python install . and python install --user
None worked. Also modified, setup file to: USE_CYTHON = True # True
Got:
-> Failed building wheel for vegas
-> Failed building wheel for gvar
Hello, I can see similar questions have been asked but i couldn't solve it based on their answers. Here is the full log i obtain ater trying pip install vegas inside a conda environment with python3.6.12:
ERROR: Failed building wheel for gvar
Running setup.py clean for gvar
Failed to build vegas gvar
Installing collected packages: gvar, vegas
Running setup.py install for gvar ... error
ERROR: Command errored out with exit status 1:
command: /opt/anaconda3/envs/cosmoT/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-install-_n9w9c08/gvar_81667170105c449ca2b9f7bd66e9a7c4/setup.py'"'"'; file='"'"'/private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-install-_n9w9c08/gvar_81667170105c449ca2b9f7bd66e9a7c4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-record-xn0mtvmz/install-record.txt --single-version-externally-managed --compile --install-headers /opt/anaconda3/envs/cosmoT/include/python3.6m/gvar
cwd: /private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-install-_n9w9c08/gvar_81667170105c449ca2b9f7bd66e9a7c4/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/cspline.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/powerseries.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/init.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/pade.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/linalg.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/ode.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/root.py -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/../gvar.pxd -> build/lib.macosx-10.9-x86_64-3.6/gvar/..
copying src/gvar/_svec_smat.pxd -> build/lib.macosx-10.9-x86_64-3.6/gvar
copying src/gvar/_gvarcore.pxd -> build/lib.macosx-10.9-x86_64-3.6/gvar
running build_ext
building 'gvar._gvarcore' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/src
creating build/temp.macosx-10.9-x86_64-3.6/src/gvar
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/anaconda3/envs/cosmoT/include -arch x86_64 -I/opt/anaconda3/envs/cosmoT/include -arch x86_64 -I/opt/anaconda3/envs/cosmoT/lib/python3.6/site-packages/numpy/core/include -I/opt/anaconda3/envs/cosmoT/include/python3.6m -c src/gvar/_gvarcore.c -o build/temp.macosx-10.9-x86_64-3.6/src/gvar/_gvarcore.o
dyld: Library not loaded: /usr/local/lib/libmpc.3.dylib
Referenced from: /usr/local/libexec/gcc/x86_64-apple-darwin17.5.0/8.1.0/cc1
Reason: image not found
gcc: internal compiler error: Abort trap: 6 signal terminated program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See https://gcc.gnu.org/bugs/ for instructions.
error: command 'gcc' failed with exit status 4
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/anaconda3/envs/cosmoT/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-install-_n9w9c08/gvar_81667170105c449ca2b9f7bd66e9a7c4/setup.py'"'"'; file='"'"'/private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-install-_n9w9c08/gvar_81667170105c449ca2b9f7bd66e9a7c4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/4c/p4y9gn057sl8q20k0s5bcmjc0000gn/T/pip-record-xn0mtvmz/install-record.txt --single-version-externally-managed --compile --install-headers /opt/anaconda3/envs/cosmoT/include/python3.6m/gvar Check the logs for full command output.
On a Windows machine, when I run the example code:
import vegas
import math
def f(x):
dx2 = 0
for d in range(4):
dx2 += (x[d] - 0.5) ** 2
return math.exp(-dx2 * 100.) * 1013.2118364296088
integ = vegas.Integrator([[-1, 1], [0, 1], [0, 1], [0, 1]])
result = integ(f, nitn=10, neval=1000)
print(result.summary())
print('result = %s Q = %.2f' % (result, result.Q))
I get an error message:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-49a6843f4c3f> in <module>()
10 integ = vegas.Integrator([[-1, 1], [0, 1], [0, 1], [0, 1]])
11
---> 12 result = integ(f, nitn=10, neval=1000)
13 print(result.summary())
14 print('result = %s Q = %.2f' % (result, result.Q))
src/vegas/_vegas.pyx in random_batch (src/vegas/_vegas.c:21017)()
ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long'
I know that gvar had a similar issue at one time, so I tried rolling back gvar to version 8.0, but that didn't help.
As the title says, I have to integrate a multidimensional array, where a big part of the variables have a gaussian probability distribution, but there are also a number of variable with an integration range.
May I just use a pdf function with hard cut offs for the integration ranges?
Any help appreciatedπ
Complete installation log below. By the way it also fails on anaconda 4.6.11. with the same stderr.
Lukasz
Collecting vegas
Using cached https://files.pythonhosted.org/packages/1b/1f/4107d2dfbfd37c5e7344b3e2cb0dc50f9c13a8dd93da4869f280a988be89/vegas-3.4.tar.gz
Requirement already satisfied: numpy>=1.7 in /usr/lib64/python3.7/site-packages (from vegas) (1.17.1)
Collecting gvar>=8.0 (from vegas)
Using cached https://files.pythonhosted.org/packages/8e/95/4a93066de972312d08f0c313003bac02099b16ad488133863a09f6e754f3/gvar-9.2.tar.gz
Installing collected packages: gvar, vegas
Running setup.py install for gvar: started
Running setup.py install for gvar: still running...
Running setup.py install for gvar: still running...
Running setup.py install for gvar: still running...
Running setup.py install for gvar: finished with status 'error'
Collecting vegas
Using cached https://files.pythonhosted.org/packages/1b/1f/4107d2dfbfd37c5e7344b3e2cb0dc50f9c13a8dd93da4869f280a988be89/vegas-3.4.tar.gz
Requirement already satisfied: numpy>=1.7 in /usr/lib64/python3.7/site-packages (from vegas) (1.17.1)
Collecting gvar>=8.0 (from vegas)
Using cached https://files.pythonhosted.org/packages/8e/95/4a93066de972312d08f0c313003bac02099b16ad488133863a09f6e754f3/gvar-9.2.tar.gz
Installing collected packages: gvar, vegas
Running setup.py install for gvar: started
Running setup.py install for gvar: still running...
Running setup.py install for gvar: still running...
Running setup.py install for gvar: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lbr2omm5/gvar/setup.py'"'"'; file='"'"'/tmp/pip-install-lbr2omm5/gvar/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-yz76nlx9/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-lbr2omm5/gvar/
Complete output (98 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/gvar
copying src/gvar/cspline.py -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/powerseries.py -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/init.py -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/linalg.py -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/ode.py -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/root.py -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/../gvar.pxd -> build/lib.linux-x86_64-3.7/gvar/..
copying src/gvar/_svec_smat.pxd -> build/lib.linux-x86_64-3.7/gvar
copying src/gvar/_gvarcore.pxd -> build/lib.linux-x86_64-3.7/gvar
running build_ext
building 'gvar._gvarcore' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/src/gvar
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I/usr/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c src/gvar/_gvarcore.c -o build/temp.linux-x86_64-3.7/src/gvar/_gvarcore.o
In file included from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from src/gvar/_gvarcore.c:610:
/usr/lib64/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
src/gvar/_gvarcore.c: In function β__pyx_pw_4gvar_9_gvarcore_4GVar_85derivβ:
src/gvar/_gvarcore.c:11115:8: warning: β__pyx_v_iderβ may be used uninitialized in this function [-Wmaybe-uninitialized]
11115 | if (__pyx_t_4) {
| ^
src/gvar/_gvarcore.c:10987:12: note: β__pyx_v_iderβ was declared here
10987 | npy_intp __pyx_v_ider;
| ^~~~~~~~~~~~
gcc -pthread -shared build/temp.linux-x86_64-3.7/src/gvar/_gvarcore.o -L/usr/lib64 -lpython3.7m -o build/lib.linux-x86_64-3.7/gvar/_gvarcore.cpython-37m-x86_64-linux-gnu.so
building 'gvar._svec_smat' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I/usr/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c src/gvar/_svec_smat.c -o build/temp.linux-x86_64-3.7/src/gvar/_svec_smat.o
In file included from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from src/gvar/_svec_smat.c:567:
/usr/lib64/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
src/gvar/_svec_smat.c: In function β__pyx_f_4gvar_10_svec_smat_4smat_append_diagβ:
src/gvar/_svec_smat.c:8093:17: warning: assignment to βPyObject *β {aka βstruct _object *β} from incompatible pointer type βstruct __pyx_obj_4gvar_10_svec_smat_svec *β [-Wincompatible-pointer-types]
8093 | *__pyx_t_21 = __pyx_v_new_svec;
| ^
src/gvar/_svec_smat.c: In function β__pyx_f_4gvar_10_svec_smat_4smat_append_diag_mβ:
src/gvar/_svec_smat.c:8850:17: warning: assignment to βPyObject *β {aka βstruct _object *β} from incompatible pointer type βstruct __pyx_obj_4gvar_10_svec_smat_svec *β [-Wincompatible-pointer-types]
8850 | *__pyx_t_28 = __pyx_v_new_svec;
| ^
gcc -pthread -shared build/temp.linux-x86_64-3.7/src/gvar/_svec_smat.o -L/usr/lib64 -lpython3.7m -o build/lib.linux-x86_64-3.7/gvar/_svec_smat.cpython-37m-x86_64-linux-gnu.so
building 'gvar._utilities' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I/usr/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c src/gvar/_utilities.c -o build/temp.linux-x86_64-3.7/src/gvar/_utilities.o
In file included from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from src/gvar/_utilities.c:610:
/usr/lib64/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
src/gvar/_utilities.c: In function β__pyx_f_4gvar_10_utilities_gammaQ_cfβ:
src/gvar/_utilities.c:29845:54: warning: β__pyx_v_facβ may be used uninitialized in this function [-Wmaybe-uninitialized]
29845 | __pyx_t_6 = PyFloat_FromDouble(fabs((__pyx_v_fac - 1.0))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1517, __pyx_L1_error)
| ~~~~~~~~~~~~~^~~~~~
src/gvar/_utilities.c: In function βpyx_pw_4gvar_10_utilities_3SVD_1__initβ:
src/gvar/_utilities.c:28358:17: warning: β__pyx_v_iβ may be used uninitialized in this function [-Wmaybe-uninitialized]
28358 | __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_val, __pyx_v_i, 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gvar/_utilities.c:26701:14: note: β__pyx_v_iβ was declared here
26701 | Py_ssize_t __pyx_v_i;
| ^~~~~~~~~
src/gvar/_utilities.c: In function β__pyx_pw_4gvar_10_utilities_9derivβ:
src/gvar/_utilities.c:6984:10: warning: β__pyx_v_iderβ may be used uninitialized in this function [-Wmaybe-uninitialized]
6984 | if (__pyx_t_2) {
| ^
src/gvar/_utilities.c:6532:12: note: β__pyx_v_iderβ was declared here
6532 | npy_intp __pyx_v_ider;
| ^~~~~~~~~~~~
gcc -pthread -shared build/temp.linux-x86_64-3.7/src/gvar/_utilities.o -L/usr/lib64 -lpython3.7m -o build/lib.linux-x86_64-3.7/gvar/_utilities.cpython-37m-x86_64-linux-gnu.so
building 'gvar.dataset' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I/usr/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c src/gvar/dataset.c -o build/temp.linux-x86_64-3.7/src/gvar/dataset.o
In file included from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/lib64/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from src/gvar/dataset.c:610:
/usr/lib64/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
gcc -pthread -shared build/temp.linux-x86_64-3.7/src/gvar/dataset.o -L/usr/lib64 -lpython3.7m -o build/lib.linux-x86_64-3.7/gvar/dataset.cpython-37m-x86_64-linux-gnu.so
building 'gvar._bufferdict' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -DOPENSSL_LOAD_CONF -fwrapv -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I/usr/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c src/gvar/_bufferdict.c -o build/temp.linux-x86_64-3.7/src/gvar/_bufferdict.o
gcc -pthread -shared build/temp.linux-x86_64-3.7/src/gvar/_bufferdict.o -L/usr/lib64 -lpython3.7m -o build/lib.linux-x86_64-3.7/gvar/_bufferdict.cpython-37m-x86_64-linux-gnu.so
running install_lib
creating /usr/lib64/python3.7/site-packages/gvar
error: could not create '/usr/lib64/python3.7/site-packages/gvar': Permission denied
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lbr2omm5/gvar/setup.py'"'"'; file='"'"'/tmp/pip-install-lbr2omm5/gvar/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-yz76nlx9/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Hi, I am new to the library and struggling with some issues.
I have the following code:
integ = vegas.Integrator(ndims * [[0, 1]], beta=0.75, alpha=0.5)
for _ in range(epochs):
current_result = integ(integrand, nitn=nitn, neval=neval)
vegas_means.append(current_result.mean)
vegas_stddevs.append(current_result.sdev)
where my integrand is the following:
class TestFunctions:
def __init__(self, ndims, w, c):
self.ndims = ndims
self.c = c
self.w = w
def cosine(self, x):
return np.cos(2 * np.pi * self.w[None, 0] + (self.c * x).sum(-1))
However, not sure what I am doing wrong, I get the following error:
AttributeError: 'RAvgArray' object has no attribute 'sdev'
However, this error goes away if I use a different integrand function (gaussian for example).
Any idea of why this happens and how to fix it?
Hello @gplepage ,
I have encountered the following issue when pip installing vegas
for python2.7 and python3.6: When compiling src/vegas/_vegas.c
I receive the error message
src/vegas/_vegas.c:538:10: fatal error: 'numpy/arrayobject.h' file not found
#include "numpy/arrayobject.h"
Numpy (1.13.3) and Cython (0.27.3) are installed. The compiler includes -I/usr/local/include
but not my numpy.get_include()
. Fixing ext_modules = cythonize('src/vegas/_vegas.pyx')
to
ext_modules = cythonize('src/vegas/_vegas.pyx')
ext_modules[0].include_dirs += include_dirs
resolved my issues.
Thank you for providing the vegas
package and best regards,
Christopher KΓΆrber
Now that the option max_nhcube=1
is taken into account thanks to v4.0.3, it seems to create a new issue as far as I understand.
Using the example from the VEGAS tutorial,
import vegas
import math
def f(x):
dx2 = 0
for d in range(4):
dx2 += (x[d] - 0.5) ** 2
return math.exp(-dx2 * 100.) * 1013.2118364296088
integ = vegas.Integrator([[-1, 1], [0, 1], [0, 1], [0, 1]], max_nhcube=1)
I get the following error:
IndexError Traceback (most recent call last)
<ipython-input-18-7a7d6e695d03> in <module>
10 integ = vegas.Integrator([[-1, 1], [0, 1], [0, 1], [0, 1]], max_nhcube=1)
11
---> 12 result = integ(f, nitn=10, neval=1000)
_vegas.pyx in random_batch()
IndexError: Out of bounds on buffer access (axis 0)
Is this indeed a bug or am I misusing the option?
When I run the exsample code with Vegas 4.0.0,
`import vegas
import math
def f(x):
dx2 = 0
for d in range(4):
dx2 += (x[d] - 0.5) ** 2
return math.exp(-dx2 * 100.) * 1013.2118364296088
integ = vegas.Integrator([[-1, 1], [0, 1], [0, 1], [0, 1]])
result = integ(f, nitn=10, neval=1000)
print(result.summary())
print('result = %s Q = %.2f' % (result, result.Q))`
I got the mismatch error:
`Traceback`` (most recent call last):
File "C:\Users\GaoyuanZhang.spyder-py3\temp.py", line 16, in
integ = vegas.Integrator([[-1, 1], [0, 1], [0, 1], [0, 1]])
File "_vegas.pyx", line 1006, in vegas._vegas.Integrator.init
File "_vegas.pyx", line 126, in vegas._vegas.AdaptiveMap.init
ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'`
When I use the Version 3.5.4, the output is right. Maybe there are errors in the Version 4.0.0
I know we could access the weight used in a calculation by calling the random
method, however, in the calculation I am doing, some input can produce unphysical values and the function will return zero for those values. For example
def sigma(x):
pt = 54.5
w = pt * x[0]
v = pt * x[1]
if w < 3.0 or v > 51.0:
return 0.0
else:
return w * v
In this case, not all the weight values produced by the random
method are being used in the actual calculation. It is hard to pick out the weight from random
that are being used in the calculation. Therefore I would suggest to add the feature such that user could print weight along with calculation, like the following
def sigma(x):
pt = 54.5
w = pt * x[0]
v = pt * x[1]
if w < 3.0 or v > 51.0:
return 0.0
else:
print weight
return w * v
Hi,
Sorry for posting a second issue on this wonderful library, but here I am with my pathological integrand.
I am performing a 4 dimensional integral with a lot of evaluation, and I have to minimize memory usage. Hence I activate the minimize_mem=True
option when initializing the integrator. However, I still obtain the following error:
Traceback (most recent call last):
File "/home/{hidden}.py", line 606, in <module>
gw_spectrum(
File "/home/{hidden}.py", line 534, in gw_spectrum
integ(integrand, nitn=10, neval=neval)
File "_vegas.pyx", line 1546, in vegas._vegas.Integrator.__call__
File "_vegas.pyx", line 1339, in random_batch
numpy.core._exceptions.MemoryError: Unable to allocate 215. GiB for an array with shape (7203260000, 4) and data type float64
I was able to reproduce the error with the following minimal version of my code and trace memory usage
import numpy as np
import tracemalloc
import sys
import vegas
@vegas.batchintegrand
def integrand(vegas_vector):
v_1, v_2, v_3, v_4 = (
vegas_vector[:, 0],
vegas_vector[:, 1],
vegas_vector[:, 2],
vegas_vector[:, 3],
)
return np.cos(v_1) * np.exp(-(v_2 ** 2)) * v_3 ** 3 / (1 + v_3) ** 5
if __name__ == "__main__":
tracemalloc.start()
integ = vegas.Integrator(
[
[1, 2],
[0, 10000],
[0, 10000],
[0, 10000],
],
mpi=False,
minimize_mem=True,
)
# First train the integrator and throw away the results
integ(integrand, nitn=10, neval=100)
# Second run the trained integrator
integ(integrand, nitn=10, neval=100)
current, peak = tracemalloc.get_traced_memory()
print(
f"Current memory usage is {current / 10**6}MB; Peak was {peak / 10**6}MB"
)
tracemalloc.stop()
Most of the time, the memory usage is constant, but once in a while (roughly one out of 10), the memory usage diverges. Here is my output
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 32.186484MB; Peak was 57.916624MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.279412MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.280292MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.276564MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.276596MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.276708MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.278452MB; Peak was 3.026508MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.28106MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 2.310756MB; Peak was 4.135084MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.2953MB; Peak was 0.70384MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 25.03898MB; Peak was 45.051368MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.276564MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.278452MB; Peak was 79.4753MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.280324MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.278404MB; Peak was 0.605492MB
[username@machine Bureau]$ python minimal_example.py
Current memory usage is 0.280372MB; Peak was 317.985612MB
It even crashed my computer once or twice during these tests. This happened on at least two different Linux machines. Can you reproduce this error ? And do you know any workaround ?
Perhaps this is a pathalogical example but I'm trying to integrate a function over a large domain.
I want to integrate many thousands of functions (with different parameters) and sometimes the important area of the function is very small or very large. Therefore, I use the adapt_to_samples
to give the integrator a reasonable shot at finding that area.
However, I get ZeroDivisionError: float division
every time for one of these functions (with a small spike)
vegas.__version__ == 4.0.1
Traceback (most recent call last):
File "/home/ppzscr/star-forming/integrator.py", line 100, in <module>
r = integrator.integrate(nadapt=1e5, alpha=0.5)
File "/home/ppzscr/star-forming/integrator.py", line 84, in integrate
self.adaptive_map.adapt_to_samples(self._samples, func(self._samples), nitn=nadapt) # precondition map
File "_vegas.pyx", line 736, in vegas._vegas.AdaptiveMap.adapt_to_samples
File "_vegas.pyx", line 555, in vegas._vegas.AdaptiveMap.adapt
ZeroDivisionError: float division
Process finished with exit code 1
The entire code is here:
from sklearn.mixture import GaussianMixture
import vegas
from astropy.cosmology import Planck15
import numpy as np
from scipy import stats
class Integrator:
def __init__(self, logm_observed, logm_error, f_observed, f_error, z_observed, z_error,
mu, V,
logl_range, logm_range,
z_range=(0., 1.), zpoints=1000, n_adapt_samples=1000,
zdeg=2, cosmo=Planck15, alpha=-0.71):
self.f_observed = f_observed
self.f_error = f_error
self.z_observed = z_observed
self.z_error = z_error
self.logm_observed = logm_observed
self.logm_error = logm_error
self.mu = mu
self.V = V
self.gaussian_component = stats.multivariate_normal(mu, V)
self.z_range = z_range
self.alpha = alpha
_zs = np.linspace(*z_range, num=zpoints)
_dls = cosmo.luminosity_distance(_zs)
self.dl_params = np.polyfit(_zs, Planck15.luminosity_distance(_zs), zdeg)
self.logm_range = logm_range
self.logl_range = logl_range
self.adaptive_map = vegas.AdaptiveMap([logm_range, logl_range, z_range]) # uniform map
self.logm_dist = stats.norm(self.logm_observed, self.logm_error)
self.f_dist = stats.norm(self.f_observed, self.f_error)
self.z_dist = stats.norm(self.z_observed, self.z_error)
self._samples = self.generate_map_samples(n_adapt_samples)
def dl(self, z):
return np.polyval(self.dl_params, z)
def logl_to_f(self, logl, z):
return np.exp(logl - np.log(4 * np.pi) - (2 * np.log(self.dl(z))) + ((1 + self.alpha) * np.log(1 + z)))
def f_to_logl(self, f, z):
return np.log(f * 4 * np.pi) + (np.log(self.dl(z))*2) - ((1 + self.alpha) * np.log(1 + z))
def invdetjacobian(self, f, z):
"""
The jacobian for the transform `P(f,z | vL, vz) -> P(log[L], z | vL, vz)` is
[[1/f, dL/dz],
[0, 1]]
1 / abs(determinant) = f
"""
return f
def logprob_observed_given_true(self, true_m, true_logl, true_z):
true_f = self.logl_to_f(true_logl, true_z)
logl_part = self.f_dist.logpdf(true_f) - np.log(self.invdetjacobian(true_f, true_z))
z_part = self.z_dist.logpdf(true_z)
m_part = self.logm_dist.logpdf(true_m)
return logl_part + z_part + m_part
def logprob_gaussian_component(self, true_mlogl):
return self.gaussian_component.logpdf(true_mlogl)
def integrand(self, x):
return np.exp(self.logprob_observed_given_true(x[:, 0], x[:, 1], x[:, 2]) +
self.logprob_gaussian_component(x[:, :2]))
def sample_true_given_observed(self, n):
zs = self.z_dist.rvs(n)
fs = self.f_dist.rvs(n)
logms = self.logm_dist.rvs(n)
logls = self.f_to_logl(fs, zs)
r = np.stack([logms, logls, zs]).T
return r[np.isnan(r).all(axis=1)]
def generate_map_samples(self, n):
comp_samples = np.concatenate([self.gaussian_component.rvs(n), self.z_dist.rvs((n, 1))], axis=1)
samples = np.concatenate([self.sample_true_given_observed(n), comp_samples])
gmm = GaussianMixture(1).fit(samples)
return np.concatenate([samples, gmm.sample(n)[0]])
def integrate(self, neval=1e5, nitn=10, nadapt=10, alpha=0.1):
func = vegas.batchintegrand(self.integrand)
self.adaptive_map.adapt_to_samples(self._samples, func(self._samples), nitn=nadapt) # precondition map
integ = vegas.Integrator(self.adaptive_map, alpha=alpha)
return integ(func, neval=neval, nitn=nitn)
def plot_result(self, r):
import matplotlib.pyplot as plt
plt.errorbar(np.arange(len(r.itn_results)), *zip(*[(i.mean, i.sdev) for i in r.itn_results]))
plt.axhspan(r.mean - r.sdev, r.mean + r.sdev, alpha=0.2)
if __name__ == '__main__':
mu = [11, 20.8]
cov = np.eye(2) * 0.1
f, ferr, z, zerr = 0, 1e-4, 0.085, 0.0001
m, merr = 11, 0.1
integrator = Integrator(m, merr, f, ferr, z, zerr, mu, cov, [0, 50], [0, 50])
r = integrator.integrate()
print('result = %s Q = %.2f' % (r, r.Q))
print(r.summary())
There are many adaption samples which have a value of 0 but vegas should integrate anyway, right?
Hi, I'm trying to install vegas
with pip
but I have some issues.
I attach the full output in a pdf file: output.pdf.
I think the error is:
error: subprocess-exited-with-error
Γ python setup.py bdist_wheel did not run successfully.
and then ERROR: Failed building wheel for vegas
.
I get also the error:
x86_64-linux-gnu-gcc: fatal error: cannot execute βasβ: execvp: No such file or directory
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
Can someone help me?
Same errors occur if I try to install gvar
only.
Thank you
Hi,
I'm trying to run the multiprocessing example from the vegas docs.
Following the docs, I removed the nproc keyword from the integrator and put this code in a file but when I run it from the command line with mpirun I get the following error. If I set sync_ran=False
and do mpirun then I do not get an error.
Traceback (most recent call last):
File "/scratch/cosmo/mpitest.py", line 22, in <module>
main()
File "/scratch/cosmo/mpitest.py", line 16, in main
integ(ridge, nitn=10, neval=1e4)
File "src/vegas/_vegas.pyx", line 1888, in vegas._vegas.Integrator.__call__
File "src/vegas/_vegas.pyx", line 1750, in vegas._vegas.Integrator.synchronize_random
TypeError: ranseed() got an unexpected keyword argument 'defaultsize'
Looks like gvar.ranseed which gets called in synchronize_random takes 'size' as the argument rather than 'defaultsize' which might be the issue here.
While I was able to use parallelintegrand from the tutorial to speedup point-generation for adapt_to_samples, the adapt_to_samples function is very slow (compared to my very expensive integrand, a some thousands symbol numba compiled sympy expression) .
I could not debug into the function, to get more information, sorry.
I do have about 200 dimensions and generate 200 000 - 2 000 000 points for adaption. Any idea to speed this up?
Thanks Detlef
Hi,
I'm trying to make a code to use vegas batch to integrate the function of interpolation.
Below is my code:
pinterpolation11 = interpolate.RegularGridInterpolator((list1,list2,list3,list4,list5),ptable11,'linear',fill_value=None)
@vegas.batchintegrand
def f(x):
aaaa=pinterpolation11([[r_np.cos(x[:,0].T),r_np.sin(x[:,0].T),x[:,1].T,x[:,2].T,x[:,3].T]])
return aaaa
integ = vegas.Integrator([[0.0,2_pi],[0.0,zf],[-3.0_CapitalDelta,3.0_CapitalDelta],[0.1_v0star,2.9*v0star]], nhcube_batch=1000)
result = integ(f, nitn=10, neval=1000)
a1=result.mean
print(result.summary())
print('result = %s Q = %.2f' % (result, result.Q))
But it doesn't work, the error information is:
ValueError: The requested sample points xi have dimension 5, but this RegularGridInterpolator has dimension 5
I guess the reason is interpolation function is already an tuple operation function.
Below is an example, the augment is tuple and it returns tuple.
aaa=pinterpolation11([[0.1,0.1,1,CapitalDelta_1,2_v0star],[0.1,0.1,0.7,CapitalDelta_1,2_v0star],[0.12,0.1,0.7,CapitalDelta_1.1,2.1_v0star],[0.1,0.1,1.2,CapitalDelta_1,2_v0star]])
How should I solve this problem?
Thank you very much!
XIn
I get into problems, if I integrate functions simultaneously, which have very different function values:
import vegas
integrator = vegas.Integrator([[0, 1], [0, 1]])
def f(x):
return [1,1e60]
result = integrator(f, nitn=10, neval=1000)
print(result.summary())
print(result)
gives the following output:
itn integral wgt average chi2/dof Q
--------------------------------------------------------
1 1.0000000000(15) 0(0) 0.00 1.00
2 1.0000000000(18) 0(0) nan nan
3 1.0000000000(22) 0(0) nan nan
4 1.0000000000(22) 0(0) nan nan
5 1.0000000000(21) 0(0) nan nan
6 1.0000000000(21) 0(0) nan nan
7 1.0000000000(20) 0(0) nan nan
8 1.0000000000(20) 0(0) nan nan
9 1.0000000000(22) 0(0) nan nan
10 1.0000000000(22) 0(0) nan nan
[0(0) 1.00000000000(63)e+60]
Any idea, what is happening here?
May I ask how to evaluate an integral like
I have looked through the documents but did not find any examples like this.
Thank you very much
Thanks for Vegas, it is very helpful. I had a recent issue: Vegas compiles with Python 0.29.34. I updated to Cython3.0 and Vegas no longer installed. Here are the errors:
warning: src/vegas/_vegas.pyx:647:38: Index should be typed for more efficient access
Error compiling Cython file:
------------------------------------------------------------
...
d = int(
(numpy.log((1 - neval_frac) * self.neval / 2.) - self.dim * numpy.log(ns))
/ numpy.log(1 + 1. / ns)
)
if ((ns + 1)**d * ns**(self.dim-d)) > self.max_nhcube and not self.minimize_mem:
ns = int(self.max_nhcube ** (1. / self.dim))
^
------------------------------------------------------------
src/vegas/_vegas.pyx:1262:29: Cannot assign type 'npy_intp' to 'soft double complex'
Error compiling Cython file:
------------------------------------------------------------
...
d = int(
(numpy.log((1 - neval_frac) * self.neval / 2.) - self.dim * numpy.log(ns))
/ numpy.log(1 + 1. / ns)
)
if ((ns + 1)**d * ns**(self.dim-d)) > self.max_nhcube and not self.minimize_mem:
ns = int(self.max_nhcube ** (1. / self.dim))
^
------------------------------------------------------------
src/vegas/_vegas.pyx:1262:29: Cannot assign type 'npy_intp' to 'soft double complex'
Compiling src/vegas/_vegas.pyx because it changed.
I encountered the following problem with the mean method of RAvgArray:
import vegas
import numpy
f = lambda x: numpy.array([numpy.dot(x,x), numpy.dot(x,x)**2])
integ = vegas.Integrator([[0.0, 1.0]])
result = integ(f, neval=100, nitn=3)
result.mean(0)
Traceback (most recent call last):
File "", line 1, in
File "/mt/home/wiebusch/thdmfit2/env/local/lib/python2.7/site-packages/numpy/core/_methods.py", line 62, in _mean
ret = um.add.reduce(arr, axis=axis, dtype=dtype, out=out, keepdims=keepdims)
File "_vegas.pyx", line 118, in vegas._vegas.GVar.add (src/vegas/_vegas.c:4340)
TypeError: a float is required
I ran the tests, however I received some errors with mismatching types. Could you please help? The full output is below.
Traceback (most recent call last):
File "c:\vegas-master\tests\test_vegas.py", line 300, in test_ravgarray_unwgtd
for ri in r:
File "_utilities.pyx", line 2362, in raniter
File "_utilities.pyx", line 2933, in gvar._utilities.regulate
File "_utilities.pyx", line 3217, in gvar._utilities.svd
ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'
Traceback (most recent call last):
File "c:\vegas-master\tests\test_vegas.py", line 281, in test_ravgarray_wgtd
for rb, rs in zip(rbig, rsmall):
File "_utilities.pyx", line 2362, in raniter
File "_utilities.pyx", line 2933, in gvar._utilities.regulate
File "_utilities.pyx", line 3217, in gvar._utilities.svd
ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'
Traceback (most recent call last):
File "c:\vegas-master\tests\test_vegas.py", line 372, in test_ravgdict_unwgtd
for ri in r_a:
File "_utilities.pyx", line 2362, in raniter
File "_utilities.pyx", line 2933, in gvar._utilities.regulate
File "_utilities.pyx", line 3217, in gvar._utilities.svd
ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'
Traceback (most recent call last):
File "c:\vegas-master\tests\test_vegas.py", line 407, in test_ravgdict_wgtd
for rb, rw in zip(rbig_a, rsmall_a):
File "_utilities.pyx", line 2362, in raniter
File "_utilities.pyx", line 2933, in gvar._utilities.regulate
File "_utilities.pyx", line 3217, in gvar._utilities.svd
ValueError: Buffer dtype mismatch, expected 'npy_intp' but got 'long'
Ran 51 tests in 2.448s
FAILED (errors=4)
Hello,
First, let me thank the maintainers for this wonderful module!
I am encountering an issue when evaluating a 4-dimensional, quickly oscillating integral. Unfortunately I cannot share the source code, but here are the characteristics and the error message.
Usually everything works perfectly, but from time to time I receive the following error
File "_vegas.pyx", line 1622, in vegas._vegas.Integrator.__call__
File "_vegas.pyx", line 496, in vegas._vegas.AdaptiveMap.adapt
ZeroDivisionError: float division
From the error message, I suspect that there is a bug in _vegas.pyx
(or a non-documented feature) in the function adapt()
of the adaptative map.
Here it an extract of the source code, from l. 479 to 496
if self.sum_f is not None and alpha != 0:
for i in range(old_ninc):
avg_f[i] = self.sum_f[d, i] / self.n_f[d, i]
if alpha > 0 and old_ninc > 1:
tmp_f[0] = (7. * avg_f[0] + avg_f[1]) / 8.
tmp_f[-1] = (7. * avg_f[-1] + avg_f[-2]) / 8.
sum_f = tmp_f[0] + tmp_f[-1]
for i in range(1, old_ninc - 1):
tmp_f[i] = (6. * avg_f[i] + avg_f[i-1] + avg_f[i+1]) / 8.
sum_f += tmp_f[i]
if sum_f > 0:
for i in range(old_ninc):
avg_f[i] = tmp_f[i] / sum_f + TINY
else:
for i in range(old_ninc):
avg_f[i] = TINY
for i in range(old_ninc):
avg_f[i] = (-(1 - avg_f[i]) / log(avg_f[i])) ** alpha
It looks like avg_f[i]
is equal to 1 for one value of i
. I don't know how it is possible, and it is maybe a pathological behavior due to my integrand, but you might be interested in this.
Python version = 3.9.2
Vegas version = 3.5.3
Hi,
I tried using vegas as a RNG without stratified sampling by setting max_nhcube=1
as indicated in the docs, however multiple hypercubes seem to be generated still.
integ = vegas.Integrator([[0,1]]*2, max_nhcube=1)
x,wx,hc = next(integ.random_batch(yield_hcube=True))
np.unique(hc)
# Returns: array([0, 1, 2, 3])
Am I misunderstanding how this option is supposed to work?
NB: setting nstrat=[1]*d
does work however
Hi,
first: thanks for this great piece of software!
Upgrading to numpy 2.0.0 I get the following error message upon import:
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
I'm relatively sure that it has to do with numpy2 since I can also reproduce it in a clean docker container:
## docker run -ti --rm python sh
# pip install -q vegas
# python -c "import vegas"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.12/site-packages/vegas/__init__.py", line 60, in <module>
from ._vegas import RAvg, RAvgArray, RAvgDict
File "src/vegas/_vegas.pyx", line 1, in init vegas._vegas
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
I also tried to fix it by first installing numpy2 and then build vegas from source - no luck. I guess it has to do with the API changes in numpy?
Using numpy==1.26.4
in vegas' setup.cfg fixed the issue for me but for people on numpy>2 doing pip install vegas
is broken...
I noticed that the actual number of integrand evaluations per iteration is different from what's specified in the neval parameter. It usually seems to be about one half of that, but sometimes it's even less. The code below prints only 4001 evaluations. The same thing happens when the random() iterator is used. As I am using vegas to fill histograms it would be nice to have better control over the number of sample points generated. (Of course I can count them myself, but it would be nice if vegas does it for me.)
import vegas
import math
count = 0
def f(x):
global count
count = count + 1
return 1.0
integ = vegas.Integrator([[0, 1]])
result = integ(f, nitn=1, neval=10000)
print count
Hi, I've recently updated to vegas 5.4 and I found a problem. I don't know if this is a bug or if I'm doing something the wrong way, but after getting the result of an integral and rescaling it, the attribute _rescale is not defined and therefore the _chi2 method doesn't work.
The problem is the following:
import vegas # vegas 5.4
def f(x):
return x
integ = vegas.Integrator([[0, 1]])
result = integ(f)
rescaled_result = 2 * result
result.chi2 # This works fine
rescaled_result.chi2 # This raises an AttributeError: 'RAvgArray' object has no attribute '_rescale'
I've checked, and the problem is new to version 5.4 (at least, I cannot reproduce it with vegas 5.3). Also, from the source code, I guess the same problem will probably arise for RAvg and RAvgDict objects, but I didn't check it.
As I've said, I don't know if this is a bug or simply that I am not supposed to multiply RAvgArray objects by scalars.
Hi,
If I try to integrate a complex function such as f(x) = (1+i)x
then I get a ComplexWarning: Casting complex values to real discards the imaginary part
. This gives a completely wrong answer.
Is it possible to use a complex integrand without casting it to real?
Thanks.
When I try to install vegas (using Linux Mint 20.2) with 'pip install --no-chache -v vegas' I get the following error:
Using pip 21.2.4 from /home/user/anaconda3/envs/venv/lib/python3.9/site-packages/pip (python 3.9)
Collecting vegas
Downloading vegas-5.0.1.tar.gz (1.2 MB)
|ββββββββββββββββββββββββββββββββ| 1.2 MB 777 kB/s
Running command python setup.py egg_info
running egg_info
creating /tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info
writing /tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'COPYING'
warning: no previously-included files found matching 'examples/.tmp'
warning: no previously-included files found matching 'examples/.pyc'
warning: no previously-included files found matching 'examples/.so'
warning: no previously-included files found matching 'examples/.pyxbldc'
warning: no previously-included files found matching 'tests/.pyc'
warning: no previously-included files matching '' found under directory 'tests/pycache'
warning: no previously-included files matching '' found under directory 'doc/source/_build'
writing manifest file '/tmp/pip-pip-egg-info-3na_mn_a/vegas.egg-info/SOURCES.txt'
Requirement already satisfied: numpy>=1.7 in /home/user/anaconda3/envs/venv/lib/python3.9/site-packages (from vegas) (1.20.3)
Collecting gvar>=8.0
Downloading gvar-11.9.5.tar.gz (1.8 MB)
|ββββββββββββββββββββββββββββββββ| 1.8 MB 3.3 MB/s
Running command python setup.py egg_info
running egg_info
creating /tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info
writing /tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'src/.pyx'
warning: no previously-included files found matching 'tests/.pyc'
warning: no previously-included files found matching 'examples/.pyc'
warning: no previously-included files found matching 'examples/.tmp'
warning: no previously-included files matching '' found under directory 'tests/pycache'
warning: no previously-included files matching '' found under directory 'doc/source/_build'
adding license file 'LICENSE.txt'
writing manifest file '/tmp/pip-pip-egg-info-6q8061wj/gvar.egg-info/SOURCES.txt'
Requirement already satisfied: scipy in /home/user/anaconda3/envs/venv/lib/python3.9/site-packages (from gvar>=8.0->vegas) (1.7.1)
Building wheels for collected packages: vegas, gvar
Running command /home/user/anaconda3/envs/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ehjvan81/vegas_c55418dba08748359afe0569b33ae1d1/setup.py'"'"'; file='"'"'/tmp/pip-install-ehjvan81/vegas_c55418dba08748359afe0569b33ae1d1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-38f11hm8
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/vegas
copying src/vegas/init.py -> build/lib.linux-x86_64-3.9/vegas
copying src/vegas/_version.py -> build/lib.linux-x86_64-3.9/vegas
copying src/vegas/../vegas.pxd -> build/lib.linux-x86_64-3.9/vegas/..
copying src/vegas/_vegas.pxd -> build/lib.linux-x86_64-3.9/vegas
running build_ext
building 'vegas._vegas' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/src
creating build/temp.linux-x86_64-3.9/src/vegas
gcc -pthread -B /home/user/anaconda3/envs/venv/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/user/anaconda3/envs/venv/include -I/home/user/anaconda3/envs/venv/include -fPIC -O2 -isystem /home/user/anaconda3/envs/venv/include -fPIC -I/home/user/anaconda3/envs/venv/lib/python3.9/site-packages/numpy/core/include -I/home/user/anaconda3/envs/venv/include/python3.9 -c src/vegas/_vegas.c -o build/temp.linux-x86_64-3.9/src/vegas/_vegas.o
In file included from /usr/lib/gcc/x86_64-linux-gnu/9/include/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:34,
from /home/user/anaconda3/envs/venv/include/python3.9/Python.h:11,
from src/vegas/_vegas.c:6:
/usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:194:15: fatal error: limits.h: No such file or directory
194 | #include_next <limits.h> / recurse down to the real one /
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
Building wheel for vegas (setup.py) ... error
ERROR: Failed building wheel for vegas
Running setup.py clean for vegas
Running command /home/user/anaconda3/envs/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ehjvan81/vegas_c55418dba08748359afe0569b33ae1d1/setup.py'"'"'; file='"'"'/tmp/pip-install-ehjvan81/vegas_c55418dba08748359afe0569b33ae1d1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all
running clean
removing 'build/temp.linux-x86_64-3.9' (and everything under it)
removing 'build/lib.linux-x86_64-3.9' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.9' does not exist -- can't clean it
removing 'build'
Running command /home/user/anaconda3/envs/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"'; file='"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-7r2uf718
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/gvar
copying src/gvar/linalg.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/ode.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/init.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/pade.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/cspline.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/root.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/powerseries.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/../gvar.pxd -> build/lib.linux-x86_64-3.9/gvar/..
copying src/gvar/_svec_smat.pxd -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/_gvarcore.pxd -> build/lib.linux-x86_64-3.9/gvar
running build_ext
building 'gvar._gvarcore' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/src
creating build/temp.linux-x86_64-3.9/src/gvar
gcc -pthread -B /home/user/anaconda3/envs/venv/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/user/anaconda3/envs/venv/include -I/home/user/anaconda3/envs/venv/include -fPIC -O2 -isystem /home/user/anaconda3/envs/venv/include -fPIC -I/home/user/anaconda3/envs/venv/lib/python3.9/site-packages/numpy/core/include -I/home/user/anaconda3/envs/venv/include/python3.9 -c src/gvar/_gvarcore.c -o build/temp.linux-x86_64-3.9/src/gvar/_gvarcore.o
In file included from /usr/lib/gcc/x86_64-linux-gnu/9/include/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:34,
from /home/user/anaconda3/envs/venv/include/python3.9/Python.h:11,
from src/gvar/_gvarcore.c:6:
/usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:194:15: fatal error: limits.h: No such file or directory
194 | #include_next <limits.h> / recurse down to the real one /
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
Building wheel for gvar (setup.py) ... error
ERROR: Failed building wheel for gvar
Running setup.py clean for gvar
Running command /home/user/anaconda3/envs/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"'; file='"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all
running clean
removing 'build/temp.linux-x86_64-3.9' (and everything under it)
removing 'build/lib.linux-x86_64-3.9' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.9' does not exist -- can't clean it
removing 'build'
Failed to build vegas gvar
Installing collected packages: gvar, vegas
Running command /home/user/anaconda3/envs/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"'; file='"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ufmdgasp/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/anaconda3/envs/venv/include/python3.9/gvar
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/gvar
copying src/gvar/linalg.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/ode.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/init.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/pade.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/cspline.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/root.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/powerseries.py -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/../gvar.pxd -> build/lib.linux-x86_64-3.9/gvar/..
copying src/gvar/_svec_smat.pxd -> build/lib.linux-x86_64-3.9/gvar
copying src/gvar/_gvarcore.pxd -> build/lib.linux-x86_64-3.9/gvar
running build_ext
building 'gvar._gvarcore' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/src
creating build/temp.linux-x86_64-3.9/src/gvar
gcc -pthread -B /home/user/anaconda3/envs/venv/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/user/anaconda3/envs/venv/include -I/home/user/anaconda3/envs/venv/include -fPIC -O2 -isystem /home/user/anaconda3/envs/venv/include -fPIC -I/home/user/anaconda3/envs/venv/lib/python3.9/site-packages/numpy/core/include -I/home/user/anaconda3/envs/venv/include/python3.9 -c src/gvar/_gvarcore.c -o build/temp.linux-x86_64-3.9/src/gvar/_gvarcore.o
In file included from /usr/lib/gcc/x86_64-linux-gnu/9/include/syslimits.h:7,
from /usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:34,
from /home/user/anaconda3/envs/venv/include/python3.9/Python.h:11,
from src/gvar/_gvarcore.c:6:
/usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:194:15: fatal error: limits.h: No such file or directory
194 | #include_next <limits.h> / recurse down to the real one */
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
Running setup.py install for gvar ... error
ERROR: Command errored out with exit status 1: /home/user/anaconda3/envs/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"'; file='"'"'/tmp/pip-install-ehjvan81/gvar_7d3f51341695464199c96ea68f2fffbe/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ufmdgasp/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/anaconda3/envs/venv/include/python3.9/gvar Check the logs for full command output.
The only error I understand is the line:
/usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h:194:15: fatal error: limits.h: No such file or directory
But this file does exist in my computer.
[C:\temp\vegas]$ git rev-parse HEAD
be2ceb9a7d85a7e39dbe8c9a98292a89e0fc900d
[C:\temp\vegas]$ make run
python simple.py > simple.tmp
diff -w simple.out simple.tmp
python slow.py > slow.tmp # about 20s
diff -w slow.out slow.tmp
python faster.py > faster.tmp
diff -w faster.out faster.tmp
python fastest.py > fastest.tmp
diff -w fastest.out fastest.tmp
python path-integral.py > path-integral.tmp # about 30s
Traceback (most recent call last):
File "path-integral.py", line 110, in <module>
main()
File "path-integral.py", line 66, in main
E0 = - np.log(exp_E0T) / T
AttributeError: log
make: *** [run] Error 1
Platform: Windows 7, 64 bit
Python: Python 2.7.5 [MSC v.1500 32 bit (Intel)] on win32
I've been wrestling with parallelizing a fairly straightforward computation. One strange problem that I have not been able to resolve is that my computation sometimes fails with a ValueError, apparently depending on the number of cores on which I run. I've reproduced this on a couple of different clusters, using mvapich, mvapich2 and openmpi with a couple different python 2.7.x. (I am only trying to run on multiple cores within single nodes on these clusters.)
Here is what I get from a simplified test (included below) using openmpi-1.6.5 and python-2.7.5. This output is especially interesting because (unlike mvapich[2]) openmpi complains about a fork() before spitting out the ValueError:
$ for i in 1 2 4 6 8 ; do echo -ne "$i " ; mpirun -np $i python par_test.py ; done
1 result = 0.241(43) Q = 0.99
2 result = 0.241(43) Q = 0.99
4 result = 0.241(43) Q = 0.99
6 result = 0.241(43) Q = 0.99
8 --------------------------------------------------------------------------
An MPI process has executed an operation involving a call to the
"fork()" system call to create a child process. Open MPI is currently
operating in a condition that could result in memory corruption or
other system errors; your MPI job may hang, crash, or produce silent
data corruption. The use of fork() (or system() or other calls that
create child processes) is strongly discouraged.
The process that invoked fork was:
Local host: [redacted] (PID 30330)
MPI_COMM_WORLD rank: 7
If you are *absolutely sure* that your application will successfully
and correctly survive a call to fork(), you may disable this warning
by setting the mpi_warn_on_fork MCA parameter to 0.
--------------------------------------------------------------------------
Traceback (most recent call last):
File "par_test.py", line 33, in <module>
main()
File "par_test.py", line 26, in main
integ(fparallel, nitn=10, neval=100) # Initial adaptation
File "src/vegas/_vegas.pyx", line 1204, in random_batch (src/vegas/_vegas.c:20590)
File "src/vegas/_vegas.pyx", line 1931, in vegas._vegas.VegasIntegrand.__init__.eval (src/vegas/_vegas.c:35513)
File "src/vegas/_vegas.pyx", line 1998, in vegas._vegas._BatchIntegrand_from_Batch.__call__ (src/vegas/_vegas.c:37623)
File "src/vegas/_vegas.pyx", line 2266, in vegas._vegas.MPIintegrand.__call__ (src/vegas/_vegas.c:41705)
File "src/vegas/_vegas.pyx", line 2253, in vegas._vegas.MPIintegrand.__call__.fcn (src/vegas/_vegas.c:40768)
ValueError: total size of new array must be unchanged
At this point I'm out of ideas and just submitting this to see if anybody else might have any insight. Here is the test I constructed by simplifying the computation I'm interested in running:
#!/usr/bin/python
from __future__ import print_function
import numpy as np
import vegas
# Test parallel evaluation
# Global variables
twopi = 2.0 * np.pi
piSq = np.pi * np.pi
# Function to integrate
def f(p):
num = np.zeros(p.shape[0], dtype = np.float)
denom = np.zeros_like(num)
for i in range(p.shape[0]):
num[i] = np.cos(twopi * (p[i].sum()))
denom[i] = ((np.sin(np.pi * p[i]))**2).sum()
return piSq * num / denom
def main():
integ = vegas.Integrator(4 * [[0.0, 1.0]])
# Convert to MPI integrand
fparallel = vegas.MPIintegrand(f)
integ(fparallel, nitn=10, neval=100) # Initial adaptation
result = integ(fparallel, nitn=10, neval=1000) # Actual estimation
if fparallel.rank == 0:
print("result = %s Q = %.2f" % (result, result.Q))
if __name__ == '__main__':
main()
I am using vegas to calculate an integral together with some distributions. I followed the ideas described in the documentation, but the result I get when doing the integral alone and the result when doing the integral with distributions is slightly lower. This is not a big deal for one distribution, but I am computing several distributions together so, in the end, I am integrating a vector of ~100 components and this effect becomes relevant: the result is ~93% of the original (the error of the integrals is ~0.5%)
I know that the integral should adapt only to the total value (which is the first component), but it seems that the final result depends on the distributions, is there a way to prevent this? If it is not possible, is there an easy way to extract the relevant information (the points where the integral was evaluated and the corresponding weights) to reconstruct the distributions after the integral was computed?
Thank you
I'm computing an integral by running many iterations over several hours and printing a running output that gets more accurate over time. For my problem, I need 10 digits of precision.
In the first few iterations, all the digits of the result are printed:
itn 5: 0.1017802(84)
all itn's: 0.1017806(39)
However, after some number of iterations, the result is rounded to 6 digits before printing, thus making it useless for me:
itn 18795: 0.1017963(83)
all itn's: 0.101779 +- 6e-08
Expected behavior: more digits in the same format, eg: 0.1017791234(56).
Describe the bug
For integrating g(x)=x we get a weird sampling distribution. The most of the integration space remains empty. This is especially stronger, when setting beta=0. Though as far as I understood this value should prevent redistribution and make vegas to sample uniformly over the grid.
In two dimensions this happens also in the default setting.
To Reproduce
https://github.com/jovako/vegas-bug/blob/main/vegas%20bug.ipynb
I am trying to run the example you have in the following link:
https://vegas.readthedocs.io/en/latest/tutorial.html#multiple-processors
However when executing (Windows/Jupyter lab) I get the following error:
AttributeError: Can't get attribute 'ridge' on <module 'main' (built-in)>
I'm not sure what's going on. Can you help me, please?
We are trying to use VEGAS to sample from a distribution "on the fly" i.e. we want to draw single samples rather than compute a large ensemble of samples.
We have found that drawing from integrand.random() seems to give highly correlated samples and have traced this back to looping through hypercubes in random_batch(). We think that what is going on is that each hypercube has correlated kinematic variables. A solution that works (but is very slow for large lists and is the current bottleneck in our project) is to cast the iterable that VEGAS produces into a list, and then randomize the list.
Is there a way to draw a truly random "one off" sample from VEGAS? We had thought about hacking the source code to draw a random hypercube rather than iterating through the list of hypercubes but are worried about biasing our sample if the hypercubes have very different weights.
Thanks in advance,
Ryan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.