GithubHelp home page GithubHelp logo

Generating Filters about s2wav HOT 6 CLOSED

CosmoMatt avatar CosmoMatt commented on June 3, 2024
Generating Filters

from s2wav.

Comments (6)

CosmoMatt avatar CosmoMatt commented on June 3, 2024 1

Ok @alicjapolanska I think in theory this loop would be better suited to start from 1 than 0 BUT then we would need a different function which starts from 0 for all the other iterations when a != 1/B. To avoid duplicating code we instead have this exception catch, which in your case (a=1/B) will just ignore the contribution from the first loop.

Now, why the divide by 0 here isn't caught in the C code. C code can be compiled in multiple modes; the two most common being debug and release. When in debug mode C is much more sensitive to these kind of errors (as its useful to see where these bugs will crop up), however because of the extra checks the overall code will be slower. When in release mode C will take whatever garbage you feed it and return an associated value, but it will do this extremely quickly. In this case the divide by zero leads to exp(-infty) = 0 and so the term doesn't contribute as it is 0.

Best way to get around this for now is probably just to explicitly add a check for

if a == 1/B: return 0 else: do the normal function

or something to that effect. Does that make sense?

from s2wav.

alicjapolanska avatar alicjapolanska commented on June 3, 2024 1

I see, thanks @CosmoMatt ! I'll add this check. I imagine we will need to rethink this anyway when we switch to the scipy integrator in the future.

from s2wav.

CosmoMatt avatar CosmoMatt commented on June 3, 2024

This issue can be split straightforwardly into three sub-issues: (1) to implement the axisymmetric filters (i.e. filters which depend only on multipole l, these are circularly symmetric filters on the sphere); (2) to implement the directional filters (i.e. filters which depend both on l and m, these filters are more general); (3) implement the validation functions (just to check everything is working!).

  • Implement axisymmetric filters (from this line to this line).
  • Implement directional filters (from this line to this line).
  • Implement the identity validation functions (from this line until the end of the file).

from s2wav.

alicjapolanska avatar alicjapolanska commented on June 3, 2024

I'm having some trouble with computing the normalisation. In this line. It throws a divide by zero error in my implementation. The tiling integrand is computed with the value k = 1/B, making t = -1, and giving a 0 in the denominator in the exponent here. This is happening for the first i=0 in this loop here. From my understanding of C this loop should start from i=0. Or is it i=1? That would seemingly solve the issue? @CosmoMatt @jasonmcewen

from s2wav.

alicjapolanska avatar alicjapolanska commented on June 3, 2024

Or perhaps the issue is that Python throws an exception with division by zero. Then I could modify the function so that it doesn't try to compute the integrand in the Python version of this if it would be undefined instead of not adding the contribution from undefined terms like in the C code? Or modify the limits when computing the normalisation. @CosmoMatt @jasonmcewen

from s2wav.

CosmoMatt avatar CosmoMatt commented on June 3, 2024

I've just taken a look @alicjapolanska and that is particularly funky. I'll take a deeper look now and try to figure out what on earth is going on here.

from s2wav.

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.