Git Product home page Git Product logo

Comments (4)

s-kuberski avatar s-kuberski commented on July 28, 2024 1

Indeed, your solution to determine gapsize is much better than mine! I'll adapt my code to open a PR.

from pyerrors.

s-kuberski avatar s-kuberski commented on July 28, 2024

I have found some cases with very large autocorrelation, where the gap is correctly identified but the windowing does not properly work - more investigation is needed.

from pyerrors.

s-kuberski avatar s-kuberski commented on July 28, 2024

The following code snippet seems to resolve the problems:

                else:
                    # Standard automatic windowing procedure
                    tau = self.S[e_name] / np.log((2 * self.e_n_tauint[e_name][gapsize::gapsize] + 1) / (2 * self.e_n_tauint[e_name][gapsize::gapsize] - 1))
                    g_w = np.exp(- np.arange(1, len(tau) + 1) / tau) - tau / np.sqrt(np.arange(1, len(tau) + 1) * e_N)
                    for n in range(1, w_max):
                        if n < w_max // 2 - 2:
                            _compute_drho(gapsize * n + gapsize)
                        if g_w[n - 1] < 0 or n >= w_max - 1:
                            n *= gapsize
                            self.e_tauint[e_name] = self.e_n_tauint[e_name][n] * (1 + (2 * n + 1) / e_N) / (1 + 1 / e_N)  # Bias correction hep-lat/0306017 eq. (49)
                            self.e_dtauint[e_name] = self.e_n_dtauint[e_name][n]
                            self.e_dvalue[e_name] = np.sqrt(2 * self.e_tauint[e_name] * e_gamma[e_name][0] * (1 + 1 / e_N) / e_N)
                            self.e_ddvalue[e_name] = self.e_dvalue[e_name] * np.sqrt((n + 0.5) / e_N)
                            self.e_windowsize[e_name] = n
                            break

All plots and, most importantly, the resulting error seem to be fine.

The dection of the gapsize is quite stable when the criterion in the if clause is a bit relaxed, say, to 1e-10 . The fft should be the best method to detect the gapsize.

There is the general question of the unit of the window size and the autocorrelation time. Currently, we have a factor of gapsize, when we deal with regular and gapped chains. In the proposed fix, the unit for these numbers is one unit in terms of idl for the window size for gapped and irregular chains. The autocorrelation time however contains the implicit factor of gapsize. We could think of changing the output for regular chains (i.e., those with a range as idl) to have consistent estimates in terms of MDU or to print the gapsize, either determined with the new code or from the ranges

from pyerrors.

fjosw avatar fjosw commented on July 28, 2024

I was aware of this issue but never took the time to really dig into it. I like your solution for the modification of the windowing procedure. Maybe I am overlooking something but there might be a simpler and more stable way of obtaining the gap size directly from the idl, for example

gapsize = np.min(np.diff(self.idl[e_name]))

I see the problem related to the output but I am not sure about the best solution. Do you maybe want to open a PR with a proposal and then we can run a few test cases on the new code?

from pyerrors.

Related Issues (20)

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.