# Converting frequency and velocity frames

For details on the various frequency and velocity definitions and rest frames used in JCMT heterodyne observations, please see our Velocity Considerations page.

Common requests:

1. to convert processed data from the JCMT Science Archive, which is in Barycentric frequency, into radio line-of-sight velocity ($v_{lsr}$) in LSRK. You can use the following Starlink commands to do this, assuming you have started with a file named ‘archive_file.fits’. These would be copied into a terminal, after setting up the Starlink software within that terminal. The lines starting with a # symbol are comments.
```# Load the convert package to enable conversion from FITS to NDF
convert

fits2ndf archive_file.fits archive_file.sdf

# Load the KAPPA package (contains many useful routines)
kappa

# Set the 3rd axis of the coordinate system to be in units of radio velocity

# Set the standard of rest to be the LSRK
wcsattrib ndf=archive_file.sdf mode=set name=StdofRest newval=LSRK

# OPTIONAL: if fits output is required, convert the file back to fits
```
2. to add together spectral data from moving targets (eg comets) onto a ‘source’ (‘cometocentric’) velocity scale:
```makecube <rawdatafile00099> system=GAPPT alignsys=TRUE out=out99.sdf
wcsattrib out99.sdf set alignoffset 1
wcsattrib out99.sdf set skyrefis origin
wcsattrib out99.sdf set sourceVRF topocentric
wcsattrib out99.sdf set stdofrest source
wcsattrib out99.sdf set alignstdofrest source
wcsattrib out99.sdf set SourceVel <velocity>

wcmosaic out*.dat . . .```