Skip to content

Instantly share code, notes, and snippets.

View dsberry's full-sized avatar

David Berry dsberry

  • East Asian Observatory
  • Hilo, HI
View GitHub Profile
#!/usr/bin/env python
import starlink.Ast as Ast
# Create a text file containing an STC-S phrase.
with open("stcs1","w") as f:
f.write('''
Union ICRS TOPOCENTER (
Circle 180 10 20
Circle 190 10 20
#!/bin/env python
# Re-projects a 2D FITS image so that it is aligned pixel-for-pixel with
# another reference FITS image.
# Usage:
# wcsalign.py <infile> <reffile> <outfile>
#
# <infile> = Input fits file
# <reffile> = Reference fits file
@dsberry
dsberry / move_wcs.py
Created November 30, 2012 15:33
Translates a FITS image in X and y, correcting the WCS accordingly
#!/bin/env python
# Moves a simple 2D FITS image in X and Y. The output image is the same size as
# the input image.
# Usage:
# move_wcs.py <infile> <outfile> <xshift> <yshift>
#
# <infile> = Input fits file
# <outfile> = Output fits file
@dsberry
dsberry / rotate_wcs.py
Created November 29, 2012 19:29
Script to rotate the WCS associated with a FITS file using pyast
#!/bin/env python
# Rotates a simple 2D FITS image. If <xcen> and <ycen> are specified,
# the output image is the same size as the input image. Otherwise,
# the output image is the smallest that will hold all the rotated input
# data.
# Usage:
# rotate_wcs.py <infile> <outfile> <rotation> [<xcen> <ycen>]
#
@dsberry
dsberry / skyposition.py
Created November 22, 2012 16:25
A partial implementation of the astropy coordinates API using pyast
from .angles import Angle
from .. import units as u
import starlink.Ast as Ast
__all__ = [ 'SkyPosition', 'ICRSPosition', 'AZELPosition',
'ECLIPTICPosition', 'FK4Position', 'FK4_NO_EPosition',
'FK5Position', 'GALACTICPosition', 'GEOCENTRICPosition',
'HELIOECLIPTICPosition', 'J2000Position',
'SUPERGALACTICPosition', 'UNKNOWNPosition' ]