Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add (f *FITSImage) AddObserverEntry to fits module in @observerly/iris #232

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions pkg/fits/fits.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ type FITSObservation struct {
Observer string `json:"observer"` // Who acquired the data
}

type FITSObserver struct {
Latitude float32 `json:"latitude"` // Latitude of the observer
Longitude float32 `json:"longitude"` // Longitude of the observer
Elevetion float32 `json:"elevation"` // Elevation of the observer
}

// Creates a new instance of FITS image initialized with empty header
func NewFITSImage(naxis int32, naxis1 int32, naxis2 int32, adu int32) *FITSImage {
h := NewFITSHeader(naxis, naxis1, naxis2)
Expand Down Expand Up @@ -289,6 +295,34 @@ func (f *FITSImage) AddObservationEntry(observation *FITSObservation) *FITSImage
return f
}

func (f *FITSImage) AddObserverEntry(observer *FITSObserver) *FITSImage {
f.Header.Floats["LATITUDE"] = struct {
Value float32
Comment string
}{
Value: observer.Latitude,
Comment: "Latitude of the observer (in degrees)",
}

f.Header.Floats["LONGITUD"] = struct {
Value float32
Comment string
}{
Value: observer.Longitude,
Comment: "Longitude of the observer (in degrees)",
}

f.Header.Floats["ELEVATIO"] = struct {
Value float32
Comment string
}{
Value: observer.Elevetion,
Comment: "Elevation of the observer (in meters)",
}

return f
}

func (f *FITSImage) ExtractHFR(radius float32, sigma float32, starInOut float32) float32 {
se := photometry.NewStarsExtractor(f.Data, int(f.Naxisn[0]), int(f.Naxisn[1]), radius, f.ADU)

Expand Down
Loading