Loading noctua/templates/box.py +6 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,12 @@ class Template(BaseTemplate): centx, centy = center log.info(f"Windowing camera: center {center}, size {width}x{height}") cam.xrange = [centx - width // 2, centx + width // 2] cam.yrange = [centy - height // 2, centy + height // 2] cam.set_window(centx - width // 2, centy - height // 2, centx + width // 2, centy + height // 2) log.info( f"Camera windows now: xrange {cam.xrange}, yrange {cam.yrange}") log.info(f"Which means start xy: {cam.xystart}, end xy: {cam.xyend}") Loading noctua/templates/fillheader.py +9 −11 Original line number Diff line number Diff line Loading @@ -92,11 +92,11 @@ class Template(BaseTemplate): 1 / np.sin(alt_rad), 2) hdu.header['airmass'] = sec_z, "Airmass at start" focrel = foc.position focabs = foc.absolute focrel = foc.offset focabs = foc.position temperatures = tel_temp.temperature cover = tel.cover cover = tel.open hdu.header['telfocus'] = focrel, "[mm] M2 Relative position" hdu.header['hierarch TEL FOC REL'] = focrel, "[mm] M2 Relative position" Loading @@ -104,7 +104,7 @@ class Template(BaseTemplate): hdu.header['hierarch TEL M1 TEMP'] = temperatures[0], "[C] M1 temperature" hdu.header['hierarch TEL M2 TEMP'] = temperatures[1], "[C] M2 temperature" hdu.header['hierarch TEL M3 TEMP'] = temperatures[2], "[C] M3 temperature" hdu.header['hierarch TEL COVER'] = cover, "M1 cover. 1.0 if full open, 0.0 if close" hdu.header['hierarch TEL COVER'] = cover, "M1 cover. T if open, F if closed" # log.debug(f"CABINET keys end {(Time.now()-now).sec :.2f}") Loading @@ -115,8 +115,8 @@ class Template(BaseTemplate): # now = Time.now() # log.debug(f"ASCOM keys start {(Time.now()-now).sec :.2f}") rotpos = rot.position rotabs = rot.absolute rotpos = rot.offset rotabs = rot.position hdu.header['hierarch TEL ROT REL'] = rotpos, "[deg] Relative rotator position angle" hdu.header['hierarch TEL ROT ABS'] = rotabs, "[deg] Absolute rotator position angle" Loading Loading @@ -189,18 +189,13 @@ class Template(BaseTemplate): # wcss = WCS() # wcss.wcs.ctype = ["RA---TAN", "DEC--TAN"] # wcss.wcs.cd = scale*np.array([[np.cos(angle), np.sin(angle)], # [np.sin(angle), flip*np.cos(angle)]]) # wcss.wcs.cunit = ['deg', 'deg'] # wcss.wcs.crval = [radec, # radec*15] # wcss.wcs.crpix = [ (camx[1]-camx[0])/2., # (camy[1]-camy[0])/2.] # hdu.header.update(wcss.to_header()) log.debug( Loading @@ -209,6 +204,9 @@ class Template(BaseTemplate): except FileNotFoundError as e: log.error("File not found") log.error(e) except Exception as e: log.error(f"Error: {e}") log.error(e) ############################### ##### Saving in data path ##### Loading noctua/templates/focus.py +5 −2 Original line number Diff line number Diff line Loading @@ -103,12 +103,14 @@ class Template(BaseTemplate): box.run(params) # saves temp.fits boxed image log.debug(f"Getting {temp_fits}") data = fits.getdata(temp_fits) ############################### ##### Fitting a 2d Moffat ##### ############################### log.debug(f"Fitting data") fitted = fit_star(data, model="moffat") ############################## Loading Loading @@ -136,17 +138,18 @@ class Template(BaseTemplate): # log.info(f"Found: focus={m2}µm, FWHM={fwhm}'' ") # opening all the time and not at begginning just for safety log.debug(f"Opening {file_path}") with open(file_path, "a") as file: msg = f"{rep:>3} {m2:>10} {fwhm:>10} " file.write(msg + "\n") log.info("Writing: " + msg) log.info(f"Writing in focus file: rep={rep}, m2={m2}, fwhm={fwhm}") ###################### ##### Moving M2 ##### ###################### foc.position += step log.warning(f"Moving focus py {step}µm, to {foc.position}µm") log.warning(f"Moving focus by {step}µm, to {round(foc.position, 2)}µm") sleep(0.3) ############################## Loading noctua/templates/observation.py +10 −4 Original line number Diff line number Diff line Loading @@ -129,9 +129,13 @@ class Template(BaseTemplate): # Changing windowing if xystart and xyend: log.info( f"Changing windowding to xystart:{xystart}, xyend:{xyend}") cam.xystart = xystart cam.xyend = xyend f"Changing windowing to xystart:{xystart}, xyend:{xyend}") cam.set_window(xystart[0], xystart[1], xyend[0]-xystart[0], xyend[1]-xystart[1]) else: msg = f"No windowing: full frame in bininng {binning}" log.warning(msg) Loading @@ -155,7 +159,7 @@ class Template(BaseTemplate): basic_cabinet = tel.coordinates gps = Time(tel.coordinates["utc"], format="unix") log.info(f"Starting Exposure {exposure} of {repeat - 1}") log.info(f"Starting Exposure {exposure + 1} of {repeat}") # ######################## # ##### Dome Slewing ##### Loading Loading @@ -238,10 +242,12 @@ class Template(BaseTemplate): # Checking if the image is ready to be downloaded while cam.ready != 1: log.debug(f"Downloading... (cam state {image_state[cam.ready]})") sleep(0.5) if self.check_pause_or_abort(): log.warning(f"Buffer still {image_state[cam.ready]}") return log.debug(f"Downloading... (cam state {image_state[cam.ready]})") cam.download() log.info(f"Elapsed {(Time.now() - now).sec:.2f}") Loading Loading
noctua/templates/box.py +6 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,12 @@ class Template(BaseTemplate): centx, centy = center log.info(f"Windowing camera: center {center}, size {width}x{height}") cam.xrange = [centx - width // 2, centx + width // 2] cam.yrange = [centy - height // 2, centy + height // 2] cam.set_window(centx - width // 2, centy - height // 2, centx + width // 2, centy + height // 2) log.info( f"Camera windows now: xrange {cam.xrange}, yrange {cam.yrange}") log.info(f"Which means start xy: {cam.xystart}, end xy: {cam.xyend}") Loading
noctua/templates/fillheader.py +9 −11 Original line number Diff line number Diff line Loading @@ -92,11 +92,11 @@ class Template(BaseTemplate): 1 / np.sin(alt_rad), 2) hdu.header['airmass'] = sec_z, "Airmass at start" focrel = foc.position focabs = foc.absolute focrel = foc.offset focabs = foc.position temperatures = tel_temp.temperature cover = tel.cover cover = tel.open hdu.header['telfocus'] = focrel, "[mm] M2 Relative position" hdu.header['hierarch TEL FOC REL'] = focrel, "[mm] M2 Relative position" Loading @@ -104,7 +104,7 @@ class Template(BaseTemplate): hdu.header['hierarch TEL M1 TEMP'] = temperatures[0], "[C] M1 temperature" hdu.header['hierarch TEL M2 TEMP'] = temperatures[1], "[C] M2 temperature" hdu.header['hierarch TEL M3 TEMP'] = temperatures[2], "[C] M3 temperature" hdu.header['hierarch TEL COVER'] = cover, "M1 cover. 1.0 if full open, 0.0 if close" hdu.header['hierarch TEL COVER'] = cover, "M1 cover. T if open, F if closed" # log.debug(f"CABINET keys end {(Time.now()-now).sec :.2f}") Loading @@ -115,8 +115,8 @@ class Template(BaseTemplate): # now = Time.now() # log.debug(f"ASCOM keys start {(Time.now()-now).sec :.2f}") rotpos = rot.position rotabs = rot.absolute rotpos = rot.offset rotabs = rot.position hdu.header['hierarch TEL ROT REL'] = rotpos, "[deg] Relative rotator position angle" hdu.header['hierarch TEL ROT ABS'] = rotabs, "[deg] Absolute rotator position angle" Loading Loading @@ -189,18 +189,13 @@ class Template(BaseTemplate): # wcss = WCS() # wcss.wcs.ctype = ["RA---TAN", "DEC--TAN"] # wcss.wcs.cd = scale*np.array([[np.cos(angle), np.sin(angle)], # [np.sin(angle), flip*np.cos(angle)]]) # wcss.wcs.cunit = ['deg', 'deg'] # wcss.wcs.crval = [radec, # radec*15] # wcss.wcs.crpix = [ (camx[1]-camx[0])/2., # (camy[1]-camy[0])/2.] # hdu.header.update(wcss.to_header()) log.debug( Loading @@ -209,6 +204,9 @@ class Template(BaseTemplate): except FileNotFoundError as e: log.error("File not found") log.error(e) except Exception as e: log.error(f"Error: {e}") log.error(e) ############################### ##### Saving in data path ##### Loading
noctua/templates/focus.py +5 −2 Original line number Diff line number Diff line Loading @@ -103,12 +103,14 @@ class Template(BaseTemplate): box.run(params) # saves temp.fits boxed image log.debug(f"Getting {temp_fits}") data = fits.getdata(temp_fits) ############################### ##### Fitting a 2d Moffat ##### ############################### log.debug(f"Fitting data") fitted = fit_star(data, model="moffat") ############################## Loading Loading @@ -136,17 +138,18 @@ class Template(BaseTemplate): # log.info(f"Found: focus={m2}µm, FWHM={fwhm}'' ") # opening all the time and not at begginning just for safety log.debug(f"Opening {file_path}") with open(file_path, "a") as file: msg = f"{rep:>3} {m2:>10} {fwhm:>10} " file.write(msg + "\n") log.info("Writing: " + msg) log.info(f"Writing in focus file: rep={rep}, m2={m2}, fwhm={fwhm}") ###################### ##### Moving M2 ##### ###################### foc.position += step log.warning(f"Moving focus py {step}µm, to {foc.position}µm") log.warning(f"Moving focus by {step}µm, to {round(foc.position, 2)}µm") sleep(0.3) ############################## Loading
noctua/templates/observation.py +10 −4 Original line number Diff line number Diff line Loading @@ -129,9 +129,13 @@ class Template(BaseTemplate): # Changing windowing if xystart and xyend: log.info( f"Changing windowding to xystart:{xystart}, xyend:{xyend}") cam.xystart = xystart cam.xyend = xyend f"Changing windowing to xystart:{xystart}, xyend:{xyend}") cam.set_window(xystart[0], xystart[1], xyend[0]-xystart[0], xyend[1]-xystart[1]) else: msg = f"No windowing: full frame in bininng {binning}" log.warning(msg) Loading @@ -155,7 +159,7 @@ class Template(BaseTemplate): basic_cabinet = tel.coordinates gps = Time(tel.coordinates["utc"], format="unix") log.info(f"Starting Exposure {exposure} of {repeat - 1}") log.info(f"Starting Exposure {exposure + 1} of {repeat}") # ######################## # ##### Dome Slewing ##### Loading Loading @@ -238,10 +242,12 @@ class Template(BaseTemplate): # Checking if the image is ready to be downloaded while cam.ready != 1: log.debug(f"Downloading... (cam state {image_state[cam.ready]})") sleep(0.5) if self.check_pause_or_abort(): log.warning(f"Buffer still {image_state[cam.ready]}") return log.debug(f"Downloading... (cam state {image_state[cam.ready]})") cam.download() log.info(f"Elapsed {(Time.now() - now).sec:.2f}") Loading