Mock Version: 5.0 Mock Version: 5.0 Mock Version: 5.0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'], chrootPath='/var/lib/mock/f40-build-2425952-60598/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1708387200 Wrote: /builddir/build/SRPMS/python-chaospy-4.3.13-1.fc40.src.rpm Child return code was: 0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'], chrootPath='/var/lib/mock/f40-build-2425952-60598/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueraiseExc=FalseprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1708387200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.pJBXOQ + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf chaospy-4.3.13 + /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/chaospy-4.3.13.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd chaospy-4.3.13 + rm -rf /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/mkdir -p /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + rm -rf SPECPARTS + sed -i 's/numpoly.*/numpoly>=1.2.7/' requirements.txt + RPM_EC=0 ++ jobs -p + exit 0 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.57o3Gb + umask 022 + cd /builddir/build/BUILD + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(pip) >= 19' + echo 'python3dist(packaging)' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + echo -n + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + RPM_TOXENV=py312 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir --output /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires -r Handling setuptools>=45 from build-system.requires Requirement not satisfied: setuptools>=45 Exiting dependency generation pass: build backend + cat /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires + rm -rfv '*.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-chaospy-4.3.13-1.fc40.buildreqs.nosrc.rpm Child return code was: 11 Dynamic buildrequires detected Going to install missing buildrequires. See root.log for details. ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'], chrootPath='/var/lib/mock/f40-build-2425952-60598/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueraiseExc=FalseprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1708387200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.OHVYWn + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf chaospy-4.3.13 + /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/chaospy-4.3.13.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd chaospy-4.3.13 + rm -rf /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/mkdir -p /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + rm -rf SPECPARTS + sed -i 's/numpoly.*/numpoly>=1.2.7/' requirements.txt + RPM_EC=0 ++ jobs -p + exit 0 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.odXu7q + umask 022 + cd /builddir/build/BUILD + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(pip) >= 19' + echo 'python3dist(packaging)' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + echo -n + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + RPM_TOXENV=py312 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir --output /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires -r Handling setuptools>=45 from build-system.requires Requirement satisfied: setuptools>=45 (installed: setuptools 68.2.2) running egg_info creating chaospy.egg-info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt writing manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' Handling wheel from get_requires_for_build_wheel Requirement not satisfied: wheel Exiting dependency generation pass: get_requires_for_build_wheel + cat /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires + rm -rfv '*.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-chaospy-4.3.13-1.fc40.buildreqs.nosrc.rpm Child return code was: 11 Dynamic buildrequires detected Going to install missing buildrequires. See root.log for details. ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'], chrootPath='/var/lib/mock/f40-build-2425952-60598/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueraiseExc=FalseprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1708387200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.s2AUaT + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf chaospy-4.3.13 + /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/chaospy-4.3.13.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd chaospy-4.3.13 + rm -rf /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/mkdir -p /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + rm -rf SPECPARTS + sed -i 's/numpoly.*/numpoly>=1.2.7/' requirements.txt + RPM_EC=0 ++ jobs -p + exit 0 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.O0QGi4 + umask 022 + cd /builddir/build/BUILD + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(pip) >= 19' + echo 'python3dist(packaging)' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + echo -n + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + RPM_TOXENV=py312 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir --output /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires -r Handling setuptools>=45 from build-system.requires Requirement satisfied: setuptools>=45 (installed: setuptools 68.2.2) running egg_info creating chaospy.egg-info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt writing manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' Handling wheel from get_requires_for_build_wheel Requirement satisfied: wheel (installed: wheel 0.41.2) running dist_info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' creating '/builddir/build/BUILD/chaospy-4.3.13/chaospy-4.3.13.dist-info' Handling numpy >=1.20 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: numpy >=1.20 (installed: numpy 1.26.0) Handling numpoly >=1.2.5 from hook generated metadata: Requires-Dist (chaospy) Requirement not satisfied: numpoly >=1.2.5 Handling scipy from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: scipy (installed: scipy 1.11.3) Handling setuptools >=40.9.0 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: setuptools >=40.9.0 (installed: setuptools 68.2.2) Handling importlib-metadata from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: importlib-metadata (installed: importlib-metadata 6.9.0) Handling openturns ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: openturns ; extra == 'dev' Handling scikit-learn ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: scikit-learn ; extra == 'dev' Handling gstools ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: gstools ; extra == 'dev' Handling jupyter ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: jupyter ; extra == 'dev' Handling matplotlib ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: matplotlib ; extra == 'dev' Handling nbsphinx ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: nbsphinx ; extra == 'dev' Handling sphinxcontrib-bibtex ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sphinxcontrib-bibtex ; extra == 'dev' Handling black ==22.10.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: black ==22.10.0 ; extra == 'dev' Handling pylint ==2.15.5 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pylint ==2.15.5 ; extra == 'dev' Handling pydocstyle ==3.0.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pydocstyle ==3.0.0 ; extra == 'dev' Handling pydata-sphinx-theme ==0.11.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pydata-sphinx-theme ==0.11.0 ; extra == 'dev' Handling sympy ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sympy ; extra == 'dev' Handling pytest ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pytest ; extra == 'dev' Handling pytest-cov ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pytest-cov ; extra == 'dev' Handling codecov ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: codecov ; extra == 'dev' Handling coverage >=5.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: coverage >=5.0 ; extra == 'dev' Handling Sphinx ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: Sphinx ; extra == 'dev' Handling sphinx-automodapi ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sphinx-automodapi ; extra == 'dev' Handling build ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: build ; extra == 'dev' Handling twine ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: twine ; extra == 'dev' + cat /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires + rm -rfv chaospy-4.3.13.dist-info/ removed 'chaospy-4.3.13.dist-info/LICENSE.txt' removed 'chaospy-4.3.13.dist-info/top_level.txt' removed 'chaospy-4.3.13.dist-info/METADATA' removed directory 'chaospy-4.3.13.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-chaospy-4.3.13-1.fc40.buildreqs.nosrc.rpm Child return code was: 11 Dynamic buildrequires detected Going to install missing buildrequires. See root.log for details. ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'], chrootPath='/var/lib/mock/f40-build-2425952-60598/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueraiseExc=FalseprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -br --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1708387200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.PqmcYD + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf chaospy-4.3.13 + /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/chaospy-4.3.13.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd chaospy-4.3.13 + rm -rf /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/mkdir -p /builddir/build/BUILD/chaospy-4.3.13-SPECPARTS + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + rm -rf SPECPARTS + sed -i 's/numpoly.*/numpoly>=1.2.7/' requirements.txt + RPM_EC=0 ++ jobs -p + exit 0 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.bO14m8 + umask 022 + cd /builddir/build/BUILD + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(pip) >= 19' + echo 'python3dist(packaging)' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + echo -n + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + RPM_TOXENV=py312 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir --output /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires -r Handling setuptools>=45 from build-system.requires Requirement satisfied: setuptools>=45 (installed: setuptools 68.2.2) running egg_info creating chaospy.egg-info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt writing manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' Handling wheel from get_requires_for_build_wheel Requirement satisfied: wheel (installed: wheel 0.41.2) running dist_info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' creating '/builddir/build/BUILD/chaospy-4.3.13/chaospy-4.3.13.dist-info' Handling numpy >=1.20 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: numpy >=1.20 (installed: numpy 1.26.0) Handling numpoly >=1.2.5 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: numpoly >=1.2.5 (installed: numpoly 1.2.11) Handling scipy from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: scipy (installed: scipy 1.11.3) Handling setuptools >=40.9.0 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: setuptools >=40.9.0 (installed: setuptools 68.2.2) Handling importlib-metadata from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: importlib-metadata (installed: importlib-metadata 6.9.0) Handling openturns ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: openturns ; extra == 'dev' Handling scikit-learn ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: scikit-learn ; extra == 'dev' Handling gstools ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: gstools ; extra == 'dev' Handling jupyter ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: jupyter ; extra == 'dev' Handling matplotlib ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: matplotlib ; extra == 'dev' Handling nbsphinx ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: nbsphinx ; extra == 'dev' Handling sphinxcontrib-bibtex ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sphinxcontrib-bibtex ; extra == 'dev' Handling black ==22.10.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: black ==22.10.0 ; extra == 'dev' Handling pylint ==2.15.5 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pylint ==2.15.5 ; extra == 'dev' Handling pydocstyle ==3.0.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pydocstyle ==3.0.0 ; extra == 'dev' Handling pydata-sphinx-theme ==0.11.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pydata-sphinx-theme ==0.11.0 ; extra == 'dev' Handling sympy ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sympy ; extra == 'dev' Handling pytest ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pytest ; extra == 'dev' Handling pytest-cov ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pytest-cov ; extra == 'dev' Handling codecov ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: codecov ; extra == 'dev' Handling coverage >=5.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: coverage >=5.0 ; extra == 'dev' Handling Sphinx ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: Sphinx ; extra == 'dev' Handling sphinx-automodapi ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sphinx-automodapi ; extra == 'dev' Handling build ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: build ; extra == 'dev' Handling twine ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: twine ; extra == 'dev' + cat /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires + rm -rfv chaospy-4.3.13.dist-info/ removed 'chaospy-4.3.13.dist-info/LICENSE.txt' removed 'chaospy-4.3.13.dist-info/top_level.txt' removed 'chaospy-4.3.13.dist-info/METADATA' removed directory 'chaospy-4.3.13.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-chaospy-4.3.13-1.fc40.buildreqs.nosrc.rpm Child return code was: 11 Dynamic buildrequires detected Going to install missing buildrequires. See root.log for details. ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -ba --noprep --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'], chrootPath='/var/lib/mock/f40-build-2425952-60598/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -ba --noprep --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1708387200 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.o24vTX + umask 022 + cd /builddir/build/BUILD + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(pip) >= 19' + echo 'python3dist(packaging)' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + echo -n + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + RPM_TOXENV=py312 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir --output /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires -r Handling setuptools>=45 from build-system.requires Requirement satisfied: setuptools>=45 (installed: setuptools 68.2.2) running egg_info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' Handling wheel from get_requires_for_build_wheel Requirement satisfied: wheel (installed: wheel 0.41.2) running dist_info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' creating '/builddir/build/BUILD/chaospy-4.3.13/chaospy-4.3.13.dist-info' Handling numpy >=1.20 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: numpy >=1.20 (installed: numpy 1.26.0) Handling numpoly >=1.2.5 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: numpoly >=1.2.5 (installed: numpoly 1.2.11) Handling scipy from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: scipy (installed: scipy 1.11.3) Handling setuptools >=40.9.0 from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: setuptools >=40.9.0 (installed: setuptools 68.2.2) Handling importlib-metadata from hook generated metadata: Requires-Dist (chaospy) Requirement satisfied: importlib-metadata (installed: importlib-metadata 6.9.0) Handling openturns ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: openturns ; extra == 'dev' Handling scikit-learn ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: scikit-learn ; extra == 'dev' Handling gstools ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: gstools ; extra == 'dev' Handling jupyter ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: jupyter ; extra == 'dev' Handling matplotlib ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: matplotlib ; extra == 'dev' Handling nbsphinx ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: nbsphinx ; extra == 'dev' Handling sphinxcontrib-bibtex ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sphinxcontrib-bibtex ; extra == 'dev' Handling black ==22.10.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: black ==22.10.0 ; extra == 'dev' Handling pylint ==2.15.5 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pylint ==2.15.5 ; extra == 'dev' Handling pydocstyle ==3.0.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pydocstyle ==3.0.0 ; extra == 'dev' Handling pydata-sphinx-theme ==0.11.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pydata-sphinx-theme ==0.11.0 ; extra == 'dev' Handling sympy ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sympy ; extra == 'dev' Handling pytest ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pytest ; extra == 'dev' Handling pytest-cov ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: pytest-cov ; extra == 'dev' Handling codecov ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: codecov ; extra == 'dev' Handling coverage >=5.0 ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: coverage >=5.0 ; extra == 'dev' Handling Sphinx ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: Sphinx ; extra == 'dev' Handling sphinx-automodapi ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: sphinx-automodapi ; extra == 'dev' Handling build ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: build ; extra == 'dev' Handling twine ; extra == 'dev' from hook generated metadata: Requires-Dist (chaospy) Ignoring alien requirement: twine ; extra == 'dev' + cat /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-buildrequires + rm -rfv chaospy-4.3.13.dist-info/ removed 'chaospy-4.3.13.dist-info/LICENSE.txt' removed 'chaospy-4.3.13.dist-info/top_level.txt' removed 'chaospy-4.3.13.dist-info/METADATA' removed directory 'chaospy-4.3.13.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.3RSEr1 + umask 022 + cd /builddir/build/BUILD + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + mkdir -p /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_wheel.py /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir Processing /builddir/build/BUILD/chaospy-4.3.13 Preparing metadata (pyproject.toml): started Running command Preparing metadata (pyproject.toml) running dist_info creating /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info writing /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/PKG-INFO writing dependency_links to /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/dependency_links.txt writing requirements to /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/requires.txt writing top-level names to /builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/top_level.txt writing manifest file '/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/SOURCES.txt' reading manifest file '/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file '/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy.egg-info/SOURCES.txt' creating '/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-modern-metadata-hzsfkxhr/chaospy-4.3.13.dist-info' Preparing metadata (pyproject.toml): finished with status 'done' Building wheels for collected packages: chaospy Building wheel for chaospy (pyproject.toml): started Running command Building wheel for chaospy (pyproject.toml) running bdist_wheel running build running build_py creating build creating build/lib creating build/lib/chaospy copying chaospy/regression.py -> build/lib/chaospy copying chaospy/spectral.py -> build/lib/chaospy copying chaospy/__init__.py -> build/lib/chaospy copying chaospy/saltelli.py -> build/lib/chaospy creating build/lib/chaospy/expansion copying chaospy/expansion/laguerre.py -> build/lib/chaospy/expansion copying chaospy/expansion/legendre.py -> build/lib/chaospy/expansion copying chaospy/expansion/lagrange.py -> build/lib/chaospy/expansion copying chaospy/expansion/gegenbauer.py -> build/lib/chaospy/expansion copying chaospy/expansion/cholesky.py -> build/lib/chaospy/expansion copying chaospy/expansion/hermite.py -> build/lib/chaospy/expansion copying chaospy/expansion/frontend.py -> build/lib/chaospy/expansion copying chaospy/expansion/gram_schmidt.py -> build/lib/chaospy/expansion copying chaospy/expansion/stieltjes.py -> build/lib/chaospy/expansion copying chaospy/expansion/__init__.py -> build/lib/chaospy/expansion copying chaospy/expansion/jacobi.py -> build/lib/chaospy/expansion copying chaospy/expansion/chebyshev.py -> build/lib/chaospy/expansion creating build/lib/chaospy/recurrence copying chaospy/recurrence/lanczos.py -> build/lib/chaospy/recurrence copying chaospy/recurrence/frontend.py -> build/lib/chaospy/recurrence copying chaospy/recurrence/stieltjes.py -> build/lib/chaospy/recurrence copying chaospy/recurrence/__init__.py -> build/lib/chaospy/recurrence copying chaospy/recurrence/jacobi.py -> build/lib/chaospy/recurrence copying chaospy/recurrence/chebyshev.py -> build/lib/chaospy/recurrence creating build/lib/chaospy/quadrature copying chaospy/quadrature/gaussian.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/laguerre.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/legendre.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/fejer_1.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/leja.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/newton_cotes.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/discrete.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/gegenbauer.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/genz_keister.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/hermite.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/grid.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/kronrod.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/sparse_grid.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/clenshaw_curtis.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/frontend.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/fejer_2.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/__init__.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/jacobi.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/lobatto.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/chebyshev.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/utils.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/radau.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/patterson.py -> build/lib/chaospy/quadrature copying chaospy/quadrature/hypercube.py -> build/lib/chaospy/quadrature creating build/lib/chaospy/distributions copying chaospy/distributions/approximation.py -> build/lib/chaospy/distributions copying chaospy/distributions/__init__.py -> build/lib/chaospy/distributions creating build/lib/chaospy/external copying chaospy/external/scipy_stats.py -> build/lib/chaospy/external copying chaospy/external/openturns_.py -> build/lib/chaospy/external copying chaospy/external/__init__.py -> build/lib/chaospy/external creating build/lib/chaospy/descriptives copying chaospy/descriptives/variance.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/conditional.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/quantity_of_interest.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/covariance.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/kurtosis.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/standard_deviation.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/percentile.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/__init__.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/expected.py -> build/lib/chaospy/descriptives copying chaospy/descriptives/skewness.py -> build/lib/chaospy/descriptives creating build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/power_log_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/mv_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/double_weibull.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/discrete_uniform.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/burr.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/exponential_weibull.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/mv_log_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/log_laplace.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/folded_cauchy.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/mv_student_t.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/wrapped_cauchy.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/log_weibull.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/logistic.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/chi_squared.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/kumaraswamy.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/power_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/double_gamma.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/laplace.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/trunc_exponential.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/generalized_half_logistic.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/levy.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/student_t.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/mielke.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/alpha.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/weibull.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/wald.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/gamma.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/gompertz.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/log_gamma.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/log_uniform.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/generalized_exponential.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/f.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/generalized_extreme.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/exponential_power.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/hyperbolic_secant.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/inverse_gamma.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/triangle.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/frechet.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/beta.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/binomial.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/chi.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/bradford.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/fisk.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/fatigue_life.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/folded_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/reciprocal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/nakagami.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/log_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/__init__.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/pareto2.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/pareto1.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/uniform.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/tukey_lambda.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/trunc_normal.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/cauchy.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/anglit.py -> build/lib/chaospy/distributions/collection copying chaospy/distributions/collection/generalized_gamma.py -> build/lib/chaospy/distributions/collection creating build/lib/chaospy/distributions/kernel copying chaospy/distributions/kernel/gaussian.py -> build/lib/chaospy/distributions/kernel copying chaospy/distributions/kernel/baseclass.py -> build/lib/chaospy/distributions/kernel copying chaospy/distributions/kernel/mixture.py -> build/lib/chaospy/distributions/kernel copying chaospy/distributions/kernel/__init__.py -> build/lib/chaospy/distributions/kernel creating build/lib/chaospy/distributions/sampler copying chaospy/distributions/sampler/generator.py -> build/lib/chaospy/distributions/sampler copying chaospy/distributions/sampler/latin_hypercube.py -> build/lib/chaospy/distributions/sampler copying chaospy/distributions/sampler/antithetic.py -> build/lib/chaospy/distributions/sampler copying chaospy/distributions/sampler/__init__.py -> build/lib/chaospy/distributions/sampler creating build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/archimedean.py -> build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/gumbel.py -> build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/t_copula.py -> build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/nataf.py -> build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/joe.py -> build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/__init__.py -> build/lib/chaospy/distributions/copulas copying chaospy/distributions/copulas/clayton.py -> build/lib/chaospy/distributions/copulas creating build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/copula.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/simple.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/mean_covariance.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/operator.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/slice_.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/__init__.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/user.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/distribution.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/utils.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/lower_upper.py -> build/lib/chaospy/distributions/baseclass copying chaospy/distributions/baseclass/shift_scale.py -> build/lib/chaospy/distributions/baseclass creating build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/negative.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/power.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/logarithm.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/joint.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/iid.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/addition.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/truncation.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/multiply.py -> build/lib/chaospy/distributions/operators copying chaospy/distributions/operators/__init__.py -> build/lib/chaospy/distributions/operators creating build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/van_der_corput.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/additive_recursion.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/grid.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/primes.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/hammersley.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/sobol.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/sobol_constants.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/__init__.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/halton.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/chebyshev.py -> build/lib/chaospy/distributions/sampler/sequences copying chaospy/distributions/sampler/sequences/korobov.py -> build/lib/chaospy/distributions/sampler/sequences creating build/lib/chaospy/descriptives/sensitivity copying chaospy/descriptives/sensitivity/main.py -> build/lib/chaospy/descriptives/sensitivity copying chaospy/descriptives/sensitivity/main2.py -> build/lib/chaospy/descriptives/sensitivity copying chaospy/descriptives/sensitivity/__init__.py -> build/lib/chaospy/descriptives/sensitivity copying chaospy/descriptives/sensitivity/total.py -> build/lib/chaospy/descriptives/sensitivity creating build/lib/chaospy/descriptives/correlation copying chaospy/descriptives/correlation/spearman.py -> build/lib/chaospy/descriptives/correlation copying chaospy/descriptives/correlation/auto_correlation.py -> build/lib/chaospy/descriptives/correlation copying chaospy/descriptives/correlation/__init__.py -> build/lib/chaospy/descriptives/correlation copying chaospy/descriptives/correlation/pearson.py -> build/lib/chaospy/descriptives/correlation running egg_info writing chaospy.egg-info/PKG-INFO writing dependency_links to chaospy.egg-info/dependency_links.txt writing requirements to chaospy.egg-info/requires.txt writing top-level names to chaospy.egg-info/top_level.txt reading manifest file 'chaospy.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*.pyc' found anywhere in distribution adding license file 'LICENSE.txt' writing manifest file 'chaospy.egg-info/SOURCES.txt' installing to build/bdist.linux-riscv64/wheel running install running install_lib creating build/bdist.linux-riscv64 creating build/bdist.linux-riscv64/wheel creating build/bdist.linux-riscv64/wheel/chaospy creating build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/laguerre.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/legendre.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/lagrange.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/gegenbauer.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/cholesky.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/hermite.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/frontend.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/gram_schmidt.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/stieltjes.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/jacobi.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion copying build/lib/chaospy/expansion/chebyshev.py -> build/bdist.linux-riscv64/wheel/chaospy/expansion creating build/bdist.linux-riscv64/wheel/chaospy/recurrence copying build/lib/chaospy/recurrence/lanczos.py -> build/bdist.linux-riscv64/wheel/chaospy/recurrence copying build/lib/chaospy/recurrence/frontend.py -> build/bdist.linux-riscv64/wheel/chaospy/recurrence copying build/lib/chaospy/recurrence/stieltjes.py -> build/bdist.linux-riscv64/wheel/chaospy/recurrence copying build/lib/chaospy/recurrence/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/recurrence copying build/lib/chaospy/recurrence/jacobi.py -> build/bdist.linux-riscv64/wheel/chaospy/recurrence copying build/lib/chaospy/recurrence/chebyshev.py -> build/bdist.linux-riscv64/wheel/chaospy/recurrence creating build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/gaussian.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/laguerre.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/legendre.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/fejer_1.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/leja.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/newton_cotes.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/discrete.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/gegenbauer.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/genz_keister.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/hermite.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/grid.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/kronrod.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/sparse_grid.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/clenshaw_curtis.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/frontend.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/fejer_2.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/jacobi.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/lobatto.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/chebyshev.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/utils.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/radau.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/patterson.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/quadrature/hypercube.py -> build/bdist.linux-riscv64/wheel/chaospy/quadrature copying build/lib/chaospy/regression.py -> build/bdist.linux-riscv64/wheel/chaospy copying build/lib/chaospy/spectral.py -> build/bdist.linux-riscv64/wheel/chaospy creating build/bdist.linux-riscv64/wheel/chaospy/distributions creating build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/power_log_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/mv_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/double_weibull.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/discrete_uniform.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/burr.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/exponential_weibull.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/mv_log_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/log_laplace.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/folded_cauchy.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/mv_student_t.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/wrapped_cauchy.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/log_weibull.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/logistic.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/chi_squared.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/kumaraswamy.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/power_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/double_gamma.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/laplace.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/trunc_exponential.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/generalized_half_logistic.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/levy.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/student_t.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/mielke.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/alpha.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/weibull.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/wald.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/gamma.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/gompertz.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/log_gamma.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/log_uniform.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/generalized_exponential.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/f.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/generalized_extreme.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/exponential_power.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/hyperbolic_secant.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/inverse_gamma.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/triangle.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/frechet.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/beta.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/binomial.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/chi.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/bradford.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/fisk.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/fatigue_life.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/folded_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/reciprocal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/nakagami.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/log_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/pareto2.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/pareto1.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/uniform.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/tukey_lambda.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/trunc_normal.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/cauchy.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/anglit.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection copying build/lib/chaospy/distributions/collection/generalized_gamma.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/collection creating build/bdist.linux-riscv64/wheel/chaospy/distributions/kernel copying build/lib/chaospy/distributions/kernel/gaussian.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/kernel copying build/lib/chaospy/distributions/kernel/baseclass.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/kernel copying build/lib/chaospy/distributions/kernel/mixture.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/kernel copying build/lib/chaospy/distributions/kernel/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/kernel creating build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler copying build/lib/chaospy/distributions/sampler/generator.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler copying build/lib/chaospy/distributions/sampler/latin_hypercube.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler creating build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/van_der_corput.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/additive_recursion.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/grid.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/primes.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/hammersley.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/sobol.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/sobol_constants.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/halton.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/chebyshev.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/sequences/korobov.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler/sequences copying build/lib/chaospy/distributions/sampler/antithetic.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler copying build/lib/chaospy/distributions/sampler/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/sampler creating build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/archimedean.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/gumbel.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/t_copula.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/nataf.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/joe.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas copying build/lib/chaospy/distributions/copulas/clayton.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/copulas creating build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/copula.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/simple.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/mean_covariance.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/operator.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/slice_.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/user.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/distribution.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/utils.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/lower_upper.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/baseclass/shift_scale.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/baseclass copying build/lib/chaospy/distributions/approximation.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions copying build/lib/chaospy/distributions/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions creating build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/negative.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/power.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/logarithm.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/joint.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/iid.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/addition.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/truncation.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/multiply.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators copying build/lib/chaospy/distributions/operators/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/distributions/operators creating build/bdist.linux-riscv64/wheel/chaospy/external copying build/lib/chaospy/external/scipy_stats.py -> build/bdist.linux-riscv64/wheel/chaospy/external copying build/lib/chaospy/external/openturns_.py -> build/bdist.linux-riscv64/wheel/chaospy/external copying build/lib/chaospy/external/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/external copying build/lib/chaospy/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy creating build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/variance.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/conditional.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/quantity_of_interest.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/covariance.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/kurtosis.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives creating build/bdist.linux-riscv64/wheel/chaospy/descriptives/sensitivity copying build/lib/chaospy/descriptives/sensitivity/main.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/sensitivity copying build/lib/chaospy/descriptives/sensitivity/main2.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/sensitivity copying build/lib/chaospy/descriptives/sensitivity/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/sensitivity copying build/lib/chaospy/descriptives/sensitivity/total.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/sensitivity copying build/lib/chaospy/descriptives/standard_deviation.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/percentile.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives creating build/bdist.linux-riscv64/wheel/chaospy/descriptives/correlation copying build/lib/chaospy/descriptives/correlation/spearman.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/correlation copying build/lib/chaospy/descriptives/correlation/auto_correlation.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/correlation copying build/lib/chaospy/descriptives/correlation/__init__.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/correlation copying build/lib/chaospy/descriptives/correlation/pearson.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives/correlation copying build/lib/chaospy/descriptives/expected.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/descriptives/skewness.py -> build/bdist.linux-riscv64/wheel/chaospy/descriptives copying build/lib/chaospy/saltelli.py -> build/bdist.linux-riscv64/wheel/chaospy running install_egg_info Copying chaospy.egg-info to build/bdist.linux-riscv64/wheel/chaospy-4.3.13-py3.12.egg-info running install_scripts creating build/bdist.linux-riscv64/wheel/chaospy-4.3.13.dist-info/WHEEL creating '/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir/pip-wheel-g_awulmf/.tmp-o1cq_4n4/chaospy-4.3.13-py3-none-any.whl' and adding 'build/bdist.linux-riscv64/wheel' to it adding 'chaospy/__init__.py' adding 'chaospy/regression.py' adding 'chaospy/saltelli.py' adding 'chaospy/spectral.py' adding 'chaospy/descriptives/__init__.py' adding 'chaospy/descriptives/conditional.py' adding 'chaospy/descriptives/covariance.py' adding 'chaospy/descriptives/expected.py' adding 'chaospy/descriptives/kurtosis.py' adding 'chaospy/descriptives/percentile.py' adding 'chaospy/descriptives/quantity_of_interest.py' adding 'chaospy/descriptives/skewness.py' adding 'chaospy/descriptives/standard_deviation.py' adding 'chaospy/descriptives/variance.py' adding 'chaospy/descriptives/correlation/__init__.py' adding 'chaospy/descriptives/correlation/auto_correlation.py' adding 'chaospy/descriptives/correlation/pearson.py' adding 'chaospy/descriptives/correlation/spearman.py' adding 'chaospy/descriptives/sensitivity/__init__.py' adding 'chaospy/descriptives/sensitivity/main.py' adding 'chaospy/descriptives/sensitivity/main2.py' adding 'chaospy/descriptives/sensitivity/total.py' adding 'chaospy/distributions/__init__.py' adding 'chaospy/distributions/approximation.py' adding 'chaospy/distributions/baseclass/__init__.py' adding 'chaospy/distributions/baseclass/copula.py' adding 'chaospy/distributions/baseclass/distribution.py' adding 'chaospy/distributions/baseclass/lower_upper.py' adding 'chaospy/distributions/baseclass/mean_covariance.py' adding 'chaospy/distributions/baseclass/operator.py' adding 'chaospy/distributions/baseclass/shift_scale.py' adding 'chaospy/distributions/baseclass/simple.py' adding 'chaospy/distributions/baseclass/slice_.py' adding 'chaospy/distributions/baseclass/user.py' adding 'chaospy/distributions/baseclass/utils.py' adding 'chaospy/distributions/collection/__init__.py' adding 'chaospy/distributions/collection/alpha.py' adding 'chaospy/distributions/collection/anglit.py' adding 'chaospy/distributions/collection/beta.py' adding 'chaospy/distributions/collection/binomial.py' adding 'chaospy/distributions/collection/bradford.py' adding 'chaospy/distributions/collection/burr.py' adding 'chaospy/distributions/collection/cauchy.py' adding 'chaospy/distributions/collection/chi.py' adding 'chaospy/distributions/collection/chi_squared.py' adding 'chaospy/distributions/collection/discrete_uniform.py' adding 'chaospy/distributions/collection/double_gamma.py' adding 'chaospy/distributions/collection/double_weibull.py' adding 'chaospy/distributions/collection/exponential_power.py' adding 'chaospy/distributions/collection/exponential_weibull.py' adding 'chaospy/distributions/collection/f.py' adding 'chaospy/distributions/collection/fatigue_life.py' adding 'chaospy/distributions/collection/fisk.py' adding 'chaospy/distributions/collection/folded_cauchy.py' adding 'chaospy/distributions/collection/folded_normal.py' adding 'chaospy/distributions/collection/frechet.py' adding 'chaospy/distributions/collection/gamma.py' adding 'chaospy/distributions/collection/generalized_exponential.py' adding 'chaospy/distributions/collection/generalized_extreme.py' adding 'chaospy/distributions/collection/generalized_gamma.py' adding 'chaospy/distributions/collection/generalized_half_logistic.py' adding 'chaospy/distributions/collection/gompertz.py' adding 'chaospy/distributions/collection/hyperbolic_secant.py' adding 'chaospy/distributions/collection/inverse_gamma.py' adding 'chaospy/distributions/collection/kumaraswamy.py' adding 'chaospy/distributions/collection/laplace.py' adding 'chaospy/distributions/collection/levy.py' adding 'chaospy/distributions/collection/log_gamma.py' adding 'chaospy/distributions/collection/log_laplace.py' adding 'chaospy/distributions/collection/log_normal.py' adding 'chaospy/distributions/collection/log_uniform.py' adding 'chaospy/distributions/collection/log_weibull.py' adding 'chaospy/distributions/collection/logistic.py' adding 'chaospy/distributions/collection/mielke.py' adding 'chaospy/distributions/collection/mv_log_normal.py' adding 'chaospy/distributions/collection/mv_normal.py' adding 'chaospy/distributions/collection/mv_student_t.py' adding 'chaospy/distributions/collection/nakagami.py' adding 'chaospy/distributions/collection/normal.py' adding 'chaospy/distributions/collection/pareto1.py' adding 'chaospy/distributions/collection/pareto2.py' adding 'chaospy/distributions/collection/power_log_normal.py' adding 'chaospy/distributions/collection/power_normal.py' adding 'chaospy/distributions/collection/reciprocal.py' adding 'chaospy/distributions/collection/student_t.py' adding 'chaospy/distributions/collection/triangle.py' adding 'chaospy/distributions/collection/trunc_exponential.py' adding 'chaospy/distributions/collection/trunc_normal.py' adding 'chaospy/distributions/collection/tukey_lambda.py' adding 'chaospy/distributions/collection/uniform.py' adding 'chaospy/distributions/collection/wald.py' adding 'chaospy/distributions/collection/weibull.py' adding 'chaospy/distributions/collection/wrapped_cauchy.py' adding 'chaospy/distributions/copulas/__init__.py' adding 'chaospy/distributions/copulas/archimedean.py' adding 'chaospy/distributions/copulas/clayton.py' adding 'chaospy/distributions/copulas/gumbel.py' adding 'chaospy/distributions/copulas/joe.py' adding 'chaospy/distributions/copulas/nataf.py' adding 'chaospy/distributions/copulas/t_copula.py' adding 'chaospy/distributions/kernel/__init__.py' adding 'chaospy/distributions/kernel/baseclass.py' adding 'chaospy/distributions/kernel/gaussian.py' adding 'chaospy/distributions/kernel/mixture.py' adding 'chaospy/distributions/operators/__init__.py' adding 'chaospy/distributions/operators/addition.py' adding 'chaospy/distributions/operators/iid.py' adding 'chaospy/distributions/operators/joint.py' adding 'chaospy/distributions/operators/logarithm.py' adding 'chaospy/distributions/operators/multiply.py' adding 'chaospy/distributions/operators/negative.py' adding 'chaospy/distributions/operators/power.py' adding 'chaospy/distributions/operators/truncation.py' adding 'chaospy/distributions/sampler/__init__.py' adding 'chaospy/distributions/sampler/antithetic.py' adding 'chaospy/distributions/sampler/generator.py' adding 'chaospy/distributions/sampler/latin_hypercube.py' adding 'chaospy/distributions/sampler/sequences/__init__.py' adding 'chaospy/distributions/sampler/sequences/additive_recursion.py' adding 'chaospy/distributions/sampler/sequences/chebyshev.py' adding 'chaospy/distributions/sampler/sequences/grid.py' adding 'chaospy/distributions/sampler/sequences/halton.py' adding 'chaospy/distributions/sampler/sequences/hammersley.py' adding 'chaospy/distributions/sampler/sequences/korobov.py' adding 'chaospy/distributions/sampler/sequences/primes.py' adding 'chaospy/distributions/sampler/sequences/sobol.py' adding 'chaospy/distributions/sampler/sequences/sobol_constants.py' adding 'chaospy/distributions/sampler/sequences/van_der_corput.py' adding 'chaospy/expansion/__init__.py' adding 'chaospy/expansion/chebyshev.py' adding 'chaospy/expansion/cholesky.py' adding 'chaospy/expansion/frontend.py' adding 'chaospy/expansion/gegenbauer.py' adding 'chaospy/expansion/gram_schmidt.py' adding 'chaospy/expansion/hermite.py' adding 'chaospy/expansion/jacobi.py' adding 'chaospy/expansion/lagrange.py' adding 'chaospy/expansion/laguerre.py' adding 'chaospy/expansion/legendre.py' adding 'chaospy/expansion/stieltjes.py' adding 'chaospy/external/__init__.py' adding 'chaospy/external/openturns_.py' adding 'chaospy/external/scipy_stats.py' adding 'chaospy/quadrature/__init__.py' adding 'chaospy/quadrature/chebyshev.py' adding 'chaospy/quadrature/clenshaw_curtis.py' adding 'chaospy/quadrature/discrete.py' adding 'chaospy/quadrature/fejer_1.py' adding 'chaospy/quadrature/fejer_2.py' adding 'chaospy/quadrature/frontend.py' adding 'chaospy/quadrature/gaussian.py' adding 'chaospy/quadrature/gegenbauer.py' adding 'chaospy/quadrature/genz_keister.py' adding 'chaospy/quadrature/grid.py' adding 'chaospy/quadrature/hermite.py' adding 'chaospy/quadrature/hypercube.py' adding 'chaospy/quadrature/jacobi.py' adding 'chaospy/quadrature/kronrod.py' adding 'chaospy/quadrature/laguerre.py' adding 'chaospy/quadrature/legendre.py' adding 'chaospy/quadrature/leja.py' adding 'chaospy/quadrature/lobatto.py' adding 'chaospy/quadrature/newton_cotes.py' adding 'chaospy/quadrature/patterson.py' adding 'chaospy/quadrature/radau.py' adding 'chaospy/quadrature/sparse_grid.py' adding 'chaospy/quadrature/utils.py' adding 'chaospy/recurrence/__init__.py' adding 'chaospy/recurrence/chebyshev.py' adding 'chaospy/recurrence/frontend.py' adding 'chaospy/recurrence/jacobi.py' adding 'chaospy/recurrence/lanczos.py' adding 'chaospy/recurrence/stieltjes.py' adding 'chaospy-4.3.13.dist-info/LICENSE.txt' adding 'chaospy-4.3.13.dist-info/METADATA' adding 'chaospy-4.3.13.dist-info/WHEEL' adding 'chaospy-4.3.13.dist-info/top_level.txt' adding 'chaospy-4.3.13.dist-info/RECORD' removing build/bdist.linux-riscv64/wheel Building wheel for chaospy (pyproject.toml): finished with status 'done' Created wheel for chaospy: filename=chaospy-4.3.13-py3-none-any.whl size=253220 sha256=462b69fcdf21f9efcd16ed07938a896b4db4b221b58ddcbec1d7d2fbe4d1850b Stored in directory: /builddir/.cache/pip/wheels/d2/40/70/b6dde38d05d443a02018f3a4c14909343eb75a1aac3cdecfb5 Successfully built chaospy + RPM_EC=0 ++ jobs -p + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.lqxcwn + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch '!=' / ']' + rm -rf /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch ++ dirname /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd chaospy-4.3.13 + export SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 + SETUPTOOLS_SCM_PRETEND_VERSION=4.3.13 ++ xargs basename --multiple ++ ls /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir/chaospy-4.3.13-py3-none-any.whl ++ sed -E 's/([^-]+)-([^-]+)-.+\.whl/\1==\2/' + specifier=chaospy==4.3.13 + '[' -z chaospy==4.3.13 ']' + TMPDIR=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir + /usr/bin/python3 -m pip install --root /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch --prefix /usr --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir chaospy==4.3.13 Using pip 23.3.2 from /usr/lib/python3.12/site-packages/pip (python 3.12) Looking in links: /builddir/build/BUILD/chaospy-4.3.13/pyproject-wheeldir Processing ./pyproject-wheeldir/chaospy-4.3.13-py3-none-any.whl Installing collected packages: chaospy Successfully installed chaospy-4.3.13 + '[' -d /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/bin ']' + rm -f /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-ghost-distinfo + site_dirs=() + '[' -d /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages ']' + site_dirs+=("/usr/lib/python3.12/site-packages") + '[' /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib64/python3.12/site-packages '!=' /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages ']' + '[' -d /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib64/python3.12/site-packages ']' + for site_dir in ${site_dirs[@]} + for distinfo in /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch$site_dir/*.dist-info + echo '%ghost /usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info' + sed -i s/pip/rpm/ /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info/INSTALLER + PYTHONPATH=/usr/lib/rpm/redhat + /usr/bin/python3 -B /usr/lib/rpm/redhat/pyproject_preprocess_record.py --buildroot /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch --record /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info/RECORD --output /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-record + rm -fv /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info/RECORD removed '/builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info/RECORD' + rm -fv /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info/REQUESTED removed '/builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12/site-packages/chaospy-4.3.13.dist-info/REQUESTED' ++ wc -l /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-ghost-distinfo ++ cut -f1 '-d ' + lines=1 + '[' 1 -ne 1 ']' + RPM_PERCENTAGES_COUNT=2 + /usr/bin/python3 /usr/lib/rpm/redhat/pyproject_save_files.py --output-files /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-files --output-modules /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-modules --buildroot /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch --sitelib /usr/lib/python3.12/site-packages --sitearch /usr/lib64/python3.12/site-packages --python-version 3.12 --pyproject-record /builddir/build/BUILD/python-chaospy-4.3.13-1.fc40.noarch-pyproject-record --prefix /usr -l chaospy + /usr/bin/find-debuginfo -j8 --strict-build-id -m -i --build-id-seed 4.3.13-1.fc40 --unique-debug-suffix -4.3.13-1.fc40.noarch --unique-debug-src-base python-chaospy-4.3.13-1.fc40.noarch --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 50000000 -S debugsourcefiles.list /builddir/build/BUILD/chaospy-4.3.13 find-debuginfo: starting Extracting debug info from 0 files Creating .debug symlinks for symlinks to ELF files find: ‘debug’: No such file or directory find-debuginfo: done + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig + /usr/lib/rpm/brp-compress + /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/check-rpaths + /usr/lib/rpm/redhat/brp-mangle-shebangs + /usr/lib/rpm/brp-remove-la-files + env /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 -j8 Bytecompiling .py files below /builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/lib/python3.12 using python3.12 + /usr/lib/rpm/redhat/brp-python-hardlink Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.Lb1fRx + umask 022 + cd /builddir/build/BUILD + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/lib/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd chaospy-4.3.13 + export PYTHONPATH=/builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch//usr/lib/python3.12/site-packages + PYTHONPATH=/builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch//usr/lib/python3.12/site-packages + CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fno-omit-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + PATH=/builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin + PYTHONPATH=/builddir/build/BUILDROOT/python-chaospy-4.3.13-1.fc40.noarch//usr/lib/python3.12/site-packages + PYTHONDONTWRITEBYTECODE=1 + PYTEST_ADDOPTS=' --ignore=/builddir/build/BUILD/chaospy-4.3.13/.pyproject-builddir' + PYTEST_XDIST_AUTO_NUM_WORKERS=8 + /usr/bin/pytest tests ============================= test session starts ============================== platform linux -- Python 3.12.0, pytest-7.3.2, pluggy-1.3.0 rootdir: /builddir/build/BUILD/chaospy-4.3.13 configfile: pyproject.toml collected 388 items tests/test_intrusive_galerkin.py EE [ 0%] tests/test_lagrange_polynomials.py FF [ 1%] tests/test_monte_carlo_integration.py ................ [ 5%] tests/test_orthogonal_expansion.py EEFEFEFEFEFE..FEEEFEFEFEFEFE..FEEEFEF [ 14%] EFEFEFE..FE [ 17%] tests/test_point_collocation.py FFFFFFFFFFFFFFFF [ 21%] tests/test_pseudo_spectral_projection.py FEEEEEEFEEEEEE [ 25%] tests/test_regression_models.py FFFFFFFFFFFFFFFF [ 29%] tests/test_stress.py ..FFFF.F [ 31%] tests/distributions/test_1d_dependencies.py .F.. [ 32%] tests/distributions/test_2d_dependencies.py ... [ 33%] tests/distributions/test_approximation.py ..F [ 34%] tests/distributions/test_arithmetics.py .FFFFFFFFFFFFFFFFFFFFFFFFFF.FFFF [ 42%] FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 60%] FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 74%] tests/distributions/test_baseclass.py F.. [ 75%] tests/distributions/collection/test_mv_normal.py ....... [ 77%] tests/distributions/collection/test_triangle.py F [ 77%] tests/distributions/copulas/test_nataf.py F..... [ 78%] tests/distributions/kernel/test_gaussian_kde.py ... [ 79%] tests/distributions/operators/test_addition.py .FF...F.. [ 81%] tests/distributions/operators/test_multiply.py .FF...F. [ 84%] tests/distributions/operators/test_operators.py . [ 84%] tests/distributions/operators/test_truncation.py FFFF [ 85%] tests/poly/test_numpoly.py . [ 85%] tests/recurrence/test_quadrature_creation.py FFFFFFFFFFFFFFFFFFFFFFFFFFF [ 92%] FFFFFFFFFFFFFFF [ 96%] tests/recurrence/test_stieltjes_method.py FFFFFFFFFFFFFF [100%] ==================================== ERRORS ==================================== _____________________ ERROR at setup of test_galerkin_mean _____________________ coordinates = array([ 0. , 0.01001001, 0.02002002, 0.03003003, 0.04004004, 0.05005005, 0.06006006, 0.07007007, ...991992, 9.92992993, 9.93993994, 9.94994995, 9.95995996, 9.96996997, 9.97997998, 9.98998999, 10. ]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) expansion_small = polynomial([1.0, q1-0.15000000000000002, q0-1.5, q0*q1-1.5*q1-0.15000000000000002*q0+0.22500000000000003, ...3*q1-4.5*q0**2*q1-0.15000000000000002*q0**3+6.63*q0*q1+0.675*q0**2-3.195*q1-0.9945000000000002*q0+0.47925000000000006]) norms_small = array([1.00000000e+00, 8.33333333e-04, 4.00000000e-02, 3.33333333e-05, 3.20000000e-03, 5.55555556e-07, 3.571428...2.66666667e-06, 3.84000000e-04, 1.42857143e-11, 6.14400000e-05, 1.77777778e-09, 2.26757370e-13, 3.20000000e-07]) @pytest.fixture def galerkin_approx(coordinates, joint, expansion_small, norms_small): alpha, beta = chaospy.variable(2) > e_alpha_phi = chaospy.E(alpha*expansion_small, joint) tests/test_intrusive_galerkin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ ERROR at setup of test_galerkin_variance ___________________ coordinates = array([ 0. , 0.01001001, 0.02002002, 0.03003003, 0.04004004, 0.05005005, 0.06006006, 0.07007007, ...991992, 9.92992993, 9.93993994, 9.94994995, 9.95995996, 9.96996997, 9.97997998, 9.98998999, 10. ]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) expansion_small = polynomial([1.0, q1-0.15000000000000002, q0-1.5, q0*q1-1.5*q1-0.15000000000000002*q0+0.22500000000000003, ...3*q1-4.5*q0**2*q1-0.15000000000000002*q0**3+6.63*q0*q1+0.675*q0**2-3.195*q1-0.9945000000000002*q0+0.47925000000000006]) norms_small = array([1.00000000e+00, 8.33333333e-04, 4.00000000e-02, 3.33333333e-05, 3.20000000e-03, 5.55555556e-07, 3.571428...2.66666667e-06, 3.84000000e-04, 1.42857143e-11, 6.14400000e-05, 1.77777778e-09, 2.26757370e-13, 3.20000000e-07]) @pytest.fixture def galerkin_approx(coordinates, joint, expansion_small, norms_small): alpha, beta = chaospy.variable(2) > e_alpha_phi = chaospy.E(alpha*expansion_small, joint) tests/test_intrusive_galerkin.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________ ERROR at setup of test_orthogonality_small[discrete-stieltjes] ________ order = 4, dist = DiscreteUniform(-10, 10), rule = None, tolerance = 1e-16 scaling = 3, n_max = 5000 def stieltjes( order, dist, rule=None, tolerance=1e-16, scaling=3, n_max=5000, ): """ Stieltjes' method. Tries to get recurrence coefficients using the distributions own TTR-method, but will fall back to a iterative method if missing. Args: order (int): The order create recurrence coefficients for. dist (chaospy.Distribution): The distribution to create recurrence coefficients with respect to. rule (str): The rule to use to create quadrature nodes and weights from. tolerance (float): The allowed relative error in norm between two quadrature orders before method assumes convergence. scaling (float): A multiplier the adaptive order increases with for each step quadrature order is not converged. Use 0 to indicate unit increments. n_max (int): The allowed number of quadrature points to use in approximation. Returns: (numpy.ndarray, numpy.ndarray, numpy.ndarray): coefficients: The recurrence coefficients created using the discretized Stieltjes' method, with ``shape == (2, D, order+1)``. polynomials: The orthogonal polynomial expansion created as a by-product of the algorithm. norms: The norm of each orthogonal polynomial. Roughly equivalent to ``chaospy.E(polynomials**2, dist)``, but more numerically stable than most alternatives. Examples: >>> dist = chaospy.J(chaospy.Uniform(0, 1), chaospy.Beta(3, 4)) >>> (alpha, beta), orth, norms = chaospy.stieltjes(2, dist) >>> alpha.round(5) array([[0.5 , 0.5 , 0.5 ], [0.42857, 0.46032, 0.47475]]) >>> beta.round(5) array([[1. , 0.08333, 0.06667], [1. , 0.03061, 0.04321]]) >>> orth[:, 2].round(5) polynomial([q0**2-q0+0.16667, q1**2-0.88889*q1+0.16667]) >>> norms.round(5) array([[1. , 0.08333, 0.00556], [1. , 0.03061, 0.00132]]) """ try: > return analytical_stieltjes(order=order, dist=dist) chaospy/recurrence/stieltjes.py:68: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ order = 4, dist = DiscreteUniform(-10, 10), multiplier = 1 def analytical_stieltjes(order, dist, multiplier=1): """Analytical Stieltjes' method""" dimensions = len(dist) mom_order = numpy.arange(order + 1).repeat(dimensions) mom_order = mom_order.reshape(order + 1, dimensions).T > coeffs = dist.ttr(mom_order) chaospy/recurrence/stieltjes.py:165: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kloc = array([[0, 1, 2, 3, 4]]) def ttr(self, kloc): """ Three terms relation's coefficient generator. Args: k (numpy.ndarray, int): The order of the coefficients. Returns: (Recurrence coefficients): Where out[0] is the first (A) and out[1] is the second coefficient With ``out.shape==(2,)+k.shape``. """ check_dependencies(self) kloc = numpy.asarray(kloc, dtype=int) shape = kloc.shape kloc = kloc.reshape(len(self), -1) out = numpy.zeros((2,) + kloc.shape) for idy, kloc_ in enumerate(kloc.T): for idx in range(len(self)): > out[:, idx, idy] = self._get_ttr(kloc_[idx], idx) chaospy/distributions/baseclass/distribution.py:721: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kdata = 0, idx = 0 def _get_ttr(self, kdata, idx): """In-process function for getting TTR-values.""" if (idx, kdata) in self._ttr_cache: return self._ttr_cache[idx, kdata] if hasattr(self, "get_ttr_parameters"): parameters = self.get_ttr_parameters(idx) else: parameters = self.get_parameters(idx, cache={}, assert_numerical=True) > alpha, beta = self._ttr(kdata, **parameters) chaospy/distributions/baseclass/distribution.py:732: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kloc = 0 kwargs = {'lower': array([-10]), 'upper': array([10])} def _ttr(self, kloc, **kwargs): """Default TTR generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical recurrence coefficients." % self ) E chaospy.UnsupportedFeature: DiscreteUniform(-10, 10): does not support analytical recurrence coefficients. chaospy/distributions/baseclass/simple.py:116: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/recurrence/stieltjes.py", line 68, in stieltjes return analytical_stieltjes(order=order, dist=dist) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/recurrence/stieltjes.py", line 165, in analytical_stieltjes coeffs = dist.ttr(mom_order) ^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 721, in ttr out[:, idx, idy] = self._get_ttr(kloc_[idx], idx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 732, in _get_ttr alpha, beta = self._ttr(kdata, **parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 116, in _ttr raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: DiscreteUniform(-10, 10): does not support analytical recurrence coefficients. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = DiscreteUniform(-10, 10) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/stieltjes.py:122: in stieltjes ) = chaospy.stieltjes(numpy.max(order), dist) chaospy/recurrence/stieltjes.py:70: in stieltjes return discretized_stieltjes( chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/discrete.py:49: in discrete return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________ ERROR at setup of test_orthogonality_small[discrete-cholesky] _________ builder = distribution = DiscreteUniform(-10, 10) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), k_data = array([1]), lower = array([-10]) upper = array([10]) def _mom(self, k_data, lower, upper): """Raw statistical moments.""" return numpy.mean( > numpy.arange(numpy.ceil(lower), numpy.floor(upper) + 1) ** k_data ) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/collection/discrete_uniform.py:76: DeprecationWarning _________ ERROR at setup of test_orthogonality_small[normal-cholesky] __________ builder = distribution = Normal(mu=0, sigma=1) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________ ERROR at setup of test_orthogonality_small[uniform-cholesky] _________ builder = distribution = Uniform(lower=-1, upper=1) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______ ERROR at setup of test_orthogonality_small[exponential-cholesky] _______ builder = , distribution = Exponential() @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________ ERROR at setup of test_orthogonality_small[gamma-cholesky] __________ builder = , distribution = Gamma(1) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________ ERROR at setup of test_orthogonality_small[beta-cholesky] ___________ builder = distribution = Beta(3, 3, lower=-1, upper=1) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[3], b=[3]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________ ERROR at setup of test_orthogonality_small[custom-cholesky] __________ builder = distribution = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) @pytest.fixture def expansion_small(builder, distribution): > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________ ERROR at setup of test_orthogonality_large[discrete-stieltjes] ________ order = 7, dist = DiscreteUniform(-10, 10), rule = None, tolerance = 1e-16 scaling = 3, n_max = 5000 def stieltjes( order, dist, rule=None, tolerance=1e-16, scaling=3, n_max=5000, ): """ Stieltjes' method. Tries to get recurrence coefficients using the distributions own TTR-method, but will fall back to a iterative method if missing. Args: order (int): The order create recurrence coefficients for. dist (chaospy.Distribution): The distribution to create recurrence coefficients with respect to. rule (str): The rule to use to create quadrature nodes and weights from. tolerance (float): The allowed relative error in norm between two quadrature orders before method assumes convergence. scaling (float): A multiplier the adaptive order increases with for each step quadrature order is not converged. Use 0 to indicate unit increments. n_max (int): The allowed number of quadrature points to use in approximation. Returns: (numpy.ndarray, numpy.ndarray, numpy.ndarray): coefficients: The recurrence coefficients created using the discretized Stieltjes' method, with ``shape == (2, D, order+1)``. polynomials: The orthogonal polynomial expansion created as a by-product of the algorithm. norms: The norm of each orthogonal polynomial. Roughly equivalent to ``chaospy.E(polynomials**2, dist)``, but more numerically stable than most alternatives. Examples: >>> dist = chaospy.J(chaospy.Uniform(0, 1), chaospy.Beta(3, 4)) >>> (alpha, beta), orth, norms = chaospy.stieltjes(2, dist) >>> alpha.round(5) array([[0.5 , 0.5 , 0.5 ], [0.42857, 0.46032, 0.47475]]) >>> beta.round(5) array([[1. , 0.08333, 0.06667], [1. , 0.03061, 0.04321]]) >>> orth[:, 2].round(5) polynomial([q0**2-q0+0.16667, q1**2-0.88889*q1+0.16667]) >>> norms.round(5) array([[1. , 0.08333, 0.00556], [1. , 0.03061, 0.00132]]) """ try: > return analytical_stieltjes(order=order, dist=dist) chaospy/recurrence/stieltjes.py:68: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ order = 7, dist = DiscreteUniform(-10, 10), multiplier = 1 def analytical_stieltjes(order, dist, multiplier=1): """Analytical Stieltjes' method""" dimensions = len(dist) mom_order = numpy.arange(order + 1).repeat(dimensions) mom_order = mom_order.reshape(order + 1, dimensions).T > coeffs = dist.ttr(mom_order) chaospy/recurrence/stieltjes.py:165: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kloc = array([[0, 1, 2, 3, 4, 5, 6, 7]]) def ttr(self, kloc): """ Three terms relation's coefficient generator. Args: k (numpy.ndarray, int): The order of the coefficients. Returns: (Recurrence coefficients): Where out[0] is the first (A) and out[1] is the second coefficient With ``out.shape==(2,)+k.shape``. """ check_dependencies(self) kloc = numpy.asarray(kloc, dtype=int) shape = kloc.shape kloc = kloc.reshape(len(self), -1) out = numpy.zeros((2,) + kloc.shape) for idy, kloc_ in enumerate(kloc.T): for idx in range(len(self)): > out[:, idx, idy] = self._get_ttr(kloc_[idx], idx) chaospy/distributions/baseclass/distribution.py:721: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kdata = 0, idx = 0 def _get_ttr(self, kdata, idx): """In-process function for getting TTR-values.""" if (idx, kdata) in self._ttr_cache: return self._ttr_cache[idx, kdata] if hasattr(self, "get_ttr_parameters"): parameters = self.get_ttr_parameters(idx) else: parameters = self.get_parameters(idx, cache={}, assert_numerical=True) > alpha, beta = self._ttr(kdata, **parameters) chaospy/distributions/baseclass/distribution.py:732: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kloc = 0 kwargs = {'lower': array([-10]), 'upper': array([10])} def _ttr(self, kloc, **kwargs): """Default TTR generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical recurrence coefficients." % self ) E chaospy.UnsupportedFeature: DiscreteUniform(-10, 10): does not support analytical recurrence coefficients. chaospy/distributions/baseclass/simple.py:116: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/recurrence/stieltjes.py", line 68, in stieltjes return analytical_stieltjes(order=order, dist=dist) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/recurrence/stieltjes.py", line 165, in analytical_stieltjes coeffs = dist.ttr(mom_order) ^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 721, in ttr out[:, idx, idy] = self._get_ttr(kloc_[idx], idx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 732, in _get_ttr alpha, beta = self._ttr(kdata, **parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 116, in _ttr raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: DiscreteUniform(-10, 10): does not support analytical recurrence coefficients. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = DiscreteUniform(-10, 10) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/stieltjes.py:122: in stieltjes ) = chaospy.stieltjes(numpy.max(order), dist) chaospy/recurrence/stieltjes.py:70: in stieltjes return discretized_stieltjes( chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/discrete.py:49: in discrete return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________ ERROR at setup of test_orthogonality_large[discrete-cholesky] _________ builder = distribution = DiscreteUniform(-10, 10) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), k_data = array([1]), lower = array([-10]) upper = array([10]) def _mom(self, k_data, lower, upper): """Raw statistical moments.""" return numpy.mean( > numpy.arange(numpy.ceil(lower), numpy.floor(upper) + 1) ** k_data ) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/collection/discrete_uniform.py:76: DeprecationWarning _________ ERROR at setup of test_orthogonality_large[normal-cholesky] __________ builder = distribution = Normal(mu=0, sigma=1) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________ ERROR at setup of test_orthogonality_large[uniform-cholesky] _________ builder = distribution = Uniform(lower=-1, upper=1) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______ ERROR at setup of test_orthogonality_large[exponential-cholesky] _______ builder = , distribution = Exponential() @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________ ERROR at setup of test_orthogonality_large[gamma-cholesky] __________ builder = , distribution = Gamma(1) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________ ERROR at setup of test_orthogonality_large[beta-cholesky] ___________ builder = distribution = Beta(3, 3, lower=-1, upper=1) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[3], b=[3]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________ ERROR at setup of test_orthogonality_large[custom-cholesky] __________ builder = distribution = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) @pytest.fixture def expansion_large(builder, distribution): > return builder(7, distribution, normed=True) tests/test_orthogonal_expansion.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________ ERROR at setup of test_approx_expansion[discrete-stieltjes] __________ order = 4, dist = DiscreteUniform(-10, 10), rule = None, tolerance = 1e-16 scaling = 3, n_max = 5000 def stieltjes( order, dist, rule=None, tolerance=1e-16, scaling=3, n_max=5000, ): """ Stieltjes' method. Tries to get recurrence coefficients using the distributions own TTR-method, but will fall back to a iterative method if missing. Args: order (int): The order create recurrence coefficients for. dist (chaospy.Distribution): The distribution to create recurrence coefficients with respect to. rule (str): The rule to use to create quadrature nodes and weights from. tolerance (float): The allowed relative error in norm between two quadrature orders before method assumes convergence. scaling (float): A multiplier the adaptive order increases with for each step quadrature order is not converged. Use 0 to indicate unit increments. n_max (int): The allowed number of quadrature points to use in approximation. Returns: (numpy.ndarray, numpy.ndarray, numpy.ndarray): coefficients: The recurrence coefficients created using the discretized Stieltjes' method, with ``shape == (2, D, order+1)``. polynomials: The orthogonal polynomial expansion created as a by-product of the algorithm. norms: The norm of each orthogonal polynomial. Roughly equivalent to ``chaospy.E(polynomials**2, dist)``, but more numerically stable than most alternatives. Examples: >>> dist = chaospy.J(chaospy.Uniform(0, 1), chaospy.Beta(3, 4)) >>> (alpha, beta), orth, norms = chaospy.stieltjes(2, dist) >>> alpha.round(5) array([[0.5 , 0.5 , 0.5 ], [0.42857, 0.46032, 0.47475]]) >>> beta.round(5) array([[1. , 0.08333, 0.06667], [1. , 0.03061, 0.04321]]) >>> orth[:, 2].round(5) polynomial([q0**2-q0+0.16667, q1**2-0.88889*q1+0.16667]) >>> norms.round(5) array([[1. , 0.08333, 0.00556], [1. , 0.03061, 0.00132]]) """ try: > return analytical_stieltjes(order=order, dist=dist) chaospy/recurrence/stieltjes.py:68: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ order = 4, dist = DiscreteUniform(-10, 10), multiplier = 1 def analytical_stieltjes(order, dist, multiplier=1): """Analytical Stieltjes' method""" dimensions = len(dist) mom_order = numpy.arange(order + 1).repeat(dimensions) mom_order = mom_order.reshape(order + 1, dimensions).T > coeffs = dist.ttr(mom_order) chaospy/recurrence/stieltjes.py:165: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kloc = array([[0, 1, 2, 3, 4]]) def ttr(self, kloc): """ Three terms relation's coefficient generator. Args: k (numpy.ndarray, int): The order of the coefficients. Returns: (Recurrence coefficients): Where out[0] is the first (A) and out[1] is the second coefficient With ``out.shape==(2,)+k.shape``. """ check_dependencies(self) kloc = numpy.asarray(kloc, dtype=int) shape = kloc.shape kloc = kloc.reshape(len(self), -1) out = numpy.zeros((2,) + kloc.shape) for idy, kloc_ in enumerate(kloc.T): for idx in range(len(self)): > out[:, idx, idy] = self._get_ttr(kloc_[idx], idx) chaospy/distributions/baseclass/distribution.py:721: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kdata = 0, idx = 0 def _get_ttr(self, kdata, idx): """In-process function for getting TTR-values.""" if (idx, kdata) in self._ttr_cache: return self._ttr_cache[idx, kdata] if hasattr(self, "get_ttr_parameters"): parameters = self.get_ttr_parameters(idx) else: parameters = self.get_parameters(idx, cache={}, assert_numerical=True) > alpha, beta = self._ttr(kdata, **parameters) chaospy/distributions/baseclass/distribution.py:732: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (0,), kwargs = {'lower': array([-10]), 'upper': array([10])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/recurrence/stieltjes.py", line 68, in stieltjes return analytical_stieltjes(order=order, dist=dist) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/recurrence/stieltjes.py", line 165, in analytical_stieltjes coeffs = dist.ttr(mom_order) ^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 721, in ttr out[:, idx, idy] = self._get_ttr(kloc_[idx], idx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 732, in _get_ttr alpha, beta = self._ttr(kdata, **parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = DiscreteUniform(-10, 10) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/stieltjes.py:122: in stieltjes ) = chaospy.stieltjes(numpy.max(order), dist) chaospy/recurrence/stieltjes.py:70: in stieltjes return discretized_stieltjes( chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/discrete.py:49: in discrete return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________ ERROR at setup of test_approx_expansion[discrete-cholesky] __________ self = DiscreteUniform(-10, 10), K = array([[1, 2, 3, 4]]), allow_approx = True kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),), kwargs = {'lower': array([-10]), 'upper': array([10])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = DiscreteUniform(-10, 10) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DiscreteUniform(-10, 10) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 DiscreteUniform(-10, 10): has stochastic dependencies; Approximating moments with quadrature. ___________ ERROR at setup of test_approx_expansion[normal-cholesky] ___________ self = Normal(mu=0, sigma=1), K = array([[1, 2, 3, 4]]), allow_approx = True kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': normal(), 'scale': array([1]), 'shift': array([0])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = Normal(mu=0, sigma=1) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Normal(mu=0, sigma=1): has stochastic dependencies; Approximating moments with quadrature. __________ ERROR at setup of test_approx_expansion[uniform-cholesky] ___________ self = Uniform(lower=-1, upper=1), K = array([[1, 2, 3, 4]]) allow_approx = True, kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': uniform(), 'parameters': {}, 'scale': array([1.]), 'shift': array([0.])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = Uniform(lower=-1, upper=1) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Uniform(lower=-1, upper=1): has stochastic dependencies; Approximating moments with quadrature. ________ ERROR at setup of test_approx_expansion[exponential-cholesky] _________ self = Exponential(), K = array([[1, 2, 3, 4]]), allow_approx = True kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': gamma(a=[1]), 'scale': array([1]), 'shift': array([0])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = , distribution = Exponential() @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Exponential(): has stochastic dependencies; Approximating moments with quadrature. ___________ ERROR at setup of test_approx_expansion[gamma-cholesky] ____________ self = Gamma(1), K = array([[1, 2, 3, 4]]), allow_approx = True, kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': gamma(a=[1]), 'scale': array([1]), 'shift': array([0])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = , distribution = Gamma(1) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Gamma(1): has stochastic dependencies; Approximating moments with quadrature. ____________ ERROR at setup of test_approx_expansion[beta-cholesky] ____________ self = Beta(3, 3, lower=-1, upper=1), K = array([[1, 2, 3, 4]]) allow_approx = True, kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(3, 3, lower=-1, upper=1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': beta_(a=[3], b=[3]), 'parameters': {'a': array([3]), 'b': array([3])}, 'scale': array([2.]), 'shift': array([-1.])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = Beta(3, 3, lower=-1, upper=1) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(3, 3, lower=-1, upper=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Beta(3, 3, lower=-1, upper=1): has stochastic dependencies; Approximating moments with quadrature. ___________ ERROR at setup of test_approx_expansion[custom-cholesky] ___________ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) K = array([[1, 2, 3, 4]]), allow_approx = True, kwargs = {} logger = shape = (1, 4), dim = 1, size = 4 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),), kwargs = {} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: builder = distribution = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) @pytest.fixture def expansion_approx(builder, distribution): def not_implemented(*args, **kwargs): raise chaospy.UnsupportedFeature() distribution._ttr = not_implemented distribution._mom = not_implemented > return builder(4, distribution, normed=True) tests/test_orthogonal_expansion.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/cholesky.py:86: in cholesky covariance = chaospy.descriptives.Cov(basis, dist) chaospy/descriptives/covariance.py:47: in Cov poly = poly - E(poly, dist) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ INFO chaospy.distributions.baseclass.distribution:distribution.py:672 UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd580>, upper= at 0xffffff7e3bd620>, ppf= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>): has stochastic dependencies; Approximating moments with quadrature. ________________ ERROR at setup of test_spectral_mean[sparse1] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ ERROR at setup of test_spectral_mean[sparse2] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/fejer_1.py:60: in fejer_1 return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.baseclass.distribution:distribution.py:352 normal().inv: 2/37 outputs below bounds DEBUG chaospy.distributions.baseclass.distribution:distribution.py:362 normal().inv: 2/37 outputs above bounds ________________ ERROR at setup of test_spectral_mean[sparse3] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/newton_cotes.py:103: in newton_cotes return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.baseclass.distribution:distribution.py:352 normal().inv: 3/41 outputs below bounds DEBUG chaospy.distributions.baseclass.distribution:distribution.py:362 normal().inv: 3/41 outputs above bounds ________________ ERROR at setup of test_spectral_mean[sparse4] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/legendre.py:145: in legendre_proxy return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.baseclass.distribution:distribution.py:352 normal().inv: 4/43 outputs below bounds DEBUG chaospy.distributions.baseclass.distribution:distribution.py:362 normal().inv: 4/43 outputs above bounds ________________ ERROR at setup of test_spectral_mean[lobatto] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/lobatto.py:117: in lobatto for coeffs, lo, up in zip(coefficients, dist.lower, dist.upper) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=1.5, sigma=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ ERROR at setup of test_spectral_mean[radau] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/radau.py:123: in radau fixed_point = dist.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=1.5, sigma=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ______________ ERROR at setup of test_spectral_variance[sparse1] _______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ______________ ERROR at setup of test_spectral_variance[sparse2] _______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/fejer_1.py:60: in fejer_1 return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.baseclass.distribution:distribution.py:352 normal().inv: 2/37 outputs below bounds DEBUG chaospy.distributions.baseclass.distribution:distribution.py:362 normal().inv: 2/37 outputs above bounds ______________ ERROR at setup of test_spectral_variance[sparse3] _______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/newton_cotes.py:103: in newton_cotes return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.baseclass.distribution:distribution.py:352 normal().inv: 3/41 outputs below bounds DEBUG chaospy.distributions.baseclass.distribution:distribution.py:362 normal().inv: 3/41 outputs above bounds ______________ ERROR at setup of test_spectral_variance[sparse4] _______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:152: in generate_quadrature return sparse_grid( chaospy/quadrature/sparse_grid.py:81: in sparse_grid x_lookup, w_lookup = _construct_lookup( chaospy/quadrature/sparse_grid.py:144: in _construct_lookup (abscissas,), weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/legendre.py:145: in legendre_proxy return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=0.1, upper=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.baseclass.distribution:distribution.py:352 normal().inv: 4/43 outputs below bounds DEBUG chaospy.distributions.baseclass.distribution:distribution.py:362 normal().inv: 4/43 outputs above bounds ______________ ERROR at setup of test_spectral_variance[lobatto] _______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/lobatto.py:117: in lobatto for coeffs, lo, up in zip(coefficients, dist.lower, dist.upper) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=1.5, sigma=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________ ERROR at setup of test_spectral_variance[radau] ________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) request = > @pytest.fixture(params=QUADRATURE_RULES) def nodes_and_weights(joint, request): > return chaospy.generate_quadrature(4, joint, **QUADRATURE_RULES[request.param]) tests/test_pseudo_spectral_projection.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/radau.py:123: in radau fixed_point = dist.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=1.5, sigma=0.2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError =================================== FAILURES =================================== ______________________________ test_lagrange_mean ______________________________ lagrange_approximation = polynomial([6.684786058031023e-10*q1**3+4.092726157978177e-12*q0*q1**2+7.750600161671173e-11*q0**2*q1-9.50706180447014...1**2-5.594333072152999*q0*q1-0.02948299002197885*q0**2-3.9670194013865085*q1+0.8575853073698028*q0+0.1726230319503017]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_lagrange_mean(lagrange_approximation, joint, true_mean): > assert numpy.allclose(chaospy.E(lagrange_approximation, joint), true_mean, rtol=1e-3) tests/test_lagrange_polynomials.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ---------------------------- Captured stderr setup ----------------------------- chaospy.lagrange_polynomial name is to be deprecated; Use chaospy.expansion.lagrange instead ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10, dim: 2 -> shape: (2, 10) WARNING chaospy.expansion:__init__.py:25 chaospy.lagrange_polynomial name is to be deprecated; Use chaospy.expansion.lagrange instead ____________________________ test_lagrange_variance ____________________________ lagrange_approximation = polynomial([6.684786058031023e-10*q1**3+4.092726157978177e-12*q0*q1**2+7.750600161671173e-11*q0**2*q1-9.50706180447014...1**2-5.594333072152999*q0*q1-0.02948299002197885*q0**2-3.9670194013865085*q1+0.8575853073698028*q0+0.1726230319503017]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_lagrange_variance(lagrange_approximation, joint, true_variance): > assert numpy.allclose(chaospy.Var(lagrange_approximation, joint), true_variance, rtol=1e-2) tests/test_lagrange_polynomials.py:31: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ---------------------------- Captured stderr setup ----------------------------- chaospy.lagrange_polynomial name is to be deprecated; Use chaospy.expansion.lagrange instead ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10, dim: 2 -> shape: (2, 10) WARNING chaospy.expansion:__init__.py:25 chaospy.lagrange_polynomial name is to be deprecated; Use chaospy.expansion.lagrange instead __________________ test_orthogonality_small[normal-stieltjes] __________________ expansion_small = polynomial([1.0, q0, 0.7071067811865475*q0**2-0.7071067811865475, 0.4082482904638631*q0**3-1.2247448713915892*q0, 0.20412414523193154*q0**4-1.2247448713915892*q0**2+0.6123724356957946]) distribution = Normal(mu=0, sigma=1) def test_orthogonality_small(expansion_small, distribution): > outer = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_orthogonality_small[uniform-stieltjes] __________________ expansion_small = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277661476*q0**3-3.968626966596886*q0, 13.125000000000002*q0**4-11.25*q0**2+1.125]) distribution = Uniform(lower=-1, upper=1) def test_orthogonality_small(expansion_small, distribution): > outer = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________ test_orthogonality_small[exponential-stieltjes] ________________ expansion_small = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, 0.041666666666666664*q0**4-0.6666666666666666*q0**3+3.0*q0**2-4.0*q0+1.0]) distribution = Exponential() def test_orthogonality_small(expansion_small, distribution): > outer = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_orthogonality_small[gamma-stieltjes] ___________________ expansion_small = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, 0.041666666666666664*q0**4-0.6666666666666666*q0**3+3.0*q0**2-4.0*q0+1.0]) distribution = Gamma(1) def test_orthogonality_small(expansion_small, distribution): > outer = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_orthogonality_small[beta-stieltjes] ___________________ expansion_small = polynomial([1.0, 2.6457513110645907*q0, 6.06217782649107*q0**2-0.8660254037844386, 13.162446581088183*q0**3-4.387482193696061*q0, 27.82464622416609*q0**4-15.177079758636047*q0**2+0.8431710977020027]) distribution = Beta(3, 3, lower=-1, upper=1) def test_orthogonality_small(expansion_small, distribution): > outer = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[3], b=[3]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_orthogonality_small[custom-stieltjes] __________________ expansion_small = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277661476*q0**3-3.968626966596886*q0, 13.125000000000002*q0**4-11.25*q0**2+1.125]) distribution = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) def test_orthogonality_small(expansion_small, distribution): > outer = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_orthogonality_large[normal-stieltjes] __________________ expansion_large = polynomial([1.0, q0, 0.7071067811865475*q0**2-0.7071067811865475, 0.4082482904638631*q0**3-1.2247448713915...49475, 0.014085904245475275*q0**7-0.2958039891549808*q0**5+1.4790199457749038*q0**3-1.4790199457749038*q0]) distribution = Normal(mu=0, sigma=1) def test_orthogonality_large(expansion_large, distribution): > outer = chaospy.E(chaospy.outer(expansion_large, expansion_large), distribution) tests/test_orthogonal_expansion.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_orthogonality_large[uniform-stieltjes] __________________ expansion_large = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277...735824966, 103.84436597018637*q0**7-167.74859118260878*q0**5+76.24935962845854*q0**3-8.472151069828726*q0]) distribution = Uniform(lower=-1, upper=1) def test_orthogonality_large(expansion_large, distribution): > outer = chaospy.E(chaospy.outer(expansion_large, expansion_large), distribution) tests/test_orthogonal_expansion.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________ test_orthogonality_large[exponential-stieltjes] ________________ expansion_large = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, ...4*q0**7-0.009722222222222222*q0**6+0.175*q0**5-1.4583333333333333*q0**4+5.833333333333333*q0**3-10.5*q0**2+7.0*q0-1.0]) distribution = Exponential() def test_orthogonality_large(expansion_large, distribution): > outer = chaospy.E(chaospy.outer(expansion_large, expansion_large), distribution) tests/test_orthogonal_expansion.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_orthogonality_large[gamma-stieltjes] ___________________ expansion_large = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, ...4*q0**7-0.009722222222222222*q0**6+0.175*q0**5-1.4583333333333333*q0**4+5.833333333333333*q0**3-10.5*q0**2+7.0*q0-1.0]) distribution = Gamma(1) def test_orthogonality_large(expansion_large, distribution): > outer = chaospy.E(chaospy.outer(expansion_large, expansion_large), distribution) tests/test_orthogonal_expansion.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_orthogonality_large[beta-stieltjes] ___________________ expansion_large = polynomial([1.0, 2.6457513110645907*q0, 6.06217782649107*q0**2-0.8660254037844386, 13.16244658...24325992962, 244.563174832956*q0**7-302.1074512642398*q0**5+100.70248375474658*q0**3-7.746344904211275*q0]) distribution = Beta(3, 3, lower=-1, upper=1) def test_orthogonality_large(expansion_large, distribution): > outer = chaospy.E(chaospy.outer(expansion_large, expansion_large), distribution) tests/test_orthogonal_expansion.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[3], b=[3]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_orthogonality_large[custom-stieltjes] __________________ expansion_large = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277...735824966, 103.84436597018637*q0**7-167.74859118260878*q0**5+76.24935962845854*q0**3-8.472151069828726*q0]) distribution = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) def test_orthogonality_large(expansion_large, distribution): > outer = chaospy.E(chaospy.outer(expansion_large, expansion_large), distribution) tests/test_orthogonal_expansion.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_approx_expansion[normal-stieltjes] ____________________ self = Normal(mu=0, sigma=1), K = array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]) allow_approx = True, kwargs = {} logger = shape = (1, 9), dim = 1, size = 9 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': normal(), 'scale': array([1]), 'shift': array([0])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: expansion_approx = polynomial([1.0, q0, 0.7071067811865475*q0**2-0.7071067811865475, 0.4082482904638631*q0**3-1.2247448713915892*q0, 0.20412414523193154*q0**4-1.2247448713915892*q0**2+0.6123724356957946]) expansion_small = polynomial([1.0, q0, 0.7071067811865475*q0**2-0.7071067811865475, 0.4082482904638631*q0**3-1.2247448713915892*q0, 0.20412414523193154*q0**4-1.2247448713915892*q0**2+0.6123724356957946]) distribution = Normal(mu=0, sigma=1) def test_approx_expansion(expansion_approx, expansion_small, distribution): > outer1 = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Normal(mu=0, sigma=1): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_approx_expansion[uniform-stieltjes] ___________________ self = Uniform(lower=-1, upper=1), K = array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]) allow_approx = True, kwargs = {} logger = shape = (1, 9), dim = 1, size = 9 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': uniform(), 'parameters': {}, 'scale': array([1.]), 'shift': array([0.])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: expansion_approx = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277661476*q0**3-3.968626966596886*q0, 13.125000000000002*q0**4-11.25*q0**2+1.125]) expansion_small = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277661476*q0**3-3.968626966596886*q0, 13.125000000000002*q0**4-11.25*q0**2+1.125]) distribution = Uniform(lower=-1, upper=1) def test_approx_expansion(expansion_approx, expansion_small, distribution): > outer1 = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Uniform(lower=-1, upper=1): has stochastic dependencies; Approximating moments with quadrature. _________________ test_approx_expansion[exponential-stieltjes] _________________ self = Exponential(), K = array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]) allow_approx = True, kwargs = {} logger = shape = (1, 9), dim = 1, size = 9 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': gamma(a=[1]), 'scale': array([1]), 'shift': array([0])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: expansion_approx = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, 0.041666666666666664*q0**4-0.6666666666666666*q0**3+3.0*q0**2-4.0*q0+1.0]) expansion_small = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, 0.041666666666666664*q0**4-0.6666666666666666*q0**3+3.0*q0**2-4.0*q0+1.0]) distribution = Exponential() def test_approx_expansion(expansion_approx, expansion_small, distribution): > outer1 = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Exponential(): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_approx_expansion[gamma-stieltjes] ____________________ self = Gamma(1), K = array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]), allow_approx = True kwargs = {} logger = shape = (1, 9), dim = 1, size = 9 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': gamma(a=[1]), 'scale': array([1]), 'shift': array([0])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: expansion_approx = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, 0.041666666666666664*q0**4-0.6666666666666666*q0**3+3.0*q0**2-4.0*q0+1.0]) expansion_small = polynomial([1.0, q0-1.0, 0.5*q0**2-2.0*q0+1.0, 0.16666666666666666*q0**3-1.5*q0**2+3.0*q0-1.0, 0.041666666666666664*q0**4-0.6666666666666666*q0**3+3.0*q0**2-4.0*q0+1.0]) distribution = Gamma(1) def test_approx_expansion(expansion_approx, expansion_small, distribution): > outer1 = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Gamma(1): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_approx_expansion[beta-stieltjes] _____________________ self = Beta(3, 3, lower=-1, upper=1), K = array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]) allow_approx = True, kwargs = {} logger = shape = (1, 9), dim = 1, size = 9 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(3, 3, lower=-1, upper=1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),) kwargs = {'dist': beta_(a=[3], b=[3]), 'parameters': {'a': array([3]), 'b': array([3])}, 'scale': array([2.]), 'shift': array([-1.])} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: expansion_approx = polynomial([1.0, 2.6457513110645907*q0, 6.06217782649107*q0**2-0.8660254037844386, 13.162446581088183*q0**3-4.387482193696061*q0, 27.82464622416609*q0**4-15.177079758636047*q0**2+0.8431710977020027]) expansion_small = polynomial([1.0, 2.6457513110645907*q0, 6.06217782649107*q0**2-0.8660254037844386, 13.162446581088183*q0**3-4.387482193696061*q0, 27.82464622416609*q0**4-15.177079758636047*q0**2+0.8431710977020027]) distribution = Beta(3, 3, lower=-1, upper=1) def test_approx_expansion(expansion_approx, expansion_small, distribution): > outer1 = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(3, 3, lower=-1, upper=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Beta(3, 3, lower=-1, upper=1): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_approx_expansion[custom-stieltjes] ____________________ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) K = array([[0, 1, 2, 3, 4, 5, 6, 7, 8]]), allow_approx = True, kwargs = {} logger = shape = (1, 9), dim = 1, size = 9 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (array([1]),), kwargs = {} def not_implemented(*args, **kwargs): > raise chaospy.UnsupportedFeature() E chaospy.UnsupportedFeature tests/test_orthogonal_expansion.py:53: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/tests/test_orthogonal_expansion.py", line 53, in not_implemented raise chaospy.UnsupportedFeature() chaospy.UnsupportedFeature During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: expansion_approx = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277661476*q0**3-3.968626966596886*q0, 13.125000000000002*q0**4-11.25*q0**2+1.125]) expansion_small = polynomial([1.0, 1.7320508075688774*q0, 3.354101966249685*q0**2-1.118033988749895, 6.614378277661476*q0**3-3.968626966596886*q0, 13.125000000000002*q0**4-11.25*q0**2+1.125]) distribution = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) def test_approx_expansion(expansion_approx, expansion_small, distribution): > outer1 = chaospy.E(chaospy.outer(expansion_small, expansion_small), distribution) tests/test_orthogonal_expansion.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 UserDistribution( at 0xffffff7e3bd440>, pdf= at 0xffffff7e3bd4e0>, lower= at 0xffffff7e3bd580>, upper= at 0xffffff7e3bd620>, ppf= at 0xffffff7e3bd6c0>, mom= at 0xffffff7e3bd760>, ttr= at 0xffffff7e3bd800>): has stochastic dependencies; Approximating moments with quadrature. ________________________ test_collocation_mean[random] _________________________ collocation_model = polynomial([3.348300181359367e-11*q1**4-7.309299159378982e-12*q0*q1**3-6.794084613348791e-14*q0**2*q1**2-2.94476942684...**2-8.17901603468692*q0*q1+0.0007483947130100331*q0**2-1.816701996663362*q1+0.9395690227304758*q0+0.06515128693931652]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using random rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) __________________ test_collocation_mean[additive_recursion] ___________________ collocation_model = polynomial([-4.9357034845151536e-11*q1**4+5.968261869502639e-13*q0*q1**3+2.873842386080972e-13*q0**2*q1**2+7.611436688...2-8.190352423027248*q0*q1+3.4601348476318144e-05*q0**2-1.8071334267011079*q1+0.940851662155666*q0+0.06432200278160989]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using additive_recursion rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) ________________________ test_collocation_mean[halton] _________________________ collocation_model = polynomial([-1.3240251223931564e-10*q1**4+4.8178396904677114e-12*q0*q1**3+3.34342822002863e-13*q0**2*q1**2+1.047754624...2-8.183594969322671*q0*q1+1.3872317626078466e-05*q0**2-1.813738529470698*q1+0.9405050297028805*q0+0.06471251545849857]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using halton rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) ______________________ test_collocation_mean[hammersley] _______________________ collocation_model = polynomial([-4.15676744233198e-10*q1**4+2.742894229746278e-11*q0*q1**3+1.609727371453414e-12*q0**2*q1**2-1.35022925226...2-8.182858037221267*q0*q1+8.517404461675062e-05*q0**2-1.8138370626045006*q1+0.9404123238813594*q0+0.06473944213145194]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using hammersley rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) ____________________ test_collocation_mean[latin_hypercube] ____________________ collocation_model = polynomial([4.250465063456855e-11*q1**4+6.20602498185385e-13*q0*q1**3-3.560849418998272e-13*q0**2*q1**2+3.414740118261...*2-8.186034791080711*q0*q1+0.0006605255201930891*q0**2-1.8055817402346686*q1+0.940076447838588*q0+0.06452269935364176]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using latin_hypercube rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) ________________________ test_collocation_mean[korobov] ________________________ collocation_model = polynomial([1.3483905536251263e-10*q1**4-4.665025970765683e-11*q0*q1**3-5.988731865168506e-13*q0**2*q1**2+2.1040898943...-8.183445222841254*q0*q1+1.2609895102577967e-05*q0**2-1.8137132996568133*q1+0.9405133007402239*q0+0.06469985877728725]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using korobov rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _________________________ test_collocation_mean[sobol] _________________________ collocation_model = polynomial([-3.364160155204947e-11*q1**4+2.8552640007600357e-13*q0*q1**3-2.405864051887126e-13*q0**2*q1**2+1.667159872...2-8.180999339770965*q0*q1+9.429287142862194e-05*q0**2-1.8157131032200349*q1+0.9403117948000655*q0+0.06484973850370736]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) ______________________ test_collocation_mean[antithetic] _______________________ collocation_model = polynomial([-7.232737699579329e-12*q1**4+9.319036911676727e-21*q0*q1**3-3.973439612111807e-14*q0**2*q1**2+1.3322615107...2-8.183273847283463*q0*q1+5.701365866982384e-05*q0**2-1.8137310317175903*q1+0.9404360585282414*q0+0.06473941485719092]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_collocation_mean(collocation_model, joint, true_mean): > assert numpy.allclose(chaospy.E(collocation_model, joint), true_mean, rtol=1e-6) tests/test_point_collocation.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 2501, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _______________________ test_regression_variance[random] _______________________ collocation_model = polynomial([3.348300181359367e-11*q1**4-7.309299159378982e-12*q0*q1**3-6.794084613348791e-14*q0**2*q1**2-2.94476942684...**2-8.17901603468692*q0*q1+0.0007483947130100331*q0**2-1.816701996663362*q1+0.9395690227304758*q0+0.06515128693931652]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using random rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _________________ test_regression_variance[additive_recursion] _________________ collocation_model = polynomial([-4.9357034845151536e-11*q1**4+5.968261869502639e-13*q0*q1**3+2.873842386080972e-13*q0**2*q1**2+7.611436688...2-8.190352423027248*q0*q1+3.4601348476318144e-05*q0**2-1.8071334267011079*q1+0.940851662155666*q0+0.06432200278160989]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using additive_recursion rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _______________________ test_regression_variance[halton] _______________________ collocation_model = polynomial([-1.3240251223931564e-10*q1**4+4.8178396904677114e-12*q0*q1**3+3.34342822002863e-13*q0**2*q1**2+1.047754624...2-8.183594969322671*q0*q1+1.3872317626078466e-05*q0**2-1.813738529470698*q1+0.9405050297028805*q0+0.06471251545849857]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using halton rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _____________________ test_regression_variance[hammersley] _____________________ collocation_model = polynomial([-4.15676744233198e-10*q1**4+2.742894229746278e-11*q0*q1**3+1.609727371453414e-12*q0**2*q1**2-1.35022925226...2-8.182858037221267*q0*q1+8.517404461675062e-05*q0**2-1.8138370626045006*q1+0.9404123238813594*q0+0.06473944213145194]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using hammersley rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) __________________ test_regression_variance[latin_hypercube] ___________________ collocation_model = polynomial([4.250465063456855e-11*q1**4+6.20602498185385e-13*q0*q1**3-3.560849418998272e-13*q0**2*q1**2+3.414740118261...*2-8.186034791080711*q0*q1+0.0006605255201930891*q0**2-1.8055817402346686*q1+0.940076447838588*q0+0.06452269935364176]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using latin_hypercube rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) ______________________ test_regression_variance[korobov] _______________________ collocation_model = polynomial([1.3483905536251263e-10*q1**4-4.665025970765683e-11*q0*q1**3-5.988731865168506e-13*q0**2*q1**2+2.1040898943...-8.183445222841254*q0*q1+1.2609895102577967e-05*q0**2-1.8137132996568133*q1+0.9405133007402239*q0+0.06469985877728725]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using korobov rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _______________________ test_regression_variance[sobol] ________________________ collocation_model = polynomial([-3.364160155204947e-11*q1**4+2.8552640007600357e-13*q0*q1**3-2.405864051887126e-13*q0**2*q1**2+1.667159872...2-8.180999339770965*q0*q1+9.429287142862194e-05*q0**2-1.8157131032200349*q1+0.9403117948000655*q0+0.06484973850370736]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 10000, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _____________________ test_regression_variance[antithetic] _____________________ collocation_model = polynomial([-7.232737699579329e-12*q1**4+9.319036911676727e-21*q0*q1**3-3.973439612111807e-14*q0**2*q1**2+1.3322615107...2-8.183273847283463*q0*q1+5.701365866982384e-05*q0**2-1.8137310317175903*q1+0.9404360585282414*q0+0.06473941485719092]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(collocation_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(collocation_model, joint), true_variance, rtol=1e-5) tests/test_point_collocation.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 2501, dim: 2 -> shape: (2, 10000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (10000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 10000) _________________________ test_spectral_mean[gaussian] _________________________ spectral_approx = polynomial([-1.0355298953721162e-06*q1**4-2.316244681491494e-07*q0*q1**3+1.6248341859605662e-09*q0**2*q1**2-6.05088573...2-8.183424110515206*q0*q1-7.412546323856373e-11*q0**2-1.8096787799701275*q1+0.9405318033218004*q0+0.06454520973735828]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_spectral_mean(spectral_approx, joint, true_mean): > assert numpy.allclose(chaospy.E(spectral_approx, joint), true_mean) tests/test_pseudo_spectral_projection.py:42: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (25,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 25) _______________________ test_spectral_variance[gaussian] _______________________ spectral_approx = polynomial([-1.0355298953721162e-06*q1**4-2.316244681491494e-07*q0*q1**3+1.6248341859605662e-09*q0**2*q1**2-6.05088573...2-8.183424110515206*q0*q1-7.412546323856373e-11*q0**2-1.8096787799701275*q1+0.9405318033218004*q0+0.06454520973735828]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_spectral_variance(spectral_approx, joint, true_variance): > assert numpy.allclose(chaospy.Var(spectral_approx, joint), true_variance) tests/test_pseudo_spectral_projection.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (25,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 25) __________________________ test_regression_mean[none] __________________________ linear_model = polynomial([-2.458634822301286e-12*q1**4+1.2936799688367713e-12*q0*q1**3+1.6275475279330457e-13*q0**2*q1**2+1.38779763...*2-8.157496000015907*q0*q1+0.0007135176482681394*q0**2-1.8374017868531067*q1+0.9385453397702431*q0+0.0663095180821122]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _________________________ test_regression_mean[linear] _________________________ linear_model = polynomial([-2.458634822301286e-12*q1**4+1.2936799688367713e-12*q0*q1**3+1.6275475279330457e-13*q0**2*q1**2+1.38779763...*2-8.157496000015907*q0*q1+0.0007135176482681394*q0**2-1.8374017868531067*q1+0.9385453397702431*q0+0.0663095180821122]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) ______________________ test_regression_mean[elastic_net] _______________________ linear_model = polynomial([-0.00042087190296079274*q0**3+1.0527980972780296e-05*q1**2+7.684149606523355e-06*q0*q1+0.00194496984036841...*2-0.8945770502637761*q0*q1-0.01649352835019269*q0**2-1.9360577891722057*q1+0.3895060150726821*q0+0.27702687193128417]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _________________________ test_regression_mean[lasso] __________________________ linear_model = polynomial([2.4550815490088493e-05*q0*q1-7.976618748432526e-05*q1+0.9985776876269659*q0+0.002084373547067697, ...2783180713292184, -1.2498139252129266*q0*q1-1.516801310527851*q1+0.419883315058761*q0+0.22772438631017344]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _______________________ test_regression_mean[lasso_lars] _______________________ linear_model = polynomial([0.9974599041890279*q0+0.0037107104433051763, 0.9959684405678998*q0+0.003697985485062505, ....23051650567050053*q0+0.5008462726163146, -3.314177134457105*q1+0.23018641683559088*q0+0.5006139544073942]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) __________________________ test_regression_mean[lars] __________________________ linear_model = polynomial([q0, -0.009993845544930997*q0*q1-1.6741776610665338e-06*q1+0.9999987433340121*q0+2.516315136258...*2-4.752019642573866*q0*q1-0.002285292014593877*q0**2-1.3765153647540975*q1+0.7569339310833504*q0+0.09794944159460842]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) ____________________ test_regression_mean[matching_pursuit] ____________________ linear_model = polynomial([1.0000000000000004*q0-8.881784197001252e-16, 7.511384406414101e-05*q1**2-0.009994966406567477*...**2-5.689333979530234*q0*q1+0.02916291616388584*q0**2-3.7529350676129565*q1+0.7914270363414607*q0+0.19072322988221824]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _________________________ test_regression_mean[ridge] __________________________ linear_model = polynomial([6.305445810472263e-09*q1**4+3.898328061812234e-07*q0*q1**3+4.146337795360787e-06*q0**2*q1**2-3.57933894440...*2-0.5472724586592601*q0*q1+0.08033947767641393*q0**2-2.2490337703499512*q1+0.2604743549694885*q0+0.34753293526925816]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_mean = array([1.5 , 1.4977495 , 1.4955025 , 1.493259 , 1.49101899, 1.48878246, 1.48654941, 1.48431983, 1.482093...08, 0.35280071, 0.35230007, 0.35180017, 0.35130102, 0.35080259, 0.3503049 , 0.34980795, 0.34931173, 0.34881624]) def test_regression_mean(linear_model, joint, true_mean): > assert numpy.allclose(chaospy.E(linear_model, joint), true_mean, rtol=1e-2) tests/test_regression_models.py:35: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) ________________________ test_regression_variance[none] ________________________ linear_model = polynomial([-2.458634822301286e-12*q1**4+1.2936799688367713e-12*q0*q1**3+1.6275475279330457e-13*q0**2*q1**2+1.38779763...*2-8.157496000015907*q0*q1+0.0007135176482681394*q0**2-1.8374017868531067*q1+0.9385453397702431*q0+0.0663095180821122]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _______________________ test_regression_variance[linear] _______________________ linear_model = polynomial([-2.458634822301286e-12*q1**4+1.2936799688367713e-12*q0*q1**3+1.6275475279330457e-13*q0**2*q1**2+1.38779763...*2-8.157496000015907*q0*q1+0.0007135176482681394*q0**2-1.8374017868531067*q1+0.9385453397702431*q0+0.0663095180821122]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) ____________________ test_regression_variance[elastic_net] _____________________ linear_model = polynomial([-0.00042087190296079274*q0**3+1.0527980972780296e-05*q1**2+7.684149606523355e-06*q0*q1+0.00194496984036841...*2-0.8945770502637761*q0*q1-0.01649352835019269*q0**2-1.9360577891722057*q1+0.3895060150726821*q0+0.27702687193128417]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _______________________ test_regression_variance[lasso] ________________________ linear_model = polynomial([2.4550815490088493e-05*q0*q1-7.976618748432526e-05*q1+0.9985776876269659*q0+0.002084373547067697, ...2783180713292184, -1.2498139252129266*q0*q1-1.516801310527851*q1+0.419883315058761*q0+0.22772438631017344]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _____________________ test_regression_variance[lasso_lars] _____________________ linear_model = polynomial([0.9974599041890279*q0+0.0037107104433051763, 0.9959684405678998*q0+0.003697985485062505, ....23051650567050053*q0+0.5008462726163146, -3.314177134457105*q1+0.23018641683559088*q0+0.5006139544073942]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) ________________________ test_regression_variance[lars] ________________________ linear_model = polynomial([q0, -0.009993845544930997*q0*q1-1.6741776610665338e-06*q1+0.9999987433340121*q0+2.516315136258...*2-4.752019642573866*q0*q1-0.002285292014593877*q0**2-1.3765153647540975*q1+0.7569339310833504*q0+0.09794944159460842]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) __________________ test_regression_variance[matching_pursuit] __________________ linear_model = polynomial([1.0000000000000004*q0-8.881784197001252e-16, 7.511384406414101e-05*q1**2-0.009994966406567477*...**2-5.689333979530234*q0*q1+0.02916291616388584*q0**2-3.7529350676129565*q1+0.7914270363414607*q0+0.19072322988221824]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _______________________ test_regression_variance[ridge] ________________________ linear_model = polynomial([6.305445810472263e-09*q1**4+3.898328061812234e-07*q0*q1**3+4.146337795360787e-06*q0**2*q1**2-3.57933894440...*2-0.5472724586592601*q0*q1+0.08033947767641393*q0**2-2.2490337703499512*q1+0.2604743549694885*q0+0.34753293526925816]) joint = J(Normal(mu=1.5, sigma=0.2), Uniform(lower=0.1, upper=0.2)) true_variance = array([0.04 , 0.03988025, 0.03976125, 0.03964299, 0.03952547, 0.03940868, 0.03929261, 0.03917727, 0.039062...67, 0.01243465, 0.01241964, 0.01240463, 0.01238963, 0.01237464, 0.01235965, 0.01234467, 0.01232969, 0.01231473]) def test_regression_variance(linear_model, joint, true_variance): > assert numpy.allclose(chaospy.Var(linear_model, joint), true_variance, rtol=3e-1) tests/test_regression_models.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/variance.py:41: in Var poly = poly - E(poly, dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log setup ------------------------------ DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using sobol rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 1000, dim: 2 -> shape: (2, 1000) DEBUG numpoly.poly_function.call:call.py:85 poly shape: (15,) DEBUG numpoly.poly_function.call:call.py:86 parameter common shape: (1000,) DEBUG numpoly.poly_function.call:call.py:87 output shape: (15, 1000) _______________________________ test_orthogonals _______________________________ def test_orthogonals(): dist = cp.Iid(cp.Normal(), dim) > cp.expansion.gram_schmidt(order, dist) tests/test_stress.py:53: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/expansion/gram_schmidt.py:82: in gram_schmidt orth = chaospy.E(basis[idx] * polynomials[idy], dist, **kws) chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________________________ test_quadrature ________________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_quadrature(): dist = cp.Iid(cp.Normal(), dim) gq = cp.generate_quadrature > nodes, weights = gq(order, dist, rule="C") tests/test_stress.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ____________________________ test_approx_quadrature ____________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_approx_quadrature(): dist = cp.Iid(normal(), dim) > nodes, weights = cp.generate_quadrature(order, dist, rule="C") tests/test_stress.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________________________ test_integration _______________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_integration(): dist = cp.Iid(cp.Normal(), dim) orth, norms = cp.expansion.stieltjes(order, dist, retall=1) gq = cp.generate_quadrature > nodes, weights = gq(order, dist, rule="C") tests/test_stress.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/frontend.py:192: in generate_quadrature _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ______________________________ test_descriptives _______________________________ def test_descriptives(): dist = cp.Iid(cp.Normal(), dim) orth = cp.expansion.stieltjes(order, dist) > cp.E(orth, dist) tests/test_stress.py:94: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________________ test_1d_dependent_bounds ___________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_1d_dependent_bounds(): """Ensure lower and upper bounds works for dependent 1-D distributions.""" > assert numpy.isclose(DIST2.lower, 0) tests/distributions/test_1d_dependencies.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(Uniform(lower=1, upper=2)) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________________ test_approximate_moment ____________________________ monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xffffff7e12d400> def test_approximate_moment(monkeypatch): """Assert that approximate moments is doing its job.""" > ref_moments = DIST.mom([1, 2, 3, 4]) tests/distributions/test_approximation.py:31: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_distribution_addition[Alpha] _______________________ self = Add(Alpha(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Alpha(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Alpha(1), 2.0), keys = array([1]), left = Alpha(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1), kloc = array([1]), dist = alpha(a=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = alpha(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = alpha(a=[1]), kloc = array([1], dtype=uint32), kwargs = {'a': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: alpha(a=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: alpha(a=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Alpha(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ______________________ test_distribution_addition[Anglit] ______________________ self = Add(Anglit(), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Anglit(), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Anglit(), 2.0), keys = array([1]), left = Anglit() right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit(), kloc = array([1]), dist = anglit(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = anglit(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = anglit(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: anglit(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: anglit(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Anglit(), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[ArcSinus] _____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[0.5], b=[0.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[PowerLaw] _____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[1], b=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_distribution_addition[Wigner] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[1.5], b=[1.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[Bradford] _____________________ self = Add(Bradford(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Bradford(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Bradford(1), 2.0), keys = array([1]), left = Bradford(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1), kloc = array([1]), dist = bradford(c=[1]) scale = array([1.]), shift = array([0.]) def _mom(self, kloc, dist, scale, shift, parameters): del parameters poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) > out = sum( dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ) chaospy/distributions/baseclass/lower_upper.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .0 = out = sum( > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ) chaospy/distributions/baseclass/lower_upper.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = bradford(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = bradford(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: bradford(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/lower_upper.py", line 101, in _mom out = sum( ^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/lower_upper.py", line 102, in dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: bradford(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Bradford(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _______________________ test_distribution_addition[Burr] _______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = burr(alpha=[1], kappa=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_distribution_addition[Cauchy] ______________________ self = Add(Cauchy(), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Cauchy(), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Cauchy(), 2.0), keys = array([1]), left = Cauchy() right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy(), kloc = array([1]), dist = cauchy(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cauchy(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cauchy(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: cauchy(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: cauchy(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Cauchy(), 2.0): has stochastic dependencies; Approximating moments with quadrature. _______________________ test_distribution_addition[Chi] ________________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi(df=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[Maxwell] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi(df=[3]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[Rayleigh] _____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi(df=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_addition[ChiSquared] ____________________ self = Add(ChiSquared(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ChiSquared(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ChiSquared(1), 2.0), keys = array([1]), left = ChiSquared(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1), kloc = array([1]), dist = chi_squared(df=[1], nc=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi_squared(df=[1], nc=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi_squared(df=[1], nc=[1]), kloc = array([1], dtype=uint32) kwargs = {'df': array([1]), 'nc': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: chi_squared(df=[1], nc=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: chi_squared(df=[1], nc=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(ChiSquared(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_addition[DoubleGamma] ____________________ self = Add(DoubleGamma(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleGamma(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleGamma(1), 2.0), keys = array([1]), left = DoubleGamma(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1), kloc = array([1]), dist = double_gamma(a=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_gamma(a=[1]), kloc = array([1], dtype=uint32) kwargs = {'a': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: double_gamma(a=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: double_gamma(a=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(DoubleGamma(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_addition[DoubleWeibull] ___________________ self = Add(DoubleWeibull(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleWeibull(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleWeibull(1), 2.0), keys = array([1]), left = DoubleWeibull(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1), kloc = array([1]), dist = double_weibull(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_weibull(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_weibull(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: double_weibull(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: double_weibull(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(DoubleWeibull(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _________________ test_distribution_addition[ExponentialPower] _________________ self = Add(ExponentialPower(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialPower(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialPower(1), 2.0), keys = array([1]) left = ExponentialPower(1), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1), kloc = array([1]), dist = exponential_power(b=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_power(b=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_power(b=[1]), kloc = array([1], dtype=uint32) kwargs = {'b': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: exponential_power(b=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: exponential_power(b=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(ExponentialPower(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ________________ test_distribution_addition[ExponentialWeibull] ________________ self = Add(ExponentialWeibull(1, 1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialWeibull(1, 1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialWeibull(1, 1), 2.0), keys = array([1]) left = ExponentialWeibull(1, 1), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1), kloc = array([1]) dist = exponential_weibull(a=[1], c=[1]), shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_weibull(a=[1], c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_weibull(a=[1], c=[1]), kloc = array([1], dtype=uint32) kwargs = {'a': array([1]), 'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: exponential_weibull(a=[1], c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: exponential_weibull(a=[1], c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(ExponentialWeibull(1, 1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ________________________ test_distribution_addition[F] _________________________ self = Add(F(2, 10, nc=0), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(F(2, 10, nc=0), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(F(2, 10, nc=0), 2.0), keys = array([1]), left = F(2, 10, nc=0) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0), kloc = array([1]), dist = f(2, 10, nc=0) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = f(2, 10, nc=0), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = f(2, 10, nc=0), kloc = array([1], dtype=uint32) kwargs = {'dfd': array([10]), 'dfn': array([2]), 'nc': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: f(2, 10, nc=0): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: f(2, 10, nc=0): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(F(2, 10, nc=0), 2.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_addition[FatigueLife] ____________________ self = Add(FatigueLife(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FatigueLife(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FatigueLife(1), 2.0), keys = array([1]), left = FatigueLife(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1), kloc = array([1]), dist = fatigue_life(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fatigue_life(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fatigue_life(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: fatigue_life(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: fatigue_life(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(FatigueLife(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _______________________ test_distribution_addition[Fisk] _______________________ self = Add(Fisk(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Fisk(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Fisk(1), 2.0), keys = array([1]), left = Fisk(1), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1), kloc = array([1]), dist = fisk(c=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fisk(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fisk(c=[1]), kloc = array([1], dtype=uint32), kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: fisk(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: fisk(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Fisk(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_addition[FoldedCauchy] ___________________ self = Add(FoldedCauchy(0), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedCauchy(0), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedCauchy(0), 2.0), keys = array([1]), left = FoldedCauchy(0) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0), kloc = array([1]), dist = folded_cauchy(c=[0]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_cauchy(c=[0]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_cauchy(c=[0]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: folded_cauchy(c=[0]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: folded_cauchy(c=[0]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(FoldedCauchy(0), 2.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_addition[FoldedNormal] ___________________ self = Add(FoldedNormal(0), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedNormal(0), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedNormal(0), 2.0), keys = array([1]), left = FoldedNormal(0) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0), kloc = array([1]), dist = folded_normal(c=[0]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_normal(c=[0]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_normal(c=[0]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: folded_normal(c=[0]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: folded_normal(c=[0]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(FoldedNormal(0), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Frechet] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = frechet(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_distribution_addition[Gamma] _______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_distribution_addition[Exponential] ____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________ test_distribution_addition[GeneralizedExponential] ______________ self = Add(GeneralizedExponential(1, 1, 1), 2.0), K = array([[1]]) allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExponential(1, 1, 1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExponential(1, 1, 1), 2.0), keys = array([1]) left = GeneralizedExponential(1, 1, 1), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1), kloc = array([1]) dist = generalized_exponential(a=[1], b=[1], c=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_exponential(a=[1], b=[1], c=[1]) kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_exponential(a=[1], b=[1], c=[1]) kloc = array([1], dtype=uint32) kwargs = {'a': array([1]), 'b': array([1]), 'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: generalized_exponential(a=[1], b=[1], c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: generalized_exponential(a=[1], b=[1], c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(GeneralizedExponential(1, 1, 1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ________________ test_distribution_addition[GeneralizedExtreme] ________________ self = Add(GeneralizedExtreme(0), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExtreme(0), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExtreme(0), 2.0), keys = array([1]) left = GeneralizedExtreme(0), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0), kloc = array([1]) dist = generalized_extreme(c=[0]), shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_extreme(c=[0]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_extreme(c=[0]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: generalized_extreme(c=[0]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: generalized_extreme(c=[0]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(GeneralizedExtreme(0), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Laplace] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = laplace(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________________ test_distribution_addition[Levy] _______________________ self = Add(Levy(), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Levy(), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Levy(), 2.0), keys = array([1]), left = Levy(), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy(), kloc = array([1]), dist = levy(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = levy(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = levy(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: levy(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: levy(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Levy(), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[LogGamma] _____________________ self = Add(LogGamma(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogGamma(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogGamma(1), 2.0), keys = array([1]), left = LogGamma(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1), kloc = array([1]), dist = log_gamma(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_gamma(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_gamma(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: log_gamma(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: log_gamma(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(LogGamma(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_addition[LogLaplace] ____________________ self = Add(LogLaplace(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogLaplace(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogLaplace(1), 2.0), keys = array([1]), left = LogLaplace(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1), kloc = array([1]), dist = log_laplace(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_laplace(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_laplace(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: log_laplace(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: log_laplace(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(LogLaplace(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_addition[LogNormal] _____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[Gilbrat] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_addition[LogUniform] ____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_uniform(lo=[0], up=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_addition[LogWeibull] ____________________ self = Add(LogWeibull(), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogWeibull(), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogWeibull(), 2.0), keys = array([1]), left = LogWeibull() right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull(), kloc = array([1]), dist = log_weibull(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_weibull(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_weibull(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: log_weibull(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: log_weibull(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(LogWeibull(), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Logistic] _____________________ self = Add(Logistic(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Logistic(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Logistic(1), 2.0), keys = array([1]), left = Logistic(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1), kloc = array([1]), dist = logistic(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = logistic(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = logistic(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: logistic(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: logistic(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Logistic(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ______________________ test_distribution_addition[Mielke] ______________________ self = Add(Mielke(1, 1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Mielke(1, 1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Mielke(1, 1), 2.0), keys = array([1]), left = Mielke(1, 1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1), kloc = array([1]), dist = mielke(k=[1], s=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = mielke(k=[1], s=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = mielke(k=[1], s=[1]), kloc = array([1], dtype=uint32) kwargs = {'k': array([1]), 's': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: mielke(k=[1], s=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: mielke(k=[1], s=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Mielke(1, 1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Nakagami] _____________________ self = Add(Nakagami(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Nakagami(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Nakagami(1), 2.0), keys = array([1]), left = Nakagami(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1), kloc = array([1]), dist = nakagami(nu=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = nakagami(nu=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = nakagami(nu=[1]), kloc = array([1], dtype=uint32) kwargs = {'nu': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: nakagami(nu=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: nakagami(nu=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Nakagami(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ______________________ test_distribution_addition[Normal] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[Pareto1] ______________________ self = Add(Pareto1(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto1(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto1(1), 2.0), keys = array([1]), left = Pareto1(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1), kloc = array([1]), dist = pareto1(b=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto1(b=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto1(b=[1]), kloc = array([1], dtype=uint32) kwargs = {'b': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: pareto1(b=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: pareto1(b=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Pareto1(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Pareto2] ______________________ self = Add(Pareto2(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto2(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto2(1), 2.0), keys = array([1]), left = Pareto2(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1), kloc = array([1]), dist = pareto2(c=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto2(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto2(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: pareto2(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: pareto2(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Pareto2(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_addition[PowerLogNormal] __________________ self = Add(PowerLogNormal(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerLogNormal(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerLogNormal(1), 2.0), keys = array([1]), left = PowerLogNormal(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1), kloc = array([1]) dist = ShiftScaleDistribution(c=[1], s=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ShiftScaleDistribution(c=[1], s=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ShiftScaleDistribution(c=[1], s=[1]), kloc = array([1], dtype=uint32) dist = power_log_normal(c=[1], s=[1]), shift = array([0]), scale = array([1.]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_log_normal(c=[1], s=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_log_normal(c=[1], s=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1]), 's': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: power_log_normal(c=[1], s=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: power_log_normal(c=[1], s=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(PowerLogNormal(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_addition[PowerNormal] ____________________ self = Add(PowerNormal(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerNormal(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerNormal(1), 2.0), keys = array([1]), left = PowerNormal(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1), kloc = array([1]), dist = power_normal(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_normal(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_normal(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: power_normal(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: power_normal(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(PowerNormal(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[StudentT] _____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_addition[Triangle] _____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = triangle(a=[0.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_distribution_addition[TruncExponential] _________________ self = Add(TruncExponential(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TruncExponential(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TruncExponential(1), 2.0), keys = array([1]) left = TruncExponential(1), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1), kloc = array([1]), dist = truncexpon(b=[1.]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = truncexpon(b=[1.]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = truncexpon(b=[1.]), kloc = array([1], dtype=uint32) kwargs = {'b': array([1.])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: truncexpon(b=[1.]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: truncexpon(b=[1.]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(TruncExponential(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_addition[TruncNormal] ____________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = trunc_normal(lower=-inf, upper=inf, mu=0, sigma=1) n = array([1], dtype=uint32), a = array([-inf]), b = array([inf]) mu = array([0]), sigma = array([1]) def _mom(self, n, a, b, mu, sigma): > return truncnorm.moment(int(n), a, b, loc=mu, scale=sigma) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/collection/trunc_normal.py:50: DeprecationWarning ___________________ test_distribution_addition[TukeyLambda] ____________________ self = Add(TukeyLambda(1), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TukeyLambda(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TukeyLambda(1), 2.0), keys = array([1]), left = TukeyLambda(1) right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1), kloc = array([1]), dist = tukey_lambda(lam=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = tukey_lambda(lam=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = tukey_lambda(lam=[1]), kloc = array([1], dtype=uint32) kwargs = {'lam': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: tukey_lambda(lam=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: tukey_lambda(lam=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(TukeyLambda(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Uniform] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________________ test_distribution_addition[Wald] _______________________ self = Add(Wald(1), 2.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Wald(1), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Wald(1), 2.0), keys = array([1]), left = Wald(1), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1), kloc = array([1]), dist = wald(mu=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wald(mu=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wald(mu=[1]), kloc = array([1], dtype=uint32) kwargs = {'mu': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: wald(mu=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: wald(mu=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Wald(1), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_addition[Weibull] ______________________ distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = weibull(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_distribution_addition[WrappedCauchy] ___________________ self = Add(WrappedCauchy(0.5), 2.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(WrappedCauchy(0.5), 2.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(WrappedCauchy(0.5), 2.0), keys = array([1]) left = WrappedCauchy(0.5), right = array([2.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5), kloc = array([1]), dist = wrapped_cauchy(c=[0.5]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wrapped_cauchy(c=[0.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wrapped_cauchy(c=[0.5]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0.5])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: wrapped_cauchy(c=[0.5]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: wrapped_cauchy(c=[0.5]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_addition(distribution): """Assert adding.""" > right_addition = chaospy.E(distribution()+2.0) tests/distributions/test_arithmetics.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(WrappedCauchy(0.5), 2.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_subtraction[Alpha] _____________________ self = Add(Alpha(1), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Alpha(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Alpha(1), -3.0), keys = array([1]), left = Alpha(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1), kloc = array([1]), dist = alpha(a=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = alpha(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = alpha(a=[1]), kloc = array([1], dtype=uint32), kwargs = {'a': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: alpha(a=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: alpha(a=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Alpha(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Anglit] _____________________ self = Add(Anglit(), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Anglit(), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Anglit(), -3.0), keys = array([1]), left = Anglit() right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit(), kloc = array([1]), dist = anglit(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = anglit(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = anglit(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: anglit(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: anglit(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Anglit(), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_subtraction[ArcSinus] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[0.5], b=[0.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_distribution_subtraction[PowerLaw] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[1], b=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_subtraction[Wigner] _____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[1.5], b=[1.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_distribution_subtraction[Bradford] ____________________ self = Add(Bradford(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Bradford(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Bradford(1), -3.0), keys = array([1]), left = Bradford(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1), kloc = array([1]), dist = bradford(c=[1]) scale = array([1.]), shift = array([0.]) def _mom(self, kloc, dist, scale, shift, parameters): del parameters poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) > out = sum( dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ) chaospy/distributions/baseclass/lower_upper.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .0 = out = sum( > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ) chaospy/distributions/baseclass/lower_upper.py:102: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = bradford(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = bradford(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: bradford(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/lower_upper.py", line 101, in _mom out = sum( ^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/lower_upper.py", line 102, in dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: bradford(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Bradford(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_subtraction[Burr] ______________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = burr(alpha=[1], kappa=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_subtraction[Cauchy] _____________________ self = Add(Cauchy(), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Cauchy(), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Cauchy(), -3.0), keys = array([1]), left = Cauchy() right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy(), kloc = array([1]), dist = cauchy(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cauchy(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = cauchy(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: cauchy(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: cauchy(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Cauchy(), -3.0): has stochastic dependencies; Approximating moments with quadrature. ______________________ test_distribution_subtraction[Chi] ______________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi(df=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_subtraction[Maxwell] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi(df=[3]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_distribution_subtraction[Rayleigh] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi(df=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_distribution_subtraction[ChiSquared] ___________________ self = Add(ChiSquared(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ChiSquared(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ChiSquared(1), -3.0), keys = array([1]), left = ChiSquared(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1), kloc = array([1]), dist = chi_squared(df=[1], nc=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi_squared(df=[1], nc=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = chi_squared(df=[1], nc=[1]), kloc = array([1], dtype=uint32) kwargs = {'df': array([1]), 'nc': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: chi_squared(df=[1], nc=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: chi_squared(df=[1], nc=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(ChiSquared(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_subtraction[DoubleGamma] __________________ self = Add(DoubleGamma(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleGamma(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleGamma(1), -3.0), keys = array([1]), left = DoubleGamma(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1), kloc = array([1]), dist = double_gamma(a=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_gamma(a=[1]), kloc = array([1], dtype=uint32) kwargs = {'a': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: double_gamma(a=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: double_gamma(a=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(DoubleGamma(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. _________________ test_distribution_subtraction[DoubleWeibull] _________________ self = Add(DoubleWeibull(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleWeibull(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(DoubleWeibull(1), -3.0), keys = array([1]), left = DoubleWeibull(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1), kloc = array([1]), dist = double_weibull(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_weibull(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = double_weibull(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: double_weibull(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: double_weibull(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(DoubleWeibull(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. _______________ test_distribution_subtraction[ExponentialPower] ________________ self = Add(ExponentialPower(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialPower(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialPower(1), -3.0), keys = array([1]) left = ExponentialPower(1), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1), kloc = array([1]), dist = exponential_power(b=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_power(b=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_power(b=[1]), kloc = array([1], dtype=uint32) kwargs = {'b': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: exponential_power(b=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: exponential_power(b=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(ExponentialPower(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ______________ test_distribution_subtraction[ExponentialWeibull] _______________ self = Add(ExponentialWeibull(1, 1), -3.0), K = array([[1]]) allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialWeibull(1, 1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(ExponentialWeibull(1, 1), -3.0), keys = array([1]) left = ExponentialWeibull(1, 1), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1), kloc = array([1]) dist = exponential_weibull(a=[1], c=[1]), shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_weibull(a=[1], c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exponential_weibull(a=[1], c=[1]), kloc = array([1], dtype=uint32) kwargs = {'a': array([1]), 'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: exponential_weibull(a=[1], c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: exponential_weibull(a=[1], c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(ExponentialWeibull(1, 1), -3.0): has stochastic dependencies; Approximating moments with quadrature. _______________________ test_distribution_subtraction[F] _______________________ self = Add(F(2, 10, nc=0), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(F(2, 10, nc=0), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(F(2, 10, nc=0), -3.0), keys = array([1]), left = F(2, 10, nc=0) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0), kloc = array([1]), dist = f(2, 10, nc=0) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = f(2, 10, nc=0), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = f(2, 10, nc=0), kloc = array([1], dtype=uint32) kwargs = {'dfd': array([10]), 'dfn': array([2]), 'nc': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: f(2, 10, nc=0): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: f(2, 10, nc=0): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(F(2, 10, nc=0), -3.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_subtraction[FatigueLife] __________________ self = Add(FatigueLife(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FatigueLife(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FatigueLife(1), -3.0), keys = array([1]), left = FatigueLife(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1), kloc = array([1]), dist = fatigue_life(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fatigue_life(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fatigue_life(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: fatigue_life(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: fatigue_life(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(FatigueLife(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. _____________________ test_distribution_subtraction[Fisk] ______________________ self = Add(Fisk(1), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Fisk(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Fisk(1), -3.0), keys = array([1]), left = Fisk(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1), kloc = array([1]), dist = fisk(c=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fisk(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fisk(c=[1]), kloc = array([1], dtype=uint32), kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: fisk(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: fisk(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Fisk(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. _________________ test_distribution_subtraction[FoldedCauchy] __________________ self = Add(FoldedCauchy(0), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedCauchy(0), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedCauchy(0), -3.0), keys = array([1]), left = FoldedCauchy(0) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0), kloc = array([1]), dist = folded_cauchy(c=[0]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_cauchy(c=[0]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_cauchy(c=[0]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: folded_cauchy(c=[0]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: folded_cauchy(c=[0]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(FoldedCauchy(0), -3.0): has stochastic dependencies; Approximating moments with quadrature. _________________ test_distribution_subtraction[FoldedNormal] __________________ self = Add(FoldedNormal(0), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedNormal(0), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(FoldedNormal(0), -3.0), keys = array([1]), left = FoldedNormal(0) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0), kloc = array([1]), dist = folded_normal(c=[0]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_normal(c=[0]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = folded_normal(c=[0]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: folded_normal(c=[0]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: folded_normal(c=[0]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(FoldedNormal(0), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Frechet] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = frechet(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_subtraction[Gamma] _____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_distribution_subtraction[Exponential] __________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________ test_distribution_subtraction[GeneralizedExponential] _____________ self = Add(GeneralizedExponential(1, 1, 1), -3.0), K = array([[1]]) allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExponential(1, 1, 1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExponential(1, 1, 1), -3.0), keys = array([1]) left = GeneralizedExponential(1, 1, 1), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1), kloc = array([1]) dist = generalized_exponential(a=[1], b=[1], c=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_exponential(a=[1], b=[1], c=[1]) kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_exponential(a=[1], b=[1], c=[1]) kloc = array([1], dtype=uint32) kwargs = {'a': array([1]), 'b': array([1]), 'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: generalized_exponential(a=[1], b=[1], c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: generalized_exponential(a=[1], b=[1], c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(GeneralizedExponential(1, 1, 1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ______________ test_distribution_subtraction[GeneralizedExtreme] _______________ self = Add(GeneralizedExtreme(0), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExtreme(0), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(GeneralizedExtreme(0), -3.0), keys = array([1]) left = GeneralizedExtreme(0), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0), kloc = array([1]) dist = generalized_extreme(c=[0]), shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_extreme(c=[0]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = generalized_extreme(c=[0]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: generalized_extreme(c=[0]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: generalized_extreme(c=[0]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(GeneralizedExtreme(0), -3.0): has stochastic dependencies; Approximating moments with quadrature. _______________ test_distribution_subtraction[HyperbolicSecant] ________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" right_subtraction = chaospy.E(distribution()-3.0) > left_subtraction = chaospy.E(3.0-distribution()) tests/distributions/test_arithmetics.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(3.0, Negative(HyperbolicSecant())), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log call ------------------------------- DEBUG chaospy.distributions.baseclass.distribution:distribution.py:669 Add(HyperbolicSecant(), -3.0): moment calculated successfully ____________________ test_distribution_subtraction[Laplace] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = laplace(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_subtraction[Levy] ______________________ self = Add(Levy(), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Levy(), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Levy(), -3.0), keys = array([1]), left = Levy(), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy(), kloc = array([1]), dist = levy(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = levy(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = levy(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: levy(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: levy(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Levy(), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_subtraction[LogGamma] ____________________ self = Add(LogGamma(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogGamma(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogGamma(1), -3.0), keys = array([1]), left = LogGamma(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1), kloc = array([1]), dist = log_gamma(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_gamma(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_gamma(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: log_gamma(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: log_gamma(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(LogGamma(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_subtraction[LogLaplace] ___________________ self = Add(LogLaplace(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogLaplace(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogLaplace(1), -3.0), keys = array([1]), left = LogLaplace(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1), kloc = array([1]), dist = log_laplace(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_laplace(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_laplace(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: log_laplace(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: log_laplace(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(LogLaplace(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_subtraction[LogNormal] ___________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_subtraction[Gilbrat] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_distribution_subtraction[LogUniform] ___________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_uniform(lo=[0], up=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_distribution_subtraction[LogWeibull] ___________________ self = Add(LogWeibull(), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogWeibull(), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(LogWeibull(), -3.0), keys = array([1]), left = LogWeibull() right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull(), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull(), kloc = array([1]), dist = log_weibull(), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_weibull(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_weibull(), kloc = array([1], dtype=uint32), kwargs = {} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: log_weibull(): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: log_weibull(): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(LogWeibull(), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_subtraction[Logistic] ____________________ self = Add(Logistic(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Logistic(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Logistic(1), -3.0), keys = array([1]), left = Logistic(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1), kloc = array([1]), dist = logistic(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = logistic(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = logistic(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: logistic(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: logistic(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Logistic(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Mielke] _____________________ self = Add(Mielke(1, 1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Mielke(1, 1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Mielke(1, 1), -3.0), keys = array([1]), left = Mielke(1, 1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1), kloc = array([1]), dist = mielke(k=[1], s=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = mielke(k=[1], s=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = mielke(k=[1], s=[1]), kloc = array([1], dtype=uint32) kwargs = {'k': array([1]), 's': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: mielke(k=[1], s=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: mielke(k=[1], s=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Mielke(1, 1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_subtraction[Nakagami] ____________________ self = Add(Nakagami(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Nakagami(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Nakagami(1), -3.0), keys = array([1]), left = Nakagami(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1), kloc = array([1]), dist = nakagami(nu=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = nakagami(nu=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = nakagami(nu=[1]), kloc = array([1], dtype=uint32) kwargs = {'nu': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: nakagami(nu=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: nakagami(nu=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Nakagami(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Normal] _____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ____________________ test_distribution_subtraction[Pareto1] ____________________ self = Add(Pareto1(1), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto1(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto1(1), -3.0), keys = array([1]), left = Pareto1(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1), kloc = array([1]), dist = pareto1(b=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto1(b=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto1(b=[1]), kloc = array([1], dtype=uint32) kwargs = {'b': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: pareto1(b=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: pareto1(b=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Pareto1(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Pareto2] ____________________ self = Add(Pareto2(1), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto2(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Pareto2(1), -3.0), keys = array([1]), left = Pareto2(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1), kloc = array([1]), dist = pareto2(c=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto2(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = pareto2(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: pareto2(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: pareto2(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Pareto2(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ________________ test_distribution_subtraction[PowerLogNormal] _________________ self = Add(PowerLogNormal(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerLogNormal(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerLogNormal(1), -3.0), keys = array([1]), left = PowerLogNormal(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1), kloc = array([1]) dist = ShiftScaleDistribution(c=[1], s=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ShiftScaleDistribution(c=[1], s=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ShiftScaleDistribution(c=[1], s=[1]), kloc = array([1], dtype=uint32) dist = power_log_normal(c=[1], s=[1]), shift = array([0]), scale = array([1.]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_log_normal(c=[1], s=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_log_normal(c=[1], s=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1]), 's': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: power_log_normal(c=[1], s=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: power_log_normal(c=[1], s=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(PowerLogNormal(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_subtraction[PowerNormal] __________________ self = Add(PowerNormal(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerNormal(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(PowerNormal(1), -3.0), keys = array([1]), left = PowerNormal(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1), kloc = array([1]), dist = power_normal(c=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_normal(c=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = power_normal(c=[1]), kloc = array([1], dtype=uint32) kwargs = {'c': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: power_normal(c=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: power_normal(c=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(PowerNormal(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_subtraction[StudentT] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________ test_distribution_subtraction[Triangle] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = triangle(a=[0.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________ test_distribution_subtraction[TruncExponential] ________________ self = Add(TruncExponential(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TruncExponential(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TruncExponential(1), -3.0), keys = array([1]) left = TruncExponential(1), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1), kloc = array([1]), dist = truncexpon(b=[1.]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = truncexpon(b=[1.]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = truncexpon(b=[1.]), kloc = array([1], dtype=uint32) kwargs = {'b': array([1.])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: truncexpon(b=[1.]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: truncexpon(b=[1.]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(TruncExponential(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. __________________ test_distribution_subtraction[TruncNormal] __________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = trunc_normal(lower=-inf, upper=inf, mu=0, sigma=1) n = array([1], dtype=uint32), a = array([-inf]), b = array([inf]) mu = array([0]), sigma = array([1]) def _mom(self, n, a, b, mu, sigma): > return truncnorm.moment(int(n), a, b, loc=mu, scale=sigma) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/collection/trunc_normal.py:50: DeprecationWarning __________________ test_distribution_subtraction[TukeyLambda] __________________ self = Add(TukeyLambda(1), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TukeyLambda(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(TukeyLambda(1), -3.0), keys = array([1]), left = TukeyLambda(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1), kloc = array([1]), dist = tukey_lambda(lam=[1]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = tukey_lambda(lam=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = tukey_lambda(lam=[1]), kloc = array([1], dtype=uint32) kwargs = {'lam': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: tukey_lambda(lam=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: tukey_lambda(lam=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(TukeyLambda(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Uniform] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _____________________ test_distribution_subtraction[Wald] ______________________ self = Add(Wald(1), -3.0), K = array([[1]]), allow_approx = True, kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Wald(1), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Wald(1), -3.0), keys = array([1]), left = Wald(1) right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1), kloc = array([1]), dist = wald(mu=[1]), shift = array([0]) scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wald(mu=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wald(mu=[1]), kloc = array([1], dtype=uint32) kwargs = {'mu': array([1])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: wald(mu=[1]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: wald(mu=[1]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(Wald(1), -3.0): has stochastic dependencies; Approximating moments with quadrature. ____________________ test_distribution_subtraction[Weibull] ____________________ distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = weibull(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_distribution_subtraction[WrappedCauchy] _________________ self = Add(WrappedCauchy(0.5), -3.0), K = array([[1]]), allow_approx = True kwargs = {} logger = shape = (1, 1), dim = 1, size = 1 def mom(self, K, allow_approx=True, **kwargs): """ Raw statistical moments. Creates non-centralized raw moments from the random variable. If analytical options can not be utilized, Monte Carlo integration will be used. Args: K (numpy.ndarray): Index of the raw moments. k.shape must be compatible with distribution shape. Sampling scheme when performing Monte Carlo allow_approx (bool): Allow the moments to be calculated using quadrature integration if analytical approach fails. Raises error instead if false. kwargs (Any): Arguments passed to :func:`chaospy.approximate_moment` if approximation is used. Raises: chaospy.UnsupportedFeature: If analytical calculation is not possible and `allow_approx` is false. Returns: (numpy.ndarray): Shapes are related through the identity ``k.shape == dist.shape+k.shape``. """ logger = logging.getLogger(__name__) K = numpy.asarray(K, dtype=int) assert numpy.all(K >= 0) shape = K.shape dim = len(self) if dim > 1: assert len(self) == shape[0] shape = shape[1:] size = int(K.size / dim) K = K.reshape(dim, size) try: > out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:668: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(WrappedCauchy(0.5), -3.0), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(WrappedCauchy(0.5), -3.0), keys = array([1]) left = WrappedCauchy(0.5), right = array([-3.]) def _mom(self, keys, left, right, cache): """ Statistical moments. Example: >>> chaospy.Uniform().mom([0, 1, 2, 3]).round(4) array([1. , 0.5 , 0.3333, 0.25 ]) >>> chaospy.Add(chaospy.Uniform(), 2).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) >>> chaospy.Add(2, chaospy.Uniform()).mom([0, 1, 2, 3]).round(4) array([ 1. , 2.5 , 6.3333, 16.25 ]) """ del cache keys_ = numpy.mgrid[tuple(slice(0, key + 1, 1) for key in keys)] keys_ = keys_.reshape(len(self), -1) if isinstance(left, Distribution): if chaospy.shares_dependencies(left, right): raise chaospy.StochasticallyDependentError( "%s: left and right side of sum stochastically dependent." % self ) > left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/operators/addition.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5), kdata = array([1]) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5), kloc = array([1]), dist = wrapped_cauchy(c=[0.5]) shift = array([0]), scale = array([1]) def _mom(self, kloc, dist, shift, scale): poly = numpoly.variable(len(self)) poly = numpoly.sum(scale * poly, axis=-1) + shift poly = numpoly.set_dimensions(numpoly.prod(poly**kloc), len(self)) out = sum( [ > dist._get_mom(key) * coeff for key, coeff in zip(poly.exponents, poly.coefficients) ] ) chaospy/distributions/baseclass/shift_scale.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wrapped_cauchy(c=[0.5]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/distribution.py:693: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wrapped_cauchy(c=[0.5]), kloc = array([1], dtype=uint32) kwargs = {'c': array([0.5])} def _mom(self, kloc, **kwargs): """Default moment generator, throws error.""" > raise chaospy.UnsupportedFeature( "%s: does not support analytical raw moments." % self ) E chaospy.UnsupportedFeature: wrapped_cauchy(c=[0.5]): does not support analytical raw moments. chaospy/distributions/baseclass/simple.py:110: UnsupportedFeature During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 668, in mom out = [self._get_mom(kdata) for kdata in K.T] ^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/operators/addition.py", line 189, in _mom left = [left._get_mom(key) for key in keys_.T] ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/shift_scale.py", line 110, in _mom dist._get_mom(key) * coeff ^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/distribution.py", line 693, in _get_mom ret_val = float(self._mom(kdata, **parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/baseclass/simple.py", line 110, in _mom raise chaospy.UnsupportedFeature( chaospy.UnsupportedFeature: wrapped_cauchy(c=[0.5]): does not support analytical raw moments. During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = def test_distribution_subtraction(distribution): """Test distribution subtraction.""" > right_subtraction = chaospy.E(distribution()-3.0) tests/distributions/test_arithmetics.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:677: in mom out = [chaospy.approximate_moment(self, kdata) for kdata in K.T] chaospy/distributions/approximation.py:212: in approximate_moment MOMENTS_QUADS[distribution, order] = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:231: in _generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ------------------------------ Captured log call ------------------------------- INFO chaospy.distributions.baseclass.distribution:distribution.py:672 Add(WrappedCauchy(0.5), -3.0): has stochastic dependencies; Approximating moments with quadrature. ___________________ test_distribution_inverse_bounds[Alpha] ____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Alpha(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Alpha(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________ test_distribution_inverse_bounds[Anglit] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Anglit() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Anglit() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[ArcSinus] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = ArcSinus(0.5) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ArcSinus(0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[PowerLaw] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = PowerLaw(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLaw(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________ test_distribution_inverse_bounds[Wigner] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Wigner(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wigner(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Bradford] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Bradford(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Bradford(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ____________________ test_distribution_inverse_bounds[Burr] ____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Burr(1, 1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Burr(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________ test_distribution_inverse_bounds[Cauchy] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Cauchy() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Cauchy() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ____________________ test_distribution_inverse_bounds[Chi] _____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Chi(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Chi(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Maxwell] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Maxwell() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Maxwell() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Rayleigh] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Rayleigh() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Rayleigh() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_distribution_inverse_bounds[ChiSquared] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = ChiSquared(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ChiSquared(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[DoubleGamma] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = DoubleGamma(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleGamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________ test_distribution_inverse_bounds[DoubleWeibull] ________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = DoubleWeibull(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = DoubleWeibull(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ______________ test_distribution_inverse_bounds[ExponentialPower] ______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = ExponentialPower(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialPower(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _____________ test_distribution_inverse_bounds[ExponentialWeibull] _____________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = ExponentialWeibull(1, 1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ExponentialWeibull(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _____________________ test_distribution_inverse_bounds[F] ______________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = F(2, 10, nc=0) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = F(2, 10, nc=0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[FatigueLife] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = FatigueLife(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FatigueLife(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ____________________ test_distribution_inverse_bounds[Fisk] ____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Fisk(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Fisk(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[FoldedCauchy] ________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = FoldedCauchy(0) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedCauchy(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[FoldedNormal] ________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = FoldedNormal(0) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = FoldedNormal(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Frechet] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Frechet(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Frechet(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________ test_distribution_inverse_bounds[Gamma] ____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Gamma(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[Exponential] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Exponential() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________ test_distribution_inverse_bounds[GeneralizedExponential] ___________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = GeneralizedExponential(1, 1, 1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExponential(1, 1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _____________ test_distribution_inverse_bounds[GeneralizedExtreme] _____________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = GeneralizedExtreme(0) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = GeneralizedExtreme(0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ______________ test_distribution_inverse_bounds[HyperbolicSecant] ______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = HyperbolicSecant() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = HyperbolicSecant() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Laplace] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Laplace() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Laplace() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ____________________ test_distribution_inverse_bounds[Levy] ____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Levy() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Levy() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[LogGamma] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = LogGamma(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogGamma(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_distribution_inverse_bounds[LogLaplace] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = LogLaplace(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogLaplace(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_distribution_inverse_bounds[LogNormal] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = LogNormal(mu=0, sigma=1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogNormal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Gilbrat] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Gilbrat() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gilbrat() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_distribution_inverse_bounds[LogUniform] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = LogUniform(0, 1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogUniform(0, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_distribution_inverse_bounds[LogWeibull] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = LogWeibull() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogWeibull() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Logistic] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Logistic(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Logistic(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________ test_distribution_inverse_bounds[Mielke] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Mielke(1, 1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Mielke(1, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Nakagami] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Nakagami(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Nakagami(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________ test_distribution_inverse_bounds[Normal] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Normal(mu=0, sigma=1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Pareto1] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Pareto1(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto1(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Pareto2] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Pareto2(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Pareto2(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________ test_distribution_inverse_bounds[PowerLogNormal] _______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = PowerLogNormal(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerLogNormal(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[PowerNormal] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = PowerNormal(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PowerNormal(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[StudentT] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = StudentT(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = StudentT(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Triangle] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Triangle(-1, 0, 1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Triangle(-1, 0, 1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ______________ test_distribution_inverse_bounds[TruncExponential] ______________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = TruncExponential(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncExponential(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[TruncNormal] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = TruncNormal() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TruncNormal() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_distribution_inverse_bounds[TukeyLambda] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = TukeyLambda(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = TukeyLambda(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Uniform] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Uniform() def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ____________________ test_distribution_inverse_bounds[Wald] ____________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Wald(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Wald(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError __________________ test_distribution_inverse_bounds[Weibull] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = Weibull(1) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Weibull(1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________ test_distribution_inverse_bounds[WrappedCauchy] ________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: distribution = WrappedCauchy(0.5) def test_distribution_inverse_bounds(distribution): """Assert the inverse transformation spans out inside the bounds.""" distribution = distribution() # assert numpy.isclose(distribution.lower, distribution.inv(0)) # assert numpy.isclose(distribution.upper, distribution.inv(1)) > assert distribution.lower < distribution.inv(0.001) tests/distributions/test_arithmetics.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = WrappedCauchy(0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________________ test_distribution_exclusion __________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_distribution_exclusion(): """ Check if illegal reuse of dependencies raises errors correctly. Dependencies transformed in a non-bijective way can not be reused. For example, here a truncation of a distribution can not be use together with said distribution without truncation. """ dist1 = chaospy.Uniform(-1, 1) > dist2 = chaospy.Trunc(dist1, 0) tests/distributions/test_baseclass.py:15: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/operators/truncation.py:77: in __init__ upper = upper_ = dist.upper _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=1) @property def upper(self): """Upper bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_upper(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:157: ValueError ______________________________ test_triangle_init ______________________________ name = 'lower', value = Add(Uniform(), -1.0) def _get_triang_param_lb_and_ub(name, value): try: > lb = ub = float(value) E TypeError: float() argument must be a string or a real number, not 'Add' chaospy/distributions/collection/triangle.py:11: TypeError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/collection/triangle.py", line 11, in _get_triang_param_lb_and_ub lb = ub = float(value) ^^^^^^^^^^^^ TypeError: float() argument must be a string or a real number, not 'Add' During handling of the above exception, another exception occurred: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_triangle_init(): """Assert that initialization checks lower and upper bounds.""" # Should just run u = cp.Uniform(0., 1.) > t = cp.Triangle(u - 1., u, u + 1.) tests/distributions/collection/test_triangle.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/collection/triangle.py:99: in __init__ _, lower_ub = _get_triang_param_lb_and_ub("lower", lower) chaospy/distributions/collection/triangle.py:13: in _get_triang_param_lb_and_ub if hasattr(value, "lower") and hasattr(value, "upper"): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Uniform(), -1.0) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________________ test_sampling_statistics ___________________________ def test_sampling_statistics(): dists = chaospy.Iid(chaospy.Normal(2, 2), 4) corr = numpy.array([[ 1.0, -0.2, 0.3, -0.1], [-0.2, 1.0, 0.0, -0.2], [ 0.3, 0.0, 1.0, 0.4], [-0.1, -0.2, 0.4, 1.0]]) copula = chaospy.Nataf(dists, corr) samples = copula.sample(100000) > assert numpy.allclose(numpy.mean(samples, axis=-1), chaospy.E(dists), atol=1e-2, rtol=1e-2) tests/distributions/copulas/test_nataf.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ------------------------------ Captured log call ------------------------------- DEBUG chaospy.distributions.sampler.generator:generator.py:102 generating random samples using random rule DEBUG chaospy.distributions.sampler.generator:generator.py:106 order: 100000, dim: 4 -> shape: (4, 100000) ___________________________ test_dist_addition_lower ___________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_dist_addition_lower(): > assert (UNIVARIATE+4).lower == 2 tests/distributions/operators/test_addition.py:32: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Uniform(lower=-2, upper=3), 4) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________________ test_dist_addition_upper ___________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_dist_addition_upper(): > assert (UNIVARIATE+4).upper == 7 tests/distributions/operators/test_addition.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Add(Uniform(lower=-2, upper=3), 4) @property def upper(self): """Upper bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_upper(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:157: ValueError __________________________ test_dist_addition_moment ___________________________ def test_dist_addition_moment(): > assert (UNIVARIATE+4).mom(1) == 4.5 tests/distributions/operators/test_addition.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/addition.py:189: in _mom left = [left._get_mom(key) for key in keys_.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ___________________________ test_dist_multiply_lower ___________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_dist_multiply_lower(): > assert (UNIVARIATE*4).lower == -8 tests/distributions/operators/test_multiply.py:32: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Multiply(Uniform(lower=-2, upper=3), 4) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ___________________________ test_dist_multiply_upper ___________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_dist_multiply_upper(): > assert (UNIVARIATE*4).upper == 12 tests/distributions/operators/test_multiply.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Multiply(Uniform(lower=-2, upper=3), 4) @property def upper(self): """Upper bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_upper(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:157: ValueError __________________________ test_dist_multiply_moment ___________________________ def test_dist_multiply_moment(): > assert (UNIVARIATE*4).mom(1) == 2 tests/distributions/operators/test_multiply.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/multiply.py:293: in _mom left = left._get_mom(key) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________________ test_truncation_lower_as_dist _________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_truncation_lower_as_dist(): """Ensure lower bound as a distribution is supported.""" dist1 = chaospy.Normal() > dist2 = chaospy.Trunc(chaospy.Normal(), lower=dist1) tests/distributions/operators/test_truncation.py:9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/operators/truncation.py:64: in __init__ lower_ = lower.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________________ test_truncation_upper_as_dist _________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_truncation_upper_as_dist(): """Ensure upper bound as a distribution is supported.""" dist1 = chaospy.Normal() > dist2 = chaospy.Trunc(chaospy.Normal(), upper=dist1) tests/distributions/operators/test_truncation.py:19: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/operators/truncation.py:66: in __init__ lower = lower_ = dist.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________________ test_truncation_both_as_dist _________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_truncation_both_as_dist(): """Ensure that lower and upper bound combo is supported.""" dist1 = chaospy.Normal() dist2 = chaospy.Normal() > dist3 = chaospy.Trunc(chaospy.Normal(), lower=dist1, upper=dist2) tests/distributions/operators/test_truncation.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/operators/truncation.py:64: in __init__ lower_ = lower.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=0, sigma=1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________________ test_trucation_multivariate __________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: def test_trucation_multivariate(): """Ensure that multivariate bounds works as expected.""" dist1 = chaospy.Iid(chaospy.Normal(), 2) > dist2 = chaospy.Trunc(chaospy.Iid(chaospy.Normal(), 2), lower=dist1, upper=[1, 1]) tests/distributions/operators/test_truncation.py:44: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/operators/truncation.py:64: in __init__ lower_ = lower.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Iid(Normal(mu=0, sigma=1), 2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_1d_quadrature_creation[beta-chebyshev] __________________ analytical_distribution = Beta(4, 2), recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[4], b=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_1d_quadrature_creation[beta-lanczos] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Beta(4, 2), recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(4, 2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_1d_quadrature_creation[beta-stieltjes] __________________ analytical_distribution = Beta(4, 2), recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[4], b=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_1d_quadrature_creation[expon-chebyshev] _________________ analytical_distribution = Exponential(), recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_1d_quadrature_creation[expon-lanczos] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Exponential(), recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_1d_quadrature_creation[expon-stieltjes] _________________ analytical_distribution = Exponential(), recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_1d_quadrature_creation[gamma-chebyshev] _________________ analytical_distribution = Gamma(2, scale=2), recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_1d_quadrature_creation[gamma-lanczos] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Gamma(2, scale=2), recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(2, scale=2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_1d_quadrature_creation[gamma-stieltjes] _________________ analytical_distribution = Gamma(2, scale=2), recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_1d_quadrature_creation[lognorm-chebyshev] ________________ analytical_distribution = LogNormal(mu=-10, sigma=0.1) recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[0.1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_1d_quadrature_creation[lognorm-lanczos] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = LogNormal(mu=-10, sigma=0.1) recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogNormal(mu=-10, sigma=0.1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_1d_quadrature_creation[lognorm-stieltjes] ________________ analytical_distribution = LogNormal(mu=-10, sigma=0.1) recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[0.1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_1d_quadrature_creation[normal-chebyshev] _________________ analytical_distribution = Normal(mu=2, sigma=3) recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_1d_quadrature_creation[normal-lanczos] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Normal(mu=2, sigma=3) recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=2, sigma=3) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_1d_quadrature_creation[normal-stieltjes] _________________ analytical_distribution = Normal(mu=2, sigma=3) recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_1d_quadrature_creation[student-chebyshev] ________________ analytical_distribution = StudentT(25, mu=0.5) recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[25]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_1d_quadrature_creation[student-lanczos] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = StudentT(25, mu=0.5), recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = StudentT(25, mu=0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_1d_quadrature_creation[student-stieltjes] ________________ analytical_distribution = StudentT(25, mu=0.5) recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[25]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_1d_quadrature_creation[uniform-chebyshev] ________________ analytical_distribution = Uniform(lower=-1, upper=2) recurrence_algorithm = 'chebyshev' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_1d_quadrature_creation[uniform-lanczos] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Uniform(lower=-1, upper=2) recurrence_algorithm = 'lanczos' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" > abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_1d_quadrature_creation[uniform-stieltjes] ________________ analytical_distribution = Uniform(lower=-1, upper=2) recurrence_algorithm = 'stieltjes' def test_1d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 1-D quadrature rule.""" abscissas, weights = chaospy.quadrature.gaussian( order=8, dist=analytical_distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (1, 9) assert weights.shape == (9,) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), analytical_distribution.mom(1)) tests/recurrence/test_quadrature_creation.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[beta-chebyshev] __________________ analytical_distribution = Beta(4, 2), recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[4], b=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_3d_quadrature_creation[beta-lanczos] ___________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Beta(4, 2), recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(4, 2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_3d_quadrature_creation[beta-stieltjes] __________________ analytical_distribution = Beta(4, 2), recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[4], b=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[expon-chebyshev] _________________ analytical_distribution = Exponential(), recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_3d_quadrature_creation[expon-lanczos] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Exponential(), recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_3d_quadrature_creation[expon-stieltjes] _________________ analytical_distribution = Exponential(), recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[gamma-chebyshev] _________________ analytical_distribution = Gamma(2, scale=2), recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning __________________ test_3d_quadrature_creation[gamma-lanczos] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Gamma(2, scale=2), recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(2, scale=2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _________________ test_3d_quadrature_creation[gamma-stieltjes] _________________ analytical_distribution = Gamma(2, scale=2), recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_3d_quadrature_creation[lognorm-chebyshev] ________________ analytical_distribution = LogNormal(mu=-10, sigma=0.1) recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[0.1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[lognorm-lanczos] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = LogNormal(mu=-10, sigma=0.1) recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogNormal(mu=-10, sigma=0.1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_3d_quadrature_creation[lognorm-stieltjes] ________________ analytical_distribution = LogNormal(mu=-10, sigma=0.1) recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[0.1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_3d_quadrature_creation[normal-chebyshev] _________________ analytical_distribution = Normal(mu=2, sigma=3) recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[normal-lanczos] __________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Normal(mu=2, sigma=3) recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=2, sigma=3) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_3d_quadrature_creation[normal-stieltjes] _________________ analytical_distribution = Normal(mu=2, sigma=3) recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_3d_quadrature_creation[student-chebyshev] ________________ analytical_distribution = StudentT(25, mu=0.5) recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[25]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[student-lanczos] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = StudentT(25, mu=0.5), recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = StudentT(25, mu=0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_3d_quadrature_creation[student-stieltjes] ________________ analytical_distribution = StudentT(25, mu=0.5) recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[25]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________ test_3d_quadrature_creation[uniform-chebyshev] ________________ analytical_distribution = Uniform(lower=-1, upper=2) recurrence_algorithm = 'chebyshev' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:110: in construct_recurrence_coefficients moments = dist.mom(numpy.arange(2 * (order + 1), dtype=int)) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _________________ test_3d_quadrature_creation[uniform-lanczos] _________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Uniform(lower=-1, upper=2) recurrence_algorithm = 'lanczos' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) > abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) tests/recurrence/test_quadrature_creation.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/quadrature/gaussian.py:81: in gaussian coefficients = chaospy.construct_recurrence_coefficients( chaospy/recurrence/frontend.py:92: in construct_recurrence_coefficients construct_recurrence_coefficients( chaospy/recurrence/frontend.py:114: in construct_recurrence_coefficients coeffs = lanczos(order, dist, rule=rule, tolerance=tolerance) chaospy/recurrence/lanczos.py:90: in lanczos [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________ test_3d_quadrature_creation[uniform-stieltjes] ________________ analytical_distribution = Uniform(lower=-1, upper=2) recurrence_algorithm = 'stieltjes' def test_3d_quadrature_creation( analytical_distribution, recurrence_algorithm): """Check 3-D quadrature rule.""" distribution = chaospy.Iid(analytical_distribution, 3) abscissas, weights = chaospy.quadrature.gaussian( order=3, dist=distribution, recurrence_algorithm=recurrence_algorithm, ) assert abscissas.shape == (3, 4**3) assert weights.shape == (4**3,) kloc = numpy.eye(3, dtype=int) > assert numpy.allclose(numpy.sum(abscissas*weights, -1), distribution.mom(kloc)) tests/recurrence/test_quadrature_creation.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/operators/joint.py:169: in _mom output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx]) chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________________ test_analytical_stieltjes[beta] ________________________ analytical_distribution = Beta(4, 2) def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = beta_(a=[4], b=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________________ test_analytical_stieltjes[expon] _______________________ analytical_distribution = Exponential() def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning _______________________ test_analytical_stieltjes[gamma] _______________________ analytical_distribution = Gamma(2, scale=2) def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = gamma(a=[2]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_analytical_stieltjes[lognorm] ______________________ analytical_distribution = LogNormal(mu=-10, sigma=0.1) def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = log_normal(a=[0.1]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_analytical_stieltjes[normal] _______________________ analytical_distribution = Normal(mu=2, sigma=3) def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = normal(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_analytical_stieltjes[student] ______________________ analytical_distribution = StudentT(25, mu=0.5) def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/shift_scale.py:110: in _mom dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = student_t(a=[25]), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ______________________ test_analytical_stieltjes[uniform] ______________________ analytical_distribution = Uniform(lower=-1, upper=2) def test_analytical_stieltjes(analytical_distribution): """Assert that Analytical Stieltjes produces orthogonality.""" coeffs, [orth], norms = chaospy.analytical_stieltjes( order=4, dist=analytical_distribution) assert orth[0] == 1 > assert numpy.allclose(chaospy.E(orth[1:], analytical_distribution), 0) tests/recurrence/test_stieltjes_method.py:12: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/descriptives/expected.py:42: in E moments = dist.mom(poly.exponents.T, **kws) chaospy/distributions/baseclass/distribution.py:668: in mom out = [self._get_mom(kdata) for kdata in K.T] chaospy/distributions/baseclass/distribution.py:693: in _get_mom ret_val = float(self._mom(kdata, **parameters)) chaospy/distributions/baseclass/lower_upper.py:101: in _mom out = sum( chaospy/distributions/baseclass/lower_upper.py:102: in dist._get_mom(key) * coeff _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = uniform(), kdata = array([1], dtype=uint32) def _get_mom(self, kdata): """In-process function for getting moments.""" if tuple(kdata) in self._mom_cache: return self._mom_cache[tuple(kdata)] if hasattr(self, "get_mom_parameters"): parameters = self.get_mom_parameters() else: parameters = self.get_parameters(idx=None, cache={}, assert_numerical=False) assert "idx" not in parameters, (self, parameters) > ret_val = float(self._mom(kdata, **parameters)) E DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) chaospy/distributions/baseclass/distribution.py:693: DeprecationWarning ________________________ test_stieltjes_compared[beta] _________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Beta(4, 2) def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Beta(4, 2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________________ test_stieltjes_compared[expon] ________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Exponential() def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Exponential() @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError ________________________ test_stieltjes_compared[gamma] ________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Gamma(2, scale=2) def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Gamma(2, scale=2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________________ test_stieltjes_compared[lognorm] _______________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = LogNormal(mu=-10, sigma=0.1) def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = LogNormal(mu=-10, sigma=0.1) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________________ test_stieltjes_compared[normal] ________________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Normal(mu=2, sigma=3) def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Normal(mu=2, sigma=3) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________________ test_stieltjes_compared[student] _______________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = StudentT(25, mu=0.5) def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = StudentT(25, mu=0.5) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError _______________________ test_stieltjes_compared[uniform] _______________________ DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.) The above exception was the direct cause of the following exception: analytical_distribution = Uniform(lower=-1, upper=2) def test_stieltjes_compared(analytical_distribution): """Assert that discretized and analytical approach are equivalent.""" (alpha0, beta0), [orth0], norms0 = chaospy.analytical_stieltjes( order=3, dist=analytical_distribution) > (alpha1, beta1), [orth1], norms1 = chaospy.discretized_stieltjes( order=3, dist=analytical_distribution) tests/recurrence/test_stieltjes_method.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chaospy/recurrence/stieltjes.py:140: in discretized_stieltjes [abscissas], weights = chaospy.generate_quadrature( chaospy/quadrature/frontend.py:171: in generate_quadrature abscissas, weights = _generate_quadrature( chaospy/quadrature/frontend.py:287: in _generate_quadrature abscissas, weights = quad_function(order, dist, **parameters) chaospy/quadrature/clenshaw_curtis.py:67: in clenshaw_curtis return hypercube_quadrature( chaospy/quadrature/hypercube.py:87: in hypercube_quadrature return quad_func(**kwargs) chaospy/quadrature/hypercube.py:293: in distribution_to_domain lower = distribution.lower _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Uniform(lower=-1, upper=2) @property def lower(self): """Lower bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: > out[idx] = self._get_lower(idx, cache=cache) E ValueError: setting an array element with a sequence. chaospy/distributions/baseclass/distribution.py:129: ValueError =============================== warnings summary =============================== tests/test_regression_models.py::test_regression_mean[matching_pursuit] tests/test_regression_models.py::test_regression_variance[matching_pursuit] /usr/lib64/python3.12/site-packages/sklearn/linear_model/_omp.py:780: RuntimeWarning: Orthogonal matching pursuit ended prematurely due to linear dependence in the dictionary. The requested precision might not have been met. coef_, self.n_iter_ = orthogonal_mp_gram( tests/distributions/test_arithmetics.py::test_distribution_addition[GeneralizedExtreme] tests/distributions/test_arithmetics.py::test_distribution_subtraction[GeneralizedExtreme] tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[GeneralizedExtreme] /builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/collection/generalized_extreme.py:15: RuntimeWarning: invalid value encountered in divide out = numpy.where(c == 0, -3.5, -numpy.expm1(c * 3.5) / c) tests/distributions/test_arithmetics.py::test_distribution_addition[GeneralizedExtreme] tests/distributions/test_arithmetics.py::test_distribution_subtraction[GeneralizedExtreme] tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[GeneralizedExtreme] /builddir/build/BUILD/chaospy-4.3.13/chaospy/distributions/collection/generalized_extreme.py:16: RuntimeWarning: divide by zero encountered in divide out = numpy.where(c < 0, 1.0 / c, out) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED tests/test_lagrange_polynomials.py::test_lagrange_mean - DeprecationWa... FAILED tests/test_lagrange_polynomials.py::test_lagrange_variance - Deprecati... FAILED tests/test_orthogonal_expansion.py::test_orthogonality_small[normal-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_small[uniform-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_small[exponential-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_small[gamma-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_small[beta-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_small[custom-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_large[normal-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_large[uniform-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_large[exponential-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_large[gamma-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_large[beta-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_orthogonality_large[custom-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_approx_expansion[normal-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_approx_expansion[uniform-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_approx_expansion[exponential-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_approx_expansion[gamma-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_approx_expansion[beta-stieltjes] FAILED tests/test_orthogonal_expansion.py::test_approx_expansion[custom-stieltjes] FAILED tests/test_point_collocation.py::test_collocation_mean[random] - Depre... FAILED tests/test_point_collocation.py::test_collocation_mean[additive_recursion] FAILED tests/test_point_collocation.py::test_collocation_mean[halton] - Depre... FAILED tests/test_point_collocation.py::test_collocation_mean[hammersley] - D... FAILED tests/test_point_collocation.py::test_collocation_mean[latin_hypercube] FAILED tests/test_point_collocation.py::test_collocation_mean[korobov] - Depr... FAILED tests/test_point_collocation.py::test_collocation_mean[sobol] - Deprec... FAILED tests/test_point_collocation.py::test_collocation_mean[antithetic] - D... FAILED tests/test_point_collocation.py::test_regression_variance[random] - De... FAILED tests/test_point_collocation.py::test_regression_variance[additive_recursion] FAILED tests/test_point_collocation.py::test_regression_variance[halton] - De... FAILED tests/test_point_collocation.py::test_regression_variance[hammersley] FAILED tests/test_point_collocation.py::test_regression_variance[latin_hypercube] FAILED tests/test_point_collocation.py::test_regression_variance[korobov] - D... FAILED tests/test_point_collocation.py::test_regression_variance[sobol] - Dep... FAILED tests/test_point_collocation.py::test_regression_variance[antithetic] FAILED tests/test_pseudo_spectral_projection.py::test_spectral_mean[gaussian] FAILED tests/test_pseudo_spectral_projection.py::test_spectral_variance[gaussian] FAILED tests/test_regression_models.py::test_regression_mean[none] - Deprecat... FAILED tests/test_regression_models.py::test_regression_mean[linear] - Deprec... FAILED tests/test_regression_models.py::test_regression_mean[elastic_net] - D... FAILED tests/test_regression_models.py::test_regression_mean[lasso] - Depreca... FAILED tests/test_regression_models.py::test_regression_mean[lasso_lars] - De... FAILED tests/test_regression_models.py::test_regression_mean[lars] - Deprecat... FAILED tests/test_regression_models.py::test_regression_mean[matching_pursuit] FAILED tests/test_regression_models.py::test_regression_mean[ridge] - Depreca... FAILED tests/test_regression_models.py::test_regression_variance[none] - Depr... FAILED tests/test_regression_models.py::test_regression_variance[linear] - De... FAILED tests/test_regression_models.py::test_regression_variance[elastic_net] FAILED tests/test_regression_models.py::test_regression_variance[lasso] - Dep... FAILED tests/test_regression_models.py::test_regression_variance[lasso_lars] FAILED tests/test_regression_models.py::test_regression_variance[lars] - Depr... FAILED tests/test_regression_models.py::test_regression_variance[matching_pursuit] FAILED tests/test_regression_models.py::test_regression_variance[ridge] - Dep... FAILED tests/test_stress.py::test_orthogonals - DeprecationWarning: Conversio... FAILED tests/test_stress.py::test_quadrature - ValueError: setting an array e... FAILED tests/test_stress.py::test_approx_quadrature - ValueError: setting an ... FAILED tests/test_stress.py::test_integration - ValueError: setting an array ... FAILED tests/test_stress.py::test_descriptives - DeprecationWarning: Conversi... FAILED tests/distributions/test_1d_dependencies.py::test_1d_dependent_bounds FAILED tests/distributions/test_approximation.py::test_approximate_moment - D... FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Alpha] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Anglit] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[ArcSinus] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[PowerLaw] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Wigner] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Bradford] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Burr] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Cauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Chi] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Maxwell] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Rayleigh] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[ChiSquared] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[DoubleGamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[DoubleWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[ExponentialPower] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[ExponentialWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[F] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[FatigueLife] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Fisk] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[FoldedCauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[FoldedNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Frechet] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Gamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Exponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[GeneralizedExponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[GeneralizedExtreme] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Laplace] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Levy] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[LogGamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[LogLaplace] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[LogNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Gilbrat] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[LogUniform] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[LogWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Logistic] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Mielke] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Nakagami] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Normal] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Pareto1] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Pareto2] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[PowerLogNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[PowerNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[StudentT] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Triangle] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[TruncExponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[TruncNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[TukeyLambda] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Uniform] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Wald] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[Weibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_addition[WrappedCauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Alpha] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Anglit] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[ArcSinus] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[PowerLaw] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Wigner] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Bradford] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Burr] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Cauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Chi] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Maxwell] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Rayleigh] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[ChiSquared] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[DoubleGamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[DoubleWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[ExponentialPower] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[ExponentialWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[F] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[FatigueLife] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Fisk] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[FoldedCauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[FoldedNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Frechet] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Gamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Exponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[GeneralizedExponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[GeneralizedExtreme] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[HyperbolicSecant] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Laplace] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Levy] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[LogGamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[LogLaplace] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[LogNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Gilbrat] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[LogUniform] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[LogWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Logistic] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Mielke] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Nakagami] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Normal] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Pareto1] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Pareto2] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[PowerLogNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[PowerNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[StudentT] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Triangle] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[TruncExponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[TruncNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[TukeyLambda] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Uniform] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Wald] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[Weibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_subtraction[WrappedCauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Alpha] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Anglit] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[ArcSinus] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[PowerLaw] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Wigner] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Bradford] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Burr] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Cauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Chi] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Maxwell] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Rayleigh] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[ChiSquared] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[DoubleGamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[DoubleWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[ExponentialPower] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[ExponentialWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[F] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[FatigueLife] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Fisk] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[FoldedCauchy] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[FoldedNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Frechet] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Gamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Exponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[GeneralizedExponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[GeneralizedExtreme] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[HyperbolicSecant] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Laplace] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Levy] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[LogGamma] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[LogLaplace] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[LogNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Gilbrat] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[LogUniform] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[LogWeibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Logistic] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Mielke] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Nakagami] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Normal] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Pareto1] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Pareto2] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[PowerLogNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[PowerNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[StudentT] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Triangle] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[TruncExponential] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[TruncNormal] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[TukeyLambda] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Uniform] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Wald] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[Weibull] FAILED tests/distributions/test_arithmetics.py::test_distribution_inverse_bounds[WrappedCauchy] FAILED tests/distributions/test_baseclass.py::test_distribution_exclusion - V... FAILED tests/distributions/collection/test_triangle.py::test_triangle_init - ... FAILED tests/distributions/copulas/test_nataf.py::test_sampling_statistics - ... FAILED tests/distributions/operators/test_addition.py::test_dist_addition_lower FAILED tests/distributions/operators/test_addition.py::test_dist_addition_upper FAILED tests/distributions/operators/test_addition.py::test_dist_addition_moment FAILED tests/distributions/operators/test_multiply.py::test_dist_multiply_lower FAILED tests/distributions/operators/test_multiply.py::test_dist_multiply_upper FAILED tests/distributions/operators/test_multiply.py::test_dist_multiply_moment FAILED tests/distributions/operators/test_truncation.py::test_truncation_lower_as_dist FAILED tests/distributions/operators/test_truncation.py::test_truncation_upper_as_dist FAILED tests/distributions/operators/test_truncation.py::test_truncation_both_as_dist FAILED tests/distributions/operators/test_truncation.py::test_trucation_multivariate FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[beta-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[beta-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[beta-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[expon-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[expon-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[expon-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[gamma-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[gamma-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[gamma-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[lognorm-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[lognorm-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[lognorm-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[normal-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[normal-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[normal-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[student-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[student-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[student-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[uniform-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[uniform-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_1d_quadrature_creation[uniform-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[beta-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[beta-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[beta-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[expon-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[expon-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[expon-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[gamma-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[gamma-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[gamma-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[lognorm-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[lognorm-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[lognorm-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[normal-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[normal-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[normal-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[student-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[student-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[student-stieltjes] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[uniform-chebyshev] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[uniform-lanczos] FAILED tests/recurrence/test_quadrature_creation.py::test_3d_quadrature_creation[uniform-stieltjes] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[beta] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[expon] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[gamma] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[lognorm] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[normal] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[student] FAILED tests/recurrence/test_stieltjes_method.py::test_analytical_stieltjes[uniform] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[beta] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[expon] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[gamma] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[lognorm] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[normal] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[student] FAILED tests/recurrence/test_stieltjes_method.py::test_stieltjes_compared[uniform] ERROR tests/test_intrusive_galerkin.py::test_galerkin_mean - DeprecationWarni... ERROR tests/test_intrusive_galerkin.py::test_galerkin_variance - DeprecationW... ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[discrete-stieltjes] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[discrete-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[normal-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[uniform-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[exponential-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[gamma-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[beta-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_small[custom-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[discrete-stieltjes] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[discrete-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[normal-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[uniform-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[exponential-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[gamma-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[beta-cholesky] ERROR tests/test_orthogonal_expansion.py::test_orthogonality_large[custom-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[discrete-stieltjes] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[discrete-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[normal-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[uniform-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[exponential-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[gamma-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[beta-cholesky] ERROR tests/test_orthogonal_expansion.py::test_approx_expansion[custom-cholesky] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_mean[sparse1] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_mean[sparse2] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_mean[sparse3] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_mean[sparse4] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_mean[lobatto] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_mean[radau] - V... ERROR tests/test_pseudo_spectral_projection.py::test_spectral_variance[sparse1] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_variance[sparse2] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_variance[sparse3] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_variance[sparse4] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_variance[lobatto] ERROR tests/test_pseudo_spectral_projection.py::test_spectral_variance[radau] ===== 285 failed, 65 passed, 8 warnings, 38 errors in 12447.45s (3:27:27) ====== error: Bad exit status from /var/tmp/rpm-tmp.Lb1fRx (%check) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.Lb1fRx (%check) Child return code was: 1 EXCEPTION: [Error('Command failed: \n # bash --login -c /usr/bin/rpmbuild -ba --noprep --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec\n', 1)] Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace result = func(*args, **kw) ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mockbuild/util.py", line 597, in do_with_status raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode) mockbuild.exception.Error: Command failed: # bash --login -c /usr/bin/rpmbuild -ba --noprep --noclean --target noarch --nodeps /builddir/build/SPECS/python-chaospy.spec