Example #1
0
    outfits = ufile.replace('.fits', '_old.fits')
    outfitsname = os.path.split(outfits)[-1]
    # log that we are saving rotated image
    WLOG(p, '', 'Saving Rotated Image in ' + outfitsname)
    # add keys from original header file
    hdict = spirouImage.CopyOriginalKeys(hdr)
    # write to file
    p = spirouImage.WriteImage(p, outfits, newimage, hdict)

    # ----------------------------------------------------------------------
    # End Message
    # ----------------------------------------------------------------------
    wmsg = 'Recipe {0} has been successfully completed'
    WLOG(p, 'info', wmsg.format(p['PROGRAM']))
    # return a copy of locally defined variables in the memory
    return dict(locals())


# =============================================================================
# Start of code
# =============================================================================
if __name__ == "__main__":
    # run main with no arguments (get from command line - sys.argv)
    ll = main()
    # exit message if in debug mode
    spirouStartup.Exit(ll, has_plots=False)

# =============================================================================
# End of code
# =============================================================================
    # add berv values
    hdict = spirouImage.AddKey(p, hdict, p['KW_BERV'], value=loc['BERV'])
    hdict = spirouImage.AddKey(p, hdict, p['KW_BJD'], value=loc['BJD'])
    hdict = spirouImage.AddKey(p,
                               hdict,
                               p['KW_BERV_MAX'],
                               value=loc['BERV_MAX'])
    # write image and add header keys (via hdict)
    p = spirouImage.WriteImage(p, corfile, data, hdict)

    # ----------------------------------------------------------------------
    # End Message
    # ----------------------------------------------------------------------
    p = spirouStartup.End(p)
    # return a copy of locally defined variables in the memory
    return dict(locals())


# =============================================================================
# Start of code
# =============================================================================
if __name__ == "__main__":
    # run main with no arguments (get from command line - sys.argv)
    ll = main()
    # exit message if in debug mode
    spirouStartup.Exit(ll)

    # =============================================================================
    # End of code
    # =============================================================================
Example #3
0
    centpart = data2[:, col - slice0:col + slice0]
    #    centpart = data2[col - slice:col + slice,:]
    #    weights = np.where((centpart < satseuil) & (centpart > 0), 1, 0.0001)
    #    y = np.average(centpart, axis=1, weights=weights)  ## weighted average
    y = np.nanmedian(centpart, axis=1)
    # y=average(centpart,axis=1,weights=where((centpart>0),1,0.0001))
    # ## weighted average
    plt.plot(np.arange(ny), y)

    # ----------------------------------------------------------------------
    # End Message
    # ----------------------------------------------------------------------
    p = spirouStartup.End(p, outputs=None)
    # return a copy of locally defined variables in the memory
    return dict(locals())


# =============================================================================
# Start of code
# =============================================================================
if __name__ == "__main__":
    # run main with no arguments (get from command line - sys.argv)
    ll = main()
    # exit message if in debug mode
    spirouStartup.Exit(ll, has_plots=True)

# =============================================================================
# End of code
# =============================================================================