Code Monkey home page Code Monkey logo

Comments (4)

bmatthieu3 avatar bmatthieu3 commented on June 17, 2024

Hey @ggreco77 ,

For the InMOC feature, there is a MOC.contains method https://cds-astro.github.io/mocpy/stubs/mocpy.MOC.html#mocpy.MOC.contains that does this.

For the NearMOC that is an interesting feature. I think we would need a method that returns the distance of a sky position from a specific HEALPix cell at a given depth. @fxpineau - maybe this is more suited for cdshealpix ? With a method like this, I will then be able to compute the distance between the sky position and all the HEALPix cells contained in the MOC, take the min of these distances and compare it to the distance given by the user.

@ggreco77 - For the moment what you can also do is to increase the area of the MOC thanks to add_neighbours https://cds-astro.github.io/mocpy/stubs/mocpy.MOC.html#mocpy.MOC.add_neighbours. It will return you a bigger MOC increased by one degree of neighbors at the max depth of the MOC. You can then call contains on it with a list of sky positions. This method does not ask you for a certain distance, but if you want a bigger threshold you can still increase the MOC several times...

from mocpy.

fxpineau avatar fxpineau commented on June 17, 2024

@ggreco77, cc @mbtaylor,
I don't know exactly the algorithm used in nearMoc.
Unless I am missing something, computing the exact distance from a point to an HEALPix cell edge is not trivial (HEALPIx cell edges are not great-circle arcs).
One approximate solution may be to create a MOC from a cone (center = sky position, radius = distance, order = approximation level) and test whether the union intersection with the input MOC is empty or not.
@mbtaylor do you have a different approach?

from mocpy.

mbtaylor avatar mbtaylor commented on June 17, 2024

@fxpineau yes, testing the intersection between a cone and the target MOC is exactly what I do. As you note, the result is approximate, the cone is currently generated like this:

Healpix.getNested(mocOrder).newConeComputerApprox(radius).overlappingCells(alpha, delta)

from mocpy.

fxpineau avatar fxpineau commented on June 17, 2024

@mbtaylor thank you for your answer (of course it relies on the intersection, not the union: I updated my message).
The MOC being itself an approximate region, it may indeed be an overkill to use a cone resolution deeper than the MOC resolution.

from mocpy.

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.