Merge pull request #49 from cbassa/sidereal_tracking
Propagate sidereal tracking through FITS filespull/55/head
commit
55a9ec9bde
|
@ -242,7 +242,7 @@ def capture_asi(image_queue, z1, t1, z2, t2, nx, ny, nz, tend, device_id, live,
|
|||
camera.close()
|
||||
|
||||
|
||||
def compress(image_queue, z1, t1, z2, t2, nx, ny, nz, tend, path, device_id):
|
||||
def compress(image_queue, z1, t1, z2, t2, nx, ny, nz, tend, path, device_id, cfg):
|
||||
""" compress: Aggregate nframes of observations into a single FITS file, with statistics.
|
||||
|
||||
ImageHDU[0]: mean pixel value nframes (zmax)
|
||||
|
@ -348,6 +348,7 @@ def compress(image_queue, z1, t1, z2, t2, nx, ny, nz, tend, path, device_id):
|
|||
hdr['RADECSYS'] = "ICRS"
|
||||
hdr['COSPAR'] = cfg.getint('Common', 'observer_cospar')
|
||||
hdr['OBSERVER'] = cfg.get('Common', 'observer_name')
|
||||
hdr['TRACKED'] = int(cfg.getboolean('Astrometry', 'tracking_mount'))
|
||||
for i in range(nz):
|
||||
hdr['DT%04d' % i] = dt[i]
|
||||
for i in range(10):
|
||||
|
@ -525,7 +526,7 @@ if __name__ == '__main__':
|
|||
# Set processes
|
||||
pcompress = multiprocessing.Process(target=compress,
|
||||
args=(image_queue, z1, t1, z2, t2, nx, ny,
|
||||
nz, tend.unix, path, device_id))
|
||||
nz, tend.unix, path, device_id, cfg))
|
||||
if camera_type == "CV2":
|
||||
pcapture = multiprocessing.Process(target=capture_cv2,
|
||||
args=(image_queue, z1, t1, z2, t2,
|
||||
|
|
|
@ -69,7 +69,6 @@ if __name__ == "__main__":
|
|||
houghrmin = cfg.getfloat('Processing', 'houghrmin')
|
||||
nhoughmin = cfg.getint('Processing', 'nhoughmin')
|
||||
nstarsmin = cfg.getint('Processing', 'nstarsmin')
|
||||
tracking_mount = cfg.getboolean('Astrometry', 'tracking_mount')
|
||||
|
||||
# Move to processing directory
|
||||
os.chdir(args.file_dir)
|
||||
|
@ -126,7 +125,7 @@ if __name__ == "__main__":
|
|||
pix_catalog = pixel_catalog(fname+".cat")
|
||||
|
||||
# Calibrate from reference
|
||||
calibrate_from_reference(fname, "test.fits", pix_catalog, tracking_mount)
|
||||
calibrate_from_reference(fname, "test.fits", pix_catalog)
|
||||
|
||||
# Store calibration
|
||||
store_calibration(pix_catalog, fname + ".cal")
|
||||
|
|
|
@ -32,12 +32,19 @@ class tycho2_catalog:
|
|||
|
||||
|
||||
# Estimate the WCS from a reference file
|
||||
def estimate_wcs_from_reference(ref, fname, tracking_mount):
|
||||
def estimate_wcs_from_reference(ref, fname):
|
||||
# Read header of reference
|
||||
hdu = fits.open(ref)
|
||||
hdu[0].header["NAXIS"] = 2
|
||||
w = wcs.WCS(hdu[0].header)
|
||||
|
||||
# Check for sidereal tracking
|
||||
# TODO: use fourframe class
|
||||
try:
|
||||
tracked = bool(hdu[0].header['TRACKED'])
|
||||
except KeyError:
|
||||
tracked = False
|
||||
|
||||
# Get time and position from reference
|
||||
tref = Time(hdu[0].header["MJD-OBS"], format="mjd", scale="utc")
|
||||
pref = SkyCoord(ra=w.wcs.crval[0],
|
||||
|
@ -50,7 +57,7 @@ def estimate_wcs_from_reference(ref, fname, tracking_mount):
|
|||
t = Time(hdu[0].header["MJD-OBS"], format="mjd", scale="utc")
|
||||
|
||||
# Correct wcs
|
||||
if tracking_mount:
|
||||
if tracked:
|
||||
dra = 0.0*u.deg
|
||||
else:
|
||||
dra = (t.sidereal_time("mean", "greenwich")
|
||||
|
@ -189,9 +196,9 @@ def add_wcs(fname, w, rmsx, rmsy):
|
|||
return
|
||||
|
||||
|
||||
def calibrate_from_reference(fname, ref, pix_catalog, tracking_mount):
|
||||
def calibrate_from_reference(fname, ref, pix_catalog):
|
||||
# Estimated WCS
|
||||
w = estimate_wcs_from_reference(ref, fname, tracking_mount)
|
||||
w = estimate_wcs_from_reference(ref, fname)
|
||||
|
||||
# Default rms values
|
||||
rmsx = 0.0
|
||||
|
|
|
@ -33,7 +33,10 @@ class observation:
|
|||
|
||||
# Compute ra/dec
|
||||
world = ff.w.wcs_pix2world(np.array([[self.x0, self.y0]]), 1)
|
||||
self.ra = world[0, 0] + hobs - hmid
|
||||
if ff.tracked:
|
||||
self.ra = world[0, 0]
|
||||
else:
|
||||
self.ra = world[0, 0] + hobs - hmid
|
||||
self.de = world[0, 1]
|
||||
|
||||
|
||||
|
@ -87,6 +90,7 @@ class fourframe:
|
|||
self.ctype = ["RA---TAN", "DEC--TAN"]
|
||||
self.cunit = np.array(["deg", "deg"])
|
||||
self.crres = np.array([0.0, 0.0])
|
||||
self.tracked = False
|
||||
else:
|
||||
# Read FITS file
|
||||
hdu = fits.open(fname)
|
||||
|
@ -126,6 +130,12 @@ class fourframe:
|
|||
self.crres = np.array(
|
||||
[hdu[0].header['CRRES1'], hdu[0].header['CRRES2']])
|
||||
|
||||
# Check for sidereal tracking
|
||||
try:
|
||||
self.tracked = bool(hdu[0].header['TRACKED'])
|
||||
except KeyError:
|
||||
self.tracked = False
|
||||
|
||||
hdu.close()
|
||||
|
||||
# Compute image properties
|
||||
|
|
Loading…
Reference in New Issue