Coder Social home page Coder Social logo

Comments (3)

thjsal avatar thjsal commented on June 18, 2024 1

Looks like I was wrong and the sporadic error reported above seems to actually originate from X-PSI producing NaNs for high emission angles, for which the emission angle is very close to 90 degrees. For those situations are apparently checked if sin_alpha==1 , but that does not thus capture e.g. sin_alpha= 0.9999999999999989 , which is also problematically close to 1.0, and produces NaNs in the further calculation.
Here is the line causing the problem (giving NaN for the w_R parameter):

w_R = sqrt(1.0 - r_c_over_r_s * r_s_over_R)

This can be fixed either by modifying the sin_alpha check (to avoid also small deviations from sin_alpha=1) or by setting (after those lines):

if gsl_isnan(w_R):
            w_R = 0.0  

After doing this fix (the latter way), the calculation is not anymore sporadically terminated (or neglected if doing sampling). After this fix, the likelihood changes in my test case (for the first parameter vector reported above) from -37043.99135451222 to -37043.99135647802.

from xpsi.

thjsal avatar thjsal commented on June 18, 2024

If commenting the error handling raising this error in Likelihood.py, the code instead crashes and raises randomly this error
RayError: Fatal numerical problem during ray integration.
It seems to originate from GSL library functions used for integration in rays.pyx. There lines with status = gsl_integration_qag(...) can return some times Failed as their status and some times not, given the same input (but need to still re-check that). So it looks likely a problem with GSL to me.

from xpsi.

thjsal avatar thjsal commented on June 18, 2024

The randomness of the warning apparently comes from this line

rayParams[4*T] <= deflection[i,j - 1])):

where the termination condition depends on the deflection angle calculated for the previous grid point. And when having NaNs, that previous grid point has not been properly set but it includes some random values from the memory.

from xpsi.

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.