def wcs_photom(image,cat_file='nocat',conf_file='noconf',appsize=2.0,verbose=False): if not wcs_succeeded(image): return 'failed' outname = image + '.phot' casutools.imcore_list(image, cat_file, outname, confidence_map=conf_file,rcore=appsize, noell=True, verbose=verbose) # do some quality checks factor = 5 size = 11 stars = 1000 side = 3 #how many subdevisions of the chip along each axis. must be odd. fwhm_a, fwhm_b, t = call_find_fwhm(image,cat_file,factor,size,stars,tag=image,side=side) frame_ston = compute_frame_signal_to_noise(image) pf.setval(outname,'FRAME_SN',1,value=round(frame_ston,2),comment='A measure of bulk structure in the image (S/N)') positions = ['Top left.','Top middle.','Top right.','Middle left.','Center.','Middle right.','Bottom left.','Bottom middle.','Bottom right.'] for val in range(1,10): pf.setval(outname,'PSF_a_'+str(val),1,value=fwhm_a['f_'+str(val)][0],comment='[pixels] psf long axis FWHM. '+positions[val-1]) pf.setval(outname,'PSF_b_'+str(val),1,value=fwhm_b['f_'+str(val)][0],comment='[pixels] psf short axis FWHM. '+positions[val-1]) pf.setval(outname,'PSF_t_'+str(val),1,value=t['f_'+str(val)][0],comment='[degrees] psf rotation angle. '+positions[val-1]) # Compute the HJD values append_hjd_correction_column(outname) return 'ok'
def test_second_hdu(blank_fits): with fitsio.FITS(blank_fits, 'rw') as outfile: outfile.write(np.zeros((2, 2))) assert len(outfile) == 2 set_wcs_status(blank_fits, succeeded=True, hdu=1) with fitsio.FITS(blank_fits) as infile: hdu = infile[1] header = hdu.read_header() assert header['wcscompl'] == True assert wcs_succeeded(blank_fits, hdu=1)
def test_second_hdu(blank_fits): with fitsio.FITS(blank_fits, 'rw') as outfile: outfile.write(np.zeros((2, 2))) assert len(outfile) == 2 set_wcs_status(blank_fits, succeeded=True, hdu=1) with fitsio.FITS(blank_fits) as infile: hdu = infile[1] header = hdu.read_header() assert header['wcscompl'] == True assert wcs_succeeded(blank_fits, hdu=1)
def test_setting_key_succeeded(blank_fits): old_header = fitsio.read_header(blank_fits) assert 'wcscompl' not in old_header set_wcs_status(blank_fits, succeeded=True) assert wcs_succeeded(blank_fits)
def test_file_without_key(blank_fits): header = fitsio.read_header(blank_fits) assert 'wcscompl' not in header assert wcs_succeeded(blank_fits)
def test_failed_fits_file(failed_fits_file): assert not wcs_succeeded(failed_fits_file)
def test_succeeded_fits_file(succeeded_fits_file): assert wcs_succeeded(succeeded_fits_file)
def test_setting_key_succeeded(blank_fits): old_header = fitsio.read_header(blank_fits) assert 'wcscompl' not in old_header set_wcs_status(blank_fits, succeeded=True) assert wcs_succeeded(blank_fits)
def test_file_without_key(blank_fits): header = fitsio.read_header(blank_fits) assert 'wcscompl' not in header assert wcs_succeeded(blank_fits)
def test_failed_fits_file(failed_fits_file): assert not wcs_succeeded(failed_fits_file)
def test_succeeded_fits_file(succeeded_fits_file): assert wcs_succeeded(succeeded_fits_file)
def wcs_photom(image, cat_file='nocat', conf_file='noconf', appsize=2.0, verbose=False): if not wcs_succeeded(image): return 'failed' outname = image + '.phot' casutools.imcore_list(image, cat_file, outname, confidence_map=conf_file, rcore=appsize, noell=True, verbose=verbose) # do some quality checks factor = 5 size = 11 stars = 1000 side = 3 #how many subdevisions of the chip along each axis. must be odd. fwhm_a, fwhm_b, t = call_find_fwhm(image, cat_file, factor, size, stars, tag=image, side=side) frame_ston = compute_frame_signal_to_noise(image) pf.setval(outname, 'FRAME_SN', 1, value=round(frame_ston, 2), comment='A measure of bulk structure in the image (S/N)') positions = [ 'Top left.', 'Top middle.', 'Top right.', 'Middle left.', 'Center.', 'Middle right.', 'Bottom left.', 'Bottom middle.', 'Bottom right.' ] for val in range(1, 10): pf.setval(outname, 'PSF_a_' + str(val), 1, value=fwhm_a['f_' + str(val)][0], comment='[pixels] psf long axis FWHM. ' + positions[val - 1]) pf.setval(outname, 'PSF_b_' + str(val), 1, value=fwhm_b['f_' + str(val)][0], comment='[pixels] psf short axis FWHM. ' + positions[val - 1]) pf.setval(outname, 'PSF_t_' + str(val), 1, value=t['f_' + str(val)][0], comment='[degrees] psf rotation angle. ' + positions[val - 1]) # Compute the HJD values append_hjd_correction_column(outname) return 'ok'