Closed TEtourneau closed 6 years ago
hi Thomas,
it seems like this is some python code.
astrogo/fitsio
is all about being able to read and write FITS files with the Go programming language...
did you take a wrong turn at some point ? :)
Indeed I posted this on the wrong github page. There is also a module named fitsio in python. Sorry for the bother,
Thomas
no worries :)
FYI, here is the equivalent with astrogo/fitsio
:
package main
import (
"log"
"os"
"github.com/astrogo/fitsio"
)
func main() {
create("empty.fits")
open("empty.fits")
}
func create(fname string) {
f, err := os.Create(fname)
if err != nil {
log.Fatal(err)
}
defer f.Close()
fits, err := fitsio.Create(f)
if err != nil {
log.Fatal(err)
}
if err := fits.Close(); err != nil {
log.Fatal(err)
}
if err := f.Close(); err != nil {
log.Fatal(err)
}
}
func open(fname string) {
f, err := os.Open(fname)
if err != nil {
log.Fatal(err)
}
defer f.Close()
fits, err := fitsio.Open(f)
if err != nil {
log.Fatal(err)
}
defer fits.Close()
log.Printf("fits: %v", fits.Name())
log.Printf("hdus: %v", fits.HDUs())
}
Hi,
I would like to create empty fits files, but I didn't manage to do it : I got the 252 status.
Here is what I do :
Any idea on how to do that ?
Thanks in advance, Thomas.