parent
66398416a6
commit
a313c5c08a
|
@ -107,7 +107,7 @@ if __name__ == "__main__":
|
|||
for fname in fnames:
|
||||
# Generate star catalog
|
||||
pix_catalog = generate_star_catalog(fname)
|
||||
|
||||
|
||||
# Solve
|
||||
if pix_catalog.nstars > 10:
|
||||
print(colored("Computing astrometric calibration for %s" % fname, "yellow"))
|
||||
|
@ -116,7 +116,7 @@ if __name__ == "__main__":
|
|||
# Break when solved
|
||||
if solved:
|
||||
break
|
||||
|
||||
|
||||
# Loop over files
|
||||
for fname in fnames:
|
||||
# Generate star catalog
|
||||
|
@ -128,7 +128,7 @@ if __name__ == "__main__":
|
|||
|
||||
# Store calibration
|
||||
store_calibration(pix_catalog, fname + ".cal")
|
||||
|
||||
|
||||
# Generate satellite predictions
|
||||
generate_satellite_predictions(fname)
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ from astropy import wcs
|
|||
from astropy.coordinates import SkyCoord, FK5, ICRS
|
||||
from astropy.time import Time
|
||||
from scipy import optimize
|
||||
from stvid.stars import pixel_catalog
|
||||
|
||||
|
||||
# Class for the Tycho 2 catalog
|
||||
|
@ -229,24 +228,25 @@ def generate_reference_with_anet(fname, cmd_args, reffname="test.fits", tempfroo
|
|||
# Get center
|
||||
hdu = fits.open(fname)
|
||||
ny, nx = hdu[0].data[0].shape
|
||||
|
||||
|
||||
# Generate command
|
||||
command = "solve-field %s -l 20 -O -N %s --crpix-x %d --crpix-y %d -t 1 %s.fits" % (cmd_args, reffname, nx//2, ny//2, tempfroot)
|
||||
|
||||
command = "solve-field %s -l 20 -O -N %s --crpix-x %d --crpix-y %d -t 1 %s.fits" \
|
||||
% (cmd_args, reffname, nx//2, ny//2, tempfroot)
|
||||
|
||||
# Run command
|
||||
try:
|
||||
subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
|
||||
|
||||
# Did the astrometry succeed?
|
||||
solved = os.path.exists("%s.solved" % tempfroot)
|
||||
except:
|
||||
except OSError:
|
||||
solved = False
|
||||
|
||||
# Remove temporary files
|
||||
for fname in glob.glob("%s*" % tempfroot):
|
||||
try:
|
||||
os.remove(fname)
|
||||
except:
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
return solved
|
||||
|
|
|
@ -49,6 +49,7 @@ def generate_star_catalog(fname):
|
|||
|
||||
return pixel_catalog(fname+".cat")
|
||||
|
||||
|
||||
def store_calibration(pix_catalog, fname):
|
||||
with open(fname, "w") as fp:
|
||||
for i in range(pix_catalog.nstars):
|
||||
|
|
Loading…
Reference in New Issue