Giter VIP home page Giter VIP logo

gsum's Introduction

gsum logo BUQEYE logo

The gsum package provides convenient classes that allow one to analyze the convergence pattern of Effective Field Theory (EFT) observables. Specifically, this is a conjugacy-based implementation of the statistical model developed in this paper. Although the package is fully functional, we are still working on filling in all of the documentation. Examples of how it was used to generate results can be found in the documentation. The notebooks used in the documentation can be found in docs/notebooks.

Installation

The current working branch can be installed via

$ pip install git+https://github.com/buqeye/gsum

Additionally, one can clone the repository and install using

$ git clone https://github.com/buqeye/gsum.git
$ cd gsum
$ pip install .

This will install the package as is, but if you want to make edits to the code for testing you can exchange the last line with pip install -e ., which will allow you to edit the package without reinstalling.

For some Mac users, the build might fail when using the pip install . method. This may be due to the removal of the usr/include directory from new MacOS versions. Running the following command will fix this problem:

$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Soon, an up-to-date version of this package will be added to pip, for an easier installation process.

Dependencies

gsum is compatible with python 3, but has not been tested with python 2. See the requirements.txt for the full list of dependencies.

Citing gsum

If you have found this package helpful, please cite our paper Melendez et al. (2019), "Quantifying Correlated Truncation Errors in Effective Field Theory" arXiv:1904.10581.

Contact

To report an issue please use the issue tracker.

License

MIT License.

gsum's People

Contributors

danielrphillips avatar furnstahl avatar jordan-melendez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gsum's Issues

Interpolation with varying means

Hi,

I am trying to use this package to calculate the truncation errors for some observables calculated with chiral EFT. I am following the examples given in the documentation.

My issue is that the mean varies from one order to the next. If I use center = 0 in the TruncationGP then while interpolating, it predicts the mean to be zero at the interpolation, which does not make sense. I think this means that I need to set the center to some nonzero value. But I am not sure how to ensure that it has the appropriate value for each order.

Any help with this is appreciated.

Does this line of code mess with the ordering in MD plots?

Brad McClung has been generating the gsum diagnostics for the order-by-order coefficients in Wolfenstein amplitudes. He had some odd results with MD^2s not being consistent with the PC decomposition. We think we found that this line of code was switching around the sequence of the orders in the MD^2 plots, causing them to be mislabeled and miscolored.

positions = positions[inv]

Possible macOS pip install fix

Hello,

I just briefly want to say thank you for providing gsum--which helps quite a lot simplifying the chiral analysis.

As you point out in the Readme, installing gsum via pip on macOS systems runs into possible issues. I have found that slightly updating the install command fixes this on my end and thought it might be helpful to post it here. I.e., I run

export CC=gcc-11; export CXX=g++-11; pip install git+https://github.com/buqeye/gsum --no-binary :all:

(I am not sure if I need to set both CC and CXX) with a homebrew install gcc (on Big Sur 11.5)

gcc-11 --version
gcc-11 (Homebrew GCC 11.1.0_1) 11.1.0

I would assume it also works with other compilers fulfilling the requirements.

Let me know if this is the right place to contact you or if you need further information.

Best regards,

Christopher

gsum installation error

Hi,

I am using a linux system with python3. I got the following error while installing it. Any help is appreciated.

ERROR: Command errored out with exit status 1:
 command: /home/bhbi3159/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-x3ppkehx/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-x3ppkehx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-x3ppkehx/pip-egg-info
     cwd: /tmp/pip-req-build-x3ppkehx/
Complete output (177 lines):
Compiling gsum/cutils.pyx because it changed.
[1/1] Cythonizing gsum/cutils.pyx
/home/bhbi3159/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-req-build-x3ppkehx/gsum/cutils.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...
cimport cython
from cython_gsl cimport *
^
------------------------------------------------------------

gsum/cutils.pyx:2:0: 'cython_gsl.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
cimport numpy as np


cdef extern from "gsl/gsl_linalg.h":
    # Pivoted Cholesky Decomposition
    int  gsl_linalg_pcholesky_decomp(gsl_matrix * A, gsl_permutation * P) nogil
                                    ^
------------------------------------------------------------

gsum/cutils.pyx:9:37: 'gsl_matrix' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
cimport numpy as np


cdef extern from "gsl/gsl_linalg.h":
    # Pivoted Cholesky Decomposition
    int  gsl_linalg_pcholesky_decomp(gsl_matrix * A, gsl_permutation * P) nogil
                                                    ^
------------------------------------------------------------

gsum/cutils.pyx:9:53: 'gsl_permutation' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    # Pivoted Cholesky Decomposition
    int  gsl_linalg_pcholesky_decomp(gsl_matrix * A, gsl_permutation * P) nogil


cdef extern from "gsl/gsl_permutation.h":
    int gsl_permute_matrix (const gsl_permutation * p, gsl_matrix * A)
                                 ^
------------------------------------------------------------

gsum/cutils.pyx:13:34: 'gsl_permutation' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    # Pivoted Cholesky Decomposition
    int  gsl_linalg_pcholesky_decomp(gsl_matrix * A, gsl_permutation * P) nogil


cdef extern from "gsl/gsl_permutation.h":
    int gsl_permute_matrix (const gsl_permutation * p, gsl_matrix * A)
                                                      ^
------------------------------------------------------------

gsum/cutils.pyx:13:55: 'gsl_matrix' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    if not arr.flags['C_CONTIGUOUS']:
        arr = np.ascontiguousarray(arr) # Makes a contiguous copy of the numpy array.
    n = arr.shape[0]
    cdef double[::1] aa = arr.ravel().copy()
    cdef double[::1] ii = np.eye(n).ravel()
    cdef gsl_permutation *P
        ^
------------------------------------------------------------

gsum/cutils.pyx:35:9: 'gsl_permutation' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    n = arr.shape[0]
    cdef double[::1] aa = arr.ravel().copy()
    cdef double[::1] ii = np.eye(n).ravel()
    cdef gsl_permutation *P
    # GSL wants its special gsl matrices
    P = gsl_permutation_alloc(n)
       ^
------------------------------------------------------------

gsum/cutils.pyx:37:8: undeclared name not builtin: gsl_permutation_alloc

Error compiling Cython file:
------------------------------------------------------------
...
    cdef double[::1] aa = arr.ravel().copy()
    cdef double[::1] ii = np.eye(n).ravel()
    cdef gsl_permutation *P
    # GSL wants its special gsl matrices
    P = gsl_permutation_alloc(n)
    A = gsl_matrix_view_array(&aa[0], n, n)
       ^
------------------------------------------------------------

gsum/cutils.pyx:38:8: undeclared name not builtin: gsl_matrix_view_array

Error compiling Cython file:
------------------------------------------------------------
...
    cdef double[::1] aa = arr.ravel().copy()
    cdef double[::1] ii = np.eye(n).ravel()
    cdef gsl_permutation *P
    # GSL wants its special gsl matrices
    P = gsl_permutation_alloc(n)
    A = gsl_matrix_view_array(&aa[0], n, n)
                             ^
------------------------------------------------------------

gsum/cutils.pyx:38:30: Cannot convert 'double *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
    cdef double[::1] ii = np.eye(n).ravel()
    cdef gsl_permutation *P
    # GSL wants its special gsl matrices
    P = gsl_permutation_alloc(n)
    A = gsl_matrix_view_array(&aa[0], n, n)
    I = gsl_matrix_view_array(&ii[0], n, n)
                             ^
------------------------------------------------------------

gsum/cutils.pyx:39:30: Cannot convert 'double *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
    A = gsl_matrix_view_array(&aa[0], n, n)
    I = gsl_matrix_view_array(&ii[0], n, n)

    # This constructs LDL^T where L is lower triangular with ones on the diagonal
    # Turns aa into a matrix with L on the lower triangle, D on the diagonal, and ones on the upper triangle
    gsl_linalg_pcholesky_decomp(&A.matrix, P)
                               ^
------------------------------------------------------------

gsum/cutils.pyx:43:32: Cannot take address of Python object attribute 'matrix'

Error compiling Cython file:
------------------------------------------------------------
...
    chol[range(n), range(n)] = 1.
    # Multiply column i by d_i
    chol *= d

    # P is some permutation object but I want a matrix
    gsl_permute_matrix(P, &I.matrix)  # Permute the identity to turn ii into a permutation matrix
                         ^
------------------------------------------------------------

gsum/cutils.pyx:53:26: Cannot take address of Python object attribute 'matrix'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-x3ppkehx/setup.py", line 24, in <module>
    ext_modules = cythonize([Extension("gsum.cutils", ["gsum/cutils.pyx"])])
  File "/home/bhbi3159/anaconda3/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 1101, in cythonize
    cythonize_one(*args)
  File "/home/bhbi3159/anaconda3/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 1224, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: gsum/cutils.pyx
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: Keyring is skipped due to an exception: Failed to create the collection: Prompt dismissed..
WARNING: Keyring is skipped due to an exception: Failed to create the collection: Prompt dismissed..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.