WCS.jl
Astronomical World Coordinate System library for Julia. This package wraps the WCSLIB C library. This is a tool made for users who are already familiar with WCS transformations. If you are not, please reference the following manuscripts
- Representation of world coordinates in FITS
- Representations of celestial coordinates in FITS
- Representations of spectral coordinates in FITS
- Representations of distortions in FITS world coordinate systems
Table of Contents
- Ecosystem
- Cosmology Overview
- Data I/O Overview
- Images Overview
- Numerical Utilities Overview
- Orbits & Ephemerides Overview
- Statistics Overview
- Time, Coordinates, & Units Overview
- Visualization & Plotting Overview
- JuliaAstro
- AstroAngles.jl
- API Documentation
- Contours
- Image Filtering
- Image Transformations
- Photometry
- Reprojecting Images
- Home
- Array Operations
- Conventions
- Converting to RGB
- Dimensions and World Coordinates
- Displaying Images
- Getting Started
- Headers
- Loading Images
- Preserving the AstroImage Wrapper
- AstroLib.jl
- Reference
- Epochs
- Periods
- Time Scales
- AstroTime
- Tutorial
- API/Reference
- BoxLeastSquares.jl
- CFITSIO.jl
- CasaCore.jl
- API/Reference
- Cosmology.jl
- API
- EarthOrientation.jl
- Internals
- Tutorial
- API Reference
- FITSIO.jl
- API/Reference
- Examples
- LACosmic.jl
- LombScargle.jl
- Support for OI-FITS data in Julia
- PSFModels.jl
- PairPlots.jl
- Apertures
- Examples
- Aperture Photometry
- Background Estimators
- Background Estimation
- Background Interpolators
- Source Detection Algorithms
- Source Detection
- Photometry.jl
- PlanetOrbits.jl
- Connection to a specific server
- Drawing in SAOImage/DS9
- Examples
- Introduction
- Installation
- Package library
- SAOImage/DS9 requests
- Starting
- API/Reference
- SkyCoords.jl
- Transits.jl
- UnitfulAstro.jl Documentation
- WCS.jl
- Curve Fitting
- Getting Started
- JWST image with scale bar
- Working with tabular data
Installation
From the REPL, press ]
to enter Pkg mode
(v 1.2) pkg> add WCS
Usage
Import the library
julia> using WCS
There are many ways to utilize WCS transformations. Let's make one for a 2-dimensional array (like an image) from scratch.
julia> wcs = WCSTransform(2;
cdelt = [-0.066667, 0.066667],
ctype = ["RA---AIR", "DEC--AIR"],
crpix = [-234.75, 8.3393],
crval = [0., -90],
pv = [(2, 1, 45.0)])
WCSTransform(naxis=2,cdelt=[-0.066667, 0.066667],crval=[0.0, -90.0],crpix=[-234.75, 8.3393])
We can also create one from a FITS header if it contains the appropriate keywords
# Or from a FITS header with appropriate keywords
julia> wcs_array = WCS.from_header(header)
julia> wcs = wcs_array[1]
Now we can do conversions between pixel and world coordinates.
that WCS transforms use pixel (0, 0)
as the top-left corner (not 1-indexed!!!)
# convert pixel -> world coordinates
julia> pixcoords = [0.0 24.0 45.0; # x coordinates
0.0 38.0 98.0] # y coordinates
2×3 Matrix{Float64}:
0.0 24.0 45.0
0.0 38.0 98.0
julia> worldcoords = pix_to_world(wcs, pixcoords)
2×3 Matrix{Float64}:
267.965 276.539 287.771
-73.7366 -71.9741 -69.6781
julia> pixcoords = world_to_pix(wcs, worldcoords)
2×3 Matrix{Float64}:
1.16529e-12 24.0 45.0
-7.10543e-14 38.0 98.0
API/Reference
WCS.WCSTransform
— TypeWCSTransform(naxis; kwds...)
Construct a WCS transformation with the given number of axes naxis
. Keyword arguments can be passed to set various attributes of the transform. Specifying keyword arguments is equivalent to setting them after construction:
julia> wcs = WCSTransform(2; crpix=[1000., 1000.])
is equilvalent to:
julia> wcs = WCSTransform(2)
julia> wcs.crpix = [1000., 1000.]
Properties
Below is the entire list of public properties for a WCSTransform
Keyword | Type | Description |
---|---|---|
naxis | Int | Number of dimensions |
crval | Vector{Float}[naxis] | coordinate value at reference point |
crpix | Vector{Float}[naxis] | array location of the reference point in pixels |
cdelt | Vector{Float}[naxis] | coordinate increment at reference point |
crder | Vector{Float}[naxis] | random error in coordinate |
csyer | Vector{Float}[naxis] | systematic error in coordinate |
ctype | Vector{String}[naxis] | axis type (8 characters) |
crota | Vector{Float}[naxis] | rotation from stated coordinate type |
cunit | Vector{String}[naxis] | units of axes |
cunit | Vector{String}[naxis] | names of axes |
pc | Matrix{Float}[naxis, naxis] | linear transformation matrix |
cd | Matrix{Float}[naxis, naxis] | linear transformation matrix (with scale) |
equinox | Float | the equinox associated with dynamical equatorial or ecliptic coordinate systems |
latpole | Float | the native latitude of the celestial pole |
lonpole | Float | the native longitude of the celestial pole |
mjdavg | Float | Modified Julian Date corresponding to DATE-AVG |
mjdobs | Float | Modified Julian Date corresponding to DATE-OBS |
restfrq | Float | rest frequency (Hz) |
restwav | Float | rest wavelength (m) |
velangl | Float | velocity angle |
velosys | Float | relative radial velocity |
zsource | Float | the redshift of the source |
colnum | Int | column of FITS binary table associated with this WCS |
dateavg | String | representative mid-point of the date of observation |
dateobs | String | start of the date of observation |
radesys | String | the equatorial or ecliptic coordinate system type |
specsys | String | spectral reference frame (standard of rest) |
ssysobs | String | spectral reference frame |
ssyssrc | String | spectral reference frame for redshift |
wcsname | String | name of this coordinate representation |
obsgeo | Vector{Float}[3] or Vector{Float}[6] | location of the observer in a standard terrestrial reference frame |
alt | String | character code for alternate coordinate descriptions |
WCS.from_header
— Methodfrom_header(header[; relax=WCS.HDR_ALL, ctrl=0, ignore_rejected=false, table=false])
Parse the FITS image header in the String header
, returning a Vector{WCSTransform}
giving all the transforms defined in the header. The relax
determines the treatment of non-standard keywords. The default is to accept all known non-standard keywords. Use relax=WCS.HDR_NONE
to ignore all non-standard keywords. Use, e.g., relax=(WCS.HDR_RADECSYS & WCS.HDR_CROTAia)
to only accept selected non-standard keywords.
WCS.obsfix
— Methodobsfix(ctrl::Integer, wcs::WCSTransform)
Complete the obsgeo
field wcs
of observatory coordinates. That is, if only the (x,y,z) Cartesian coordinate triplet or the (l,b,h) geodetic coordinate triplet are set, then it derives the other triplet from it. If both triplets are set, then it checks for consistency at the level of 1 metre.
Parameters
ctrl
: flag that controls behaviour if one triplet is defined and the other is only partially defined:- 0: Reset only the undefined elements of an incomplete coordinate triplet.
- 1: Reset all elements of an incomplete triplet.
- 2: Don't make any changes, check for consistency only. Returns an error if either of the two triplets is incomplete.
wcs
: Coordinate transformation parameters. Itsobsgeo
field may be changed.
Returns
- -1: No change required (not an error).
- 0: Success.
- 1: Null wcsprm pointer passed.
- 5: Invalid parameter value.
WCS.pix_to_world!
— Methodpix_to_world!(wcs, pixcoords, worldcoords[; stat=, imcoords=, phi=, theta=])
Convert the array of pixel coordinates pixcoords
to world coordinates according to the WCSTransform wcs
, storing the result in the worldcoords
and stat
arrays. pixcoords
should be a 2-d array where "pixcoords[:, i]" is the i-th set of coordinates, or a 1-d array representing a single set of coordinates. worldcoords
must be the same size and type as pixcoords
.
If given, the arrays stat
, imcoords
, phi
, theta
will be used to store intermediate results. Their sizes and types must all match pixcoords
, except for stat
which should be the same size but of type Cint (typically Int32).
WCS.pix_to_world
— Methodpix_to_world(wcs, pixcoords)
Convert the array of pixel coordinates pixcoords
to world coordinates according to the WCSTransform wcs
. pixcoords
should be a 2-d array where "pixcoords[:, i]" is the i-th set of coordinates, or a 1-d array representing a single set of coordinates.
The return value is the same shape as pixcoords
.
WCS.to_header
— Methodto_header(wcs[; relax=WCS.HDR_NONE])
Encode the WCSTransform wcs
as a FITS header string. The relax
keyword controls how non-standard extensions to the WCS standard are handled.
WCS.world_to_pix!
— Methodworld_to_pix!(wcs, worldcoords, pixcoords[; stat=, phi=, theta=, imcoords=])
Convert the array of pixel coordinates worldcoords
to pixel coordinates according to the WCSTransform wcs
, storing the result in the pixcoords
array. worldcoords
should be a 2-d array where "worldcoords[:, i]" is the i-th set of coordinates, or a 1-d array representing a single set of coordinates. pixcoords
must be the same size and type as worldcoords
.
If given, the arrays stat
, imcoords
, phi
, theta
will be used to store intermediate results. Their sizes and types must all match worldcoords
, except for stat
which should be the same size but of type Cint (typically Int32).
WCS.world_to_pix
— Methodworld_to_pix(wcs, worldcoords)
Convert the array of world coordinates worldcoords
to pixel coordinates according to the WCSTransform wcs
. worldcoords
is a 2-d array where "worldcoords[:, i]" is the i-th set of coordinates, or a 1-d array representing a single set of coordinates.
The return value is the same size as worldcoords
.
Index
AstroLib.POLELATLONG
AstroLib.observatories
AstroLib.planets
AstroTime.TimeScales.TAI
AstroTime.TimeScales.TCB
AstroTime.TimeScales.TCG
AstroTime.TimeScales.TDB
AstroTime.TimeScales.TT
AstroTime.TimeScales.UT1
AstroImages.AstroImage
AstroImages.Comment
AstroImages.History
AstroImages.Percent
AstroImages.WCSGrid
AstroImages.Zscale
AstroLib.Observatory
AstroLib.Planet
AstroTime.AstroDates.Date
AstroTime.AstroDates.DateTime
AstroTime.AstroDates.Time
AstroTime.Epochs.Epoch
AstroTime.Epochs.Epoch
AstroTime.Epochs.Epoch
AstroTime.Epochs.Epoch
AstroTime.Epochs.Epoch
AstroTime.Epochs.Epoch
AstroTime.Epochs.Epoch
AstroTime.Epochs.TAIEpoch
AstroTime.Epochs.TAIEpoch
AstroTime.Epochs.TAIEpoch
AstroTime.Epochs.TCBEpoch
AstroTime.Epochs.TCBEpoch
AstroTime.Epochs.TCBEpoch
AstroTime.Epochs.TCGEpoch
AstroTime.Epochs.TCGEpoch
AstroTime.Epochs.TCGEpoch
AstroTime.Epochs.TDBEpoch
AstroTime.Epochs.TDBEpoch
AstroTime.Epochs.TDBEpoch
AstroTime.Epochs.TTEpoch
AstroTime.Epochs.TTEpoch
AstroTime.Epochs.TTEpoch
AstroTime.Epochs.UT1Epoch
AstroTime.Epochs.UT1Epoch
AstroTime.Epochs.UT1Epoch
AstroTime.Periods.AstroPeriod
AstroTime.Periods.TimeUnit
AstroTime.TimeScales.BarycentricCoordinateTime
AstroTime.TimeScales.BarycentricDynamicalTime
AstroTime.TimeScales.GeocentricCoordinateTime
AstroTime.TimeScales.InternationalAtomicTime
AstroTime.TimeScales.TerrestrialTime
AstroTime.TimeScales.TimeScale
AstroTime.TimeScales.UniversalTime
BoxLeastSquares.BLSPeriodogram
DimensionalData.Dimensions.Dim
DimensionalData.Dimensions.LookupArrays.At
DimensionalData.Dimensions.LookupArrays.Near
DimensionalData.Dimensions.X
DimensionalData.Dimensions.Y
DimensionalData.Dimensions.Z
EarthOrientation.EOParams
FITSIO.FITS
FITSIO.FITSHeader
Photometry.Aperture.AbstractAperture
Photometry.Aperture.CircularAnnulus
Photometry.Aperture.CircularAperture
Photometry.Aperture.EllipticalAnnulus
Photometry.Aperture.EllipticalAperture
Photometry.Aperture.RectangularAnnulus
Photometry.Aperture.RectangularAperture
Photometry.Aperture.Subpixel
Photometry.Background.BackgroundInterpolator
Photometry.Background.BiweightLocationBackground
Photometry.Background.BiweightScaleRMS
Photometry.Background.IDWInterpolator
Photometry.Background.LocationEstimator
Photometry.Background.MADStdRMS
Photometry.Background.MMMBackground
Photometry.Background.RMSEstimator
Photometry.Background.SourceExtractorBackground
Photometry.Background.StdRMS
Photometry.Background.ZoomInterpolator
Photometry.Detection.PeakMesh
Photometry.Detection.SourceFinder
SkyCoords.AbstractSkyCoords
SkyCoords.EclipticCoords
SkyCoords.FK5Coords
SkyCoords.GalCoords
SkyCoords.ICRSCoords
WCS.WCSTransform
AstroImages.asinhstretch
AstroImages.composecolors
AstroImages.copyheader
AstroImages.header
AstroImages.implot
AstroImages.imview
AstroImages.logstretch
AstroImages.powerdiststretch
AstroImages.powstretch
AstroImages.shareheader
AstroImages.sinhstretch
AstroImages.sqrtstretch
AstroImages.squarestretch
AstroImages.wcs
AstroLib.adstring
AstroLib.airtovac
AstroLib.aitoff
AstroLib.altaz2hadec
AstroLib.baryvel
AstroLib.bprecess
AstroLib.calz_unred
AstroLib.co_aberration
AstroLib.co_nutate
AstroLib.co_refract
AstroLib.co_refract_forward
AstroLib.ct2lst
AstroLib.daycnv
AstroLib.deredd
AstroLib.eci2geo
AstroLib.eq2hor
AstroLib.eqpole
AstroLib.euler
AstroLib.flux2mag
AstroLib.gal_uvw
AstroLib.gcirc
AstroLib.geo2eci
AstroLib.geo2geodetic
AstroLib.geo2mag
AstroLib.geodetic2geo
AstroLib.get_date
AstroLib.get_juldate
AstroLib.hadec2altaz
AstroLib.helio
AstroLib.helio_jd
AstroLib.helio_rv
AstroLib.hor2eq
AstroLib.imf
AstroLib.ismeuv
AstroLib.jdcnv
AstroLib.jprecess
AstroLib.juldate
AstroLib.kepler_solver
AstroLib.lsf_rotate
AstroLib.mag2flux
AstroLib.mag2geo
AstroLib.mean_obliquity
AstroLib.month_cnv
AstroLib.moonpos
AstroLib.mphase
AstroLib.nutate
AstroLib.ordinal
AstroLib.paczynski
AstroLib.planck_freq
AstroLib.planck_wave
AstroLib.planet_coords
AstroLib.polrec
AstroLib.posang
AstroLib.precess
AstroLib.precess_cd
AstroLib.precess_xyz
AstroLib.premat
AstroLib.rad2sec
AstroLib.radec
AstroLib.recpol
AstroLib.rhotheta
AstroLib.sec2rad
AstroLib.sixty
AstroLib.sphdist
AstroLib.sunpos
AstroLib.ten
AstroLib.tic_one
AstroLib.ticpos
AstroLib.tics
AstroLib.true_obliquity
AstroLib.trueanom
AstroLib.uvbybeta
AstroLib.vactoair
AstroLib.xyz
AstroLib.ydn2md
AstroLib.ymd2dn
AstroLib.zenpos
AstroTime.AstroDates.fractionofday
AstroTime.AstroDates.fractionofsecond
AstroTime.AstroDates.j2000
AstroTime.AstroDates.julian
AstroTime.AstroDates.julian_twopart
AstroTime.AstroDates.subsecond
AstroTime.Epochs.from_utc
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.getoffset
AstroTime.Epochs.julian_period
AstroTime.Epochs.modified_julian
AstroTime.Epochs.timescale
AstroTime.Epochs.to_utc
AstroTime.Periods.unit
AstroTime.Periods.value
AstroTime.update
Base.:-
Base.close
Base.deleteat!
Base.eltype
Base.haskey
Base.keys
Base.length
Base.length
Base.length
Base.ndims
Base.read
Base.read
Base.read!
Base.size
Base.values
Base.write
Base.write
Base.write
Base.write
BoxLeastSquares.BLS
BoxLeastSquares.autoperiod
BoxLeastSquares.model
BoxLeastSquares.model
BoxLeastSquares.params
BoxLeastSquares.periods
BoxLeastSquares.power
CFITSIO.bitpix_from_type
CFITSIO.cfitsio_typecode
CFITSIO.fits_clobber_file
CFITSIO.fits_close_file
CFITSIO.fits_copy_image_section
CFITSIO.fits_create_ascii_tbl
CFITSIO.fits_create_binary_tbl
CFITSIO.fits_create_diskfile
CFITSIO.fits_create_file
CFITSIO.fits_create_img
CFITSIO.fits_delete_file
CFITSIO.fits_delete_hdu
CFITSIO.fits_delete_key
CFITSIO.fits_delete_record
CFITSIO.fits_delete_rows
CFITSIO.fits_file_mode
CFITSIO.fits_file_name
CFITSIO.fits_get_coltype
CFITSIO.fits_get_hdrspace
CFITSIO.fits_get_img_size
CFITSIO.fits_get_num_hdus
CFITSIO.fits_hdr2str
CFITSIO.fits_insert_img
CFITSIO.fits_insert_rows
CFITSIO.fits_movabs_hdu
CFITSIO.fits_movnam_hdu
CFITSIO.fits_movrel_hdu
CFITSIO.fits_open_data
CFITSIO.fits_open_diskfile
CFITSIO.fits_open_file
CFITSIO.fits_open_image
CFITSIO.fits_open_table
CFITSIO.fits_read_col
CFITSIO.fits_read_keyn
CFITSIO.fits_read_keyword
CFITSIO.fits_read_pix
CFITSIO.fits_read_pixnull
CFITSIO.fits_read_record
CFITSIO.fits_read_subset
CFITSIO.fits_resize_img
CFITSIO.fits_write_col
CFITSIO.fits_write_key
CFITSIO.fits_write_null_img
CFITSIO.fits_write_pix
CFITSIO.fits_write_pixnull
CFITSIO.fits_write_record
CFITSIO.fits_write_subset
CFITSIO.libcfitsio_version
CFITSIO.type_from_bitpix
Cosmology.age
Cosmology.angular_diameter_dist
Cosmology.comoving_radial_dist
Cosmology.comoving_volume
Cosmology.comoving_volume_element
Cosmology.cosmology
Cosmology.distmod
Cosmology.lookback_time
Cosmology.luminosity_dist
Dates.day
Dates.dayofyear
Dates.hour
Dates.microsecond
Dates.millisecond
Dates.minute
Dates.month
Dates.nanosecond
Dates.now
Dates.second
Dates.second
Dates.year
Dates.yearmonthday
DimensionalData.Dimensions.dims
DimensionalData.Dimensions.refdims
EarthOrientation.getdate
EarthOrientation.getdx
EarthOrientation.getdx_err
EarthOrientation.getdy
EarthOrientation.getdy_err
EarthOrientation.getdψ
EarthOrientation.getdψ_err
EarthOrientation.getdϵ
EarthOrientation.getdϵ_err
EarthOrientation.getlod
EarthOrientation.getlod_err
EarthOrientation.getxp
EarthOrientation.getxp_err
EarthOrientation.getyp
EarthOrientation.getyp_err
EarthOrientation.getΔUT1
EarthOrientation.getΔUT1_TAI
EarthOrientation.getΔUT1_err
EarthOrientation.polarmotion
EarthOrientation.precession_nutation00
EarthOrientation.precession_nutation80
EarthOrientation.update
FITSIO.colnames
FITSIO.copy_section
FITSIO.default_header
FITSIO.fitsread
FITSIO.fitswrite
FITSIO.get_comment
FITSIO.read_header
FITSIO.read_key
FITSIO.set_comment!
FITSIO.write_key
FileIO.load
FileIO.save
LACosmic.lacosmic
LombScargle.M
LombScargle.autofrequency
LombScargle.bootstrap
LombScargle.fap
LombScargle.fap
LombScargle.fapinv
LombScargle.fapinv
LombScargle.findmaxfreq
LombScargle.findmaxperiod
LombScargle.findmaxpower
LombScargle.freq
LombScargle.freqpower
LombScargle.lombscargle
LombScargle.lombscargle
LombScargle.model
LombScargle.period
LombScargle.periodpower
LombScargle.plan
LombScargle.power
LombScargle.prob
LombScargle.probinv
Photometry.Aperture.photometry
Photometry.Background.estimate_background
Photometry.Background.sigma_clip
Photometry.Background.sigma_clip!
Photometry.Detection.extract_sources
SAOImageDS9.accesspoint
SAOImageDS9.bitpix_of
SAOImageDS9.bitpix_to_type
SAOImageDS9.byte_order
SAOImageDS9.connect
SAOImageDS9.draw
SAOImageDS9.get
SAOImageDS9.set
SkyCoords.offset
SkyCoords.position_angle
SkyCoords.separation
WCS.from_header
WCS.obsfix
WCS.pix_to_world
WCS.pix_to_world
WCS.pix_to_world!
WCS.to_header
WCS.world_to_pix
WCS.world_to_pix
WCS.world_to_pix!
AstroTime.@timescale