Skip to content

Commit

Permalink
Merge pull request #158 from observerly/feature/healpix/NewHealPIX
Browse files Browse the repository at this point in the history
feat: add NSide and Scheme fields to NewHealPIX in @observerly/skysolve
  • Loading branch information
michealroberts authored Jan 15, 2025
2 parents 478009f + 8ebb4b5 commit 87eea14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion pkg/healpix/healpix.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,19 @@ type HealPIX struct {

// HEALPix, i.e., the "Hierarchical Equal Area isoLatitude Pixelization", is a versatile structure for the
// pixelization of coordinates on the sphere.
func NewHealPIX() *HealPIX {
// @see https://healpix.jpl.nasa.gov/html/intro.htm
// @see https://healpix.sourceforge.io/pdf/intro.pdf
func NewHealPIX(sides int, scheme Scheme) *HealPIX {
// Ensure the NSide is a power of 2 (2^k) and greater than 0:
if sides < 1 {
sides = 1
} else {
sides = 1 << uint(math.Round(math.Log2(float64(sides))))
}

return &HealPIX{
NSide: sides,
Scheme: scheme,
Longitude: 180.0,
Latitude: 0.0,
PolarLatitudeBoundary: 2.0 / 3.0, // in radians (approximately 38.1972 degrees)
Expand Down
2 changes: 1 addition & 1 deletion pkg/solve/solve.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (ps *PlateSolver) ValidateAndConfirmMatches(candidateMatches []spatial.Quad
/*****************************************************************************************************************/

func (ps *PlateSolver) Solve(tolerance ToleranceParams, sipOrder int) (*wcs.WCS, []spatial.QuadMatch, error) {
healpx := healpix.NewHealPIX()
healpx := healpix.NewHealPIX(256, healpix.RING)

stars := make([]star.Star, len(ps.Stars))

Expand Down

0 comments on commit 87eea14

Please sign in to comment.