HTML automatically generated with rman
Table of Contents


ccdzshift - re-align (stack) spectra from a cube based on a reference



ccdzshift [parameter=value]


ccdzshift re-align all spectra in a cube based on a reference map of where a reference Z value (velocity) centroid should be. The shift is towards the center of the cube. In some sense this is like stacking spectra, except in this stage it will keep all spectra in their respective pixels. Another step is needed (e.g. ccdmom(1NEMO) ) to produce a truly single stacked spectrum.

The current version is optimized for galaxy cubes, where everything is velocity based, and searching for low density gas in the outer regions. Another application is high-Z frequency based, and stack based on certain spectral lines and look for a signal.


The following parameters are recognized in any order if the keyword is also given:
Input image cube. No default.
Z reference map. The values in the map must correspond to the WCS values of the Z axis of the input cube. No default.
Re-aligned output cube. No default.
0=use 0-based pixel 1=use 1-based pixel 2=use WCS [2]
Shift spectra using nearest pixel, or a more expensive interpolate? [t]
If given, this pixel will be the reference centroid of the cube. Although this gives the option to crop a large cube to a smaller one to contain the final signal, it will corrupt the WCS.


Following along the example in ccdvel(1NEMO) we have make an example with a falling density in the outer parts to see how much can be recovered using stacking (shifting) and integrating in elliptical rings. Some noise is added to ensure the outer regions to ensure the line is buried in the noise, unless the signal is stacked/integrated in rings:
  # make lookup tables
  nemoinp 0:140:5 > map1.radt
  tabmath map1.radt map1.dent  "exp(-%1/20)" all
  tabmath map1.radt map1.velt  "%1/sqrt(40+%1*%1)" all
  # plot the density (red in pgplot) and velocity (green in pgplot) vs.
  paste map1.radt map1.dent map1.velt | tabplot - 1 2,3 color=2,3 line=2,1
  # velocity and density
  ccdvel out=map1.vel radii=@map1.radt vrot=@map1.velt pa=45 inc=60 size=256
  ccdvel out=map1.den radii=@map1.radt vrot=@map1.dent pa=45 inc=60 size=256
  # cube with and without noise
  velcube invel=map1.vel inden=map1.den out=map1.cube sigdefault=0.1 zrange=8:12
  velcube invel=map1.vel inden=map1.den out=- sigdefault=0.1 zrange=8:12 nz=200
    ccdmath - map1n.cube ’%1+rang(0,0.001)’
  # shifted cubes (adding noise back where it was lost due to the shift)
  ccdzshift map1.cube  map1.vel  map2.cube
  ccdzshift map1n.cube map1.vel  - |\
    ccdmath - map2n.cube ’ifeq(%1,0,%1+rang(0,0.001),%1)’
  ccdellint map2.cube  0:200:2 pa=45 inc=60 vsys=10 center=128,128 out=map2.rv
  ccdellint map2n.cube 0:200:2 pa=45 inc=60 vsys=10 center=128,128 out=map2n.rv
  ccdellint map2n.cube 0:200:2 pa=45 inc=60 vsys=10 center=128,128 out=map2m.rv
  ccdmom map2n.rv - axis=2 mom=0 | ccdprint - x= newline=t label=x  |\
    tabmath - - ’%1,log(%2)’ all | tabplot - 1 2 color=2 point=2,0.1 line=1,1 xcoord=140
  ccdmom map2n.rv - axis=2 mom=1 | ccdprint - x= newline=t label=x  |\
    tabplot - 1 2 color=2 point=2,0.1 line=1,1 ymin=9 ymax=11 xcoord=140
  ccdmom map2n.rv - axis=2 mom=2 | ccdprint - x= newline=t label=x  |\
    tabplot - 1 2 color=2 point=2,0.1 line=1,1 ymin=0 ymax=2  xcoord=140
  # this mom=2 plot has lots of NaN’s at radii
A more realistic example would be to use observational data. Lets say we have a cube, and a velocity field. First recifying the cube, then averaging all emission along the RA (x) and DEC (y) axis, we get a single spectrum along z, plotted using tabplot(1NEMO) :

  ccdmom ngc6503.ccd ngc6503vel.ccd mom=1 rngmsk=t clip=0.002
  ccdzshift ngc6503.ccd ngc6503vel.ccd ngc6503_0.ccd
  ccdmom ngc6503_0.ccd - axis=1 |\
    ccdmom - - axis=2 |\
    ccdprint - x= y= z= |\
    tabplot - 0 1 line=1,1 ycoord=0 point=2,0.05
  nds9 ngc6503_0.ccd


It is assumed the Z axis is in velocity, a Frequency or Wavelength axis is not supported. You will need to convert to a velocity axis in another package. We give two examples, the first one in MIRIAD:
  fits in=ngc6503.fits out=ngc6503.mir op=xyin
  velsw in=ngc6503.mir axis=VRAD
  fits in=ngc6503.mir out=ngc6503vrad.fits op=xyout
  fitsccd ngc6503vrad.fits - | ccdhead -
     Z-range:   261.861 -196.743
     MinMax:    -0.00315721 0.0169835

and one in CASA, which delivers in m/s

  fitsccd ngc6503vrad.fits - | ccdhead -
      Z-range:   261861 -196743
      MinMax:    -0.00315721 0.0169835

See Also

nemoinp(1NEMO) , tabmath(1NEMO) , ccdvel(1NEMO) , ccdmath(1NEMO) , ccdmom(1NEMO) , ccdsub(1NEMO) , velcube(1NEMO) , rvstack(1NEMO) , image(5NEMO)




Peter Teuben

Update History

30-Nov-20    V0.1 drafted w/ example        PJT
14-apr-21    V0.2 expanded examples    PJT

Table of Contents