Spring2020/PythonPhotometry/Sarah_DiffPhotometry.py
def construct_astrometry(hdr_wcs):
    '''
    construct_astrometry
    
    make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return
    
    inputs
    ------------------------------
    hdr_wcs  :  header with astrometry information, typically from astrometry.net
    
    returns
    ------------------------------
    w        :  the WCS instance
    
    '''
    
    # initialize the World Coordinate System
    w = WCS(naxis=2)
    
    # specify the pixel to RA/Dec conversion
    w.wcs.ctype = ["RA---TAN", "DEC--TAN"]
    w.wcs.cd = np.array([[hdr_wcs['CD1_1'],hdr_wcs['CD1_2']],[hdr_wcs['CD2_1'],hdr_wcs['CD2_2']]])
    w.wcs.crpix = [hdr_wcs['CRPIX1'], hdr_wcs['CRPIX2']]
    w.wcs.crval = [hdr_wcs['CRVAL1'],hdr_wcs['CRVAL2']]
    w.wcs.cunit = [hdr_wcs['CUNIT1'],hdr_wcs['CUNIT2']]
    w.wcs.latpole = hdr_wcs['LATPOLE']
    #w.wcs.lonpole = hdr_wcs['LONPOLE']
    w.wcs.theta0 = hdr_wcs['LONPOLE']
    w.wcs.equinox = hdr_wcs['EQUINOX']

    # calculate the RA/Dec to pixel conversion
    w.wcs.fix()
    w.wcs.cdfix()
    w.wcs.set()
    
    # return the instance
    return w

    construct_astrometry
    
    make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return
    
    inputs
    ------------------------------
    hdr_wcs  :  header with astrometry information, typically from astrometry.net
    
    returns
    ------------------------------
    w        :  the WCS instance
    
    
construct_astrometry
make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return

inputs

hdr_wcs  :  header with astrometry information, typically from astrometry.net

returns

w        :  the WCS instance
construct_astrometry make the pixel to RA / Dec conversion ( and back ) from the header of an astrometry . net return inputs hdr_wcs : header with astrometry information typically from astrometry . net returns w : the WCS instance
def construct_astrometry(hdr_wcs):
    w = WCS(naxis=2)
    w.wcs.ctype = ["RA---TAN", "DEC--TAN"]
    w.wcs.cd = np.array([[hdr_wcs['CD1_1'],hdr_wcs['CD1_2']],[hdr_wcs['CD2_1'],hdr_wcs['CD2_2']]])
    w.wcs.crpix = [hdr_wcs['CRPIX1'], hdr_wcs['CRPIX2']]
    w.wcs.crval = [hdr_wcs['CRVAL1'],hdr_wcs['CRVAL2']]
    w.wcs.cunit = [hdr_wcs['CUNIT1'],hdr_wcs['CUNIT2']]
    w.wcs.latpole = hdr_wcs['LATPOLE']
    w.wcs.theta0 = hdr_wcs['LONPOLE']
    w.wcs.equinox = hdr_wcs['EQUINOX']
    w.wcs.fix()
    w.wcs.cdfix()
    w.wcs.set()
    return w
def construct_astrometry ( hdr_wcs ) : w = WCS ( naxis = 2 ) w . wcs . ctype = [ "RA---TAN" , "DEC--TAN" ] w . wcs . cd = np . array ( [ [ hdr_wcs [ 'CD1_1' ] , hdr_wcs [ 'CD1_2' ] ] , [ hdr_wcs [ 'CD2_1' ] , hdr_wcs [ 'CD2_2' ] ] ] ) w . wcs . crpix = [ hdr_wcs [ 'CRPIX1' ] , hdr_wcs [ 'CRPIX2' ] ] w . wcs . crval = [ hdr_wcs [ 'CRVAL1' ] , hdr_wcs [ 'CRVAL2' ] ] w . wcs . cunit = [ hdr_wcs [ 'CUNIT1' ] , hdr_wcs [ 'CUNIT2' ] ] w . wcs . latpole = hdr_wcs [ 'LATPOLE' ] w . wcs . theta0 = hdr_wcs [ 'LONPOLE' ] w . wcs . equinox = hdr_wcs [ 'EQUINOX' ] w . wcs . fix ( ) w . wcs . cdfix ( ) w . wcs . set ( ) return w
construct_astrometry
make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return
construct_astrometry make the pixel to RA / Dec conversion ( and back ) from the header of an astrometry . net return
'''
    construct_astrometry
    
    make the pixel to RA/Dec conversion (and back) from the header of an astrometry.net return
    
    inputs
    ------------------------------
    hdr_wcs  :  header with astrometry information, typically from astrometry.net
    
    returns
    ------------------------------
    w        :  the WCS instance
    
    ''' # initialize the World Coordinate System # specify the pixel to RA/Dec conversion #w.wcs.lonpole = hdr_wcs['LONPOLE'] # calculate the RA/Dec to pixel conversion # return the instance
hdr_wcs