star

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMask

func CreateMask(width int32, radius float32) []int32

Creates a mask of given radius. Returns a list of index offsets

func Dist2D

func Dist2D(a, b Point2D) float32

Returns the euclidian distance between the two given points

func Dist2DSquared

func Dist2DSquared(a, b Point2D) float32

Returns the squared euclididian distance between the two given points

func Dist3D

func Dist3D(a, b Point3D) float32

Returns the euclidian distance between the two given points

func Dist3DSquared

func Dist3DSquared(a, b Point3D) float32

Returns the squared euclididian distance between the two given points

func PrintStars

func PrintStars(w io.Writer, stars []Star)

Prints given array of stars as CSV

func QPartitionStarsDesc

func QPartitionStarsDesc(a []Star) int

Partitions an array of stars with the middle pivot element, and returns the pivot index. Values greater than the pivot are moved left of the pivot, those less are moved right. Array must not contain IEEE NaN

func QSortStarsDesc

func QSortStarsDesc(a []Star)

Sort an array of stars in descending order, based on mass Array must not contain IEEE NaN

Types

type Aligner

type Aligner struct {
	Naxisn       []int32    // Size of the destination image we are aligning to
	RefStars     []Star     // The reference stars this aligner uses
	Stars2DT     KDTree2    // Pointerless 2-dimensional tree  for fast lookup of reference stars
	RefTriangles []Triangle // Reference triangles built from the above, using the k constant
	RefTri3DT    KDTree3P   // Pointerless 3-dimensional tree for fast lookup of reference triangles
	K            int32      // Consider top k brightest stars for building triangles
}

A star aligner

func NewAligner

func NewAligner(naxisn []int32, refStars []Star, k int32) *Aligner

Creates a new star aligner from the given reference stars and priming constant k

func (*Aligner) Align

func (a *Aligner) Align(naxisn []int32, stars []Star, id int) (trans Transform2D, residual float32)

Calculates image alignments based on their respective star positions

type KDTree2

type KDTree2 []Point2D

A kd-Tree with k=2 dimensions. Inspired by https://en.wikipedia.org/wiki/K-d_tree Pointerless idea came up by itself ;)

func (KDTree2) Make

func (points KDTree2) Make()

Builds a pointerless k-dimensional tree with k=2 from the points by resorting the array. Function for even depths which pivots on the X dimension.

func (KDTree2) NearestNeighbor

func (kdt KDTree2) NearestNeighbor(p Point2D) (closestPt Point2D, closestDsq float32)

Performs a nearest neighbor search on the points, which must have been previously transformed to a k-dimensional tree using NewKDTree2()

type KDTree3P

type KDTree3P []Point3DPayload

A kd-Tree with k=3 dimensions and payload. Inspired by https://en.wikipedia.org/wiki/K-d_tree Pointerless idea came up by itself ;)

func (KDTree3P) Make

func (points KDTree3P) Make()

Builds a pointerless k-dimensional tree with k=3 from the points by resorting the array. Function for mod 3 == 0 depths which pivots on the X dimension.

func (KDTree3P) NearestNeighbor

func (kdt KDTree3P) NearestNeighbor(p Point3D) (closestPt Point3DPayload, closestDsq float32)

Performs a nearest neighbor search on the points, which must have been previously transformed to a k-dimensional tree using NewKDTree3P()

type Match

type Match struct {
	Dist        float32
	TriIndex    int32
	RefTriIndex int32
}

A candidate match between a triangle and a reference triangle, with distance between them

type Point2D

type Point2D struct {
	X float32
	Y float32
}

A 2-dimensional point with floating point coordinates.

func Add2D

func Add2D(a, b Point2D) Point2D

func Sub2D

func Sub2D(a, b Point2D) Point2D

func (Point2D) String

func (p Point2D) String() string

type Point3D

type Point3D struct {
	X float32
	Y float32
	Z float32
}

A 3-dimensional point with floating point coordinates.

func (Point3D) String

func (p Point3D) String() string

type Point3DPayload

type Point3DPayload struct {
	Point3D
	Payload interface{}
}

A 3-dimensional point with floating point coordinates and payload

type Rect2D

type Rect2D struct {
	A Point2D
	B Point2D
}

A 2-dimensional rectangle with floating point coordinates

func (Rect2D) String

func (r Rect2D) String() string

type Star

type Star struct {
	Index int32   // Index of the star in the data array. int32(x)+width*int32(y)
	Value float32 // Value of the star in the data array. data[index]
	X     float32 // Precise star x position via center of mass
	Y     float32 // Precise star y position via center of mass
	Mass  float32 // Star mass. Summed pixel values above location estimate, within given radius
	HFR   float32 // Half-Flux Radius of the star, in pixels
}

A star, as found on an image by star detection

func FindStars

func FindStars(data []float32, width int32, location, scale, starSig, bpSigma, starInOut float32, radius int32, medianDiffStats *stats.Stats) (stars []Star, sumOfShifts, avgHFR float32)

Find stars in the given image with data type int16

func (*Star) Dimension

func (s *Star) Dimension(i int) float64

Adapter method 2 to make Star work with KD-Tree

func (*Star) Dimensions

func (s *Star) Dimensions() int

Adapter method 1 to make Star work with KD-Tree

type Transform2D

type Transform2D struct {
	A float32
	B float32
	C float32
	D float32
	E float32
	F float32
}

A 2D coordinate transformation.

func IdentityTransform2D

func IdentityTransform2D() Transform2D

func NewTransform2D

func NewTransform2D(p1, p2, p3, p1p, p2p, p3p Point2D) (Transform2D, error)

Calculate 2D transformation matrix from three given points in first coordinate system, and corresponding reference points in second coordinate system. p1, p2, p3 are in the first system. p1p, p2p, p3p are in the second.

func (*Transform2D) Apply

func (t *Transform2D) Apply(p Point2D) (pP Point2D)

Apply given 2D transformation to the given coordinates

func (*Transform2D) ApplySlice

func (t *Transform2D) ApplySlice(ps []Point2D) (pPs []Point2D)

Apply given 2D transformation to many given coordinates

func (*Transform2D) Invert

func (t *Transform2D) Invert() (inv Transform2D, err error)

Invert a given 2D transformation. Returns error in the case of divid

func (Transform2D) String

func (t Transform2D) String() string

type Triangle

type Triangle struct {
	DistAB float32
	DistAC float32
	DistBC float32
	A      int32
	B      int32
	C      int32
}

A triangle representing the distances between three stars, which are translation and rotation invariant. Also stores their indices into the Stars[] array for later processing steps.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL