Comments (4)
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.
@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.
@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.
@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)
- Using moc objects sent to a multiprocessing task fails HOT 1
- Create spatial MOCs from astropy regions HOT 5
- Change TMOC notebook
- Add support to release linux aarch64 wheels HOT 3
- Buiiding MOC from images located in ant FITS extension HOT 1
- Overplotting a MOC on a custom WCS projected figure with MOC.fill() HOT 3
- python +, -, & operators redefinition for union, sub, intersect between mocs
- Getting the list of pixels HOT 3
- Plotiing a MOC without giving a center. HOT 3
- Add in the contributing section of the doc a tuto to run the notebooks locally HOT 3
- publish wheels for pyodide HOT 1
- add decorators for testing longitude and latitudes HOT 1
- add examples gallery in documentation HOT 2
- Make _store_index a read-only property HOT 1
- MOC.from_fits_image fails when a fits contains no CDELT
- MOC.from_valued_healpix_cells is broken in mocpy 0.12.0 HOT 2
- IntervalSet Depracated HOT 17
- Sections we'll want in the README for v1.0.0 HOT 3
- MOC.wcs() has issues with non-squared figures HOT 3
- sum(of_lots_of_MOCs) returns an error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocpy.