Chapter 12. How to make a spectral cube

Table of Contents

12.1. Introduction to doGridding
12.2. doGridding Summary
12.3. Using doGridding...
12.3.1. ...to change beam, pixel, and map size
12.3.2. ...to make cubes of combined H- and V- polarisation
12.3.3. ...to make cubes for Solar System Objects
12.3.4. ...to make cubes more efficiently (limiting data input)
12.3.5. ...to make a rotated map or use a different WCS
12.3.6. ...with a different convolution
12.3.7. ...to specify the map centre
12.3.8. ...with selected data types
12.3.9. ...to deal with NaNs
12.4. doGridding in Detail
12.4.1. Particulars of Convolution
12.4.2. Using the Gridding task with the Spectrum Toolbox

Last updated: 20 Jan, 2012

12.1. Introduction to doGridding

Spectral cubes from all HIFI mapping observations are produced as part of the SPG pipeline and are found in the cubes context of the level 2 product. However, baseline and standing wave corrections are not done automatically in the pipeline because of the risk of harming the scientific content of the data, and the cubes produced automatically by the pipeline must therefore be regarded as browse-quality products and it should not be assumed that scientific analysis can immediately be carried out on them. It is strongly recommended that you inspect your level 2 HTPs for baseline drifts and residual standing waves and decide if some, or all, datasets need to be cleaned up before re-gridding the level 2 data using the doGridding task. The use of the doGridding task is described in this chapter while corrections of baselines and standing waves are discussed in Section 10.3 and Chapter 9.

The doGridding task is provided to allow to create cubes from the level 2 data yourself. Your science objectives may require you to create cubes using different parameterisations (pixel size, beam size etc...) for the gridding than the defaults. In some cases, the pipeline does not yet produce the optimal cube, in particular:

  • the pipeline does not automatically produce cubes on a co-moving grid so any maps of solar system objects must be regridded with the co-moving option turned on, see Section 12.3.3
  • the pipeline assumes a position angle of zero and if you specified a different position angle in HSpot you will need to regrid data passing that information to doGridding using the flyAngle parameter, see Section 12.3.5
[Note] New in HIPE 8

In the past, somewhat theoretical estimates of the beam and pixel sizes were used by the pipeline to grid maps with half beam and with Nyquist spacing, while maps with other spacings (10", 20", 40") could only be gridded assuming a half-beam spacing. This approach was a consequence of the fact that very limited information about how the observation was actually carried out was available in the observationContext.

A significant effort has been undertaken to remedy this situation and now the metadata contains observation information, such as the HPBW (beam size) appropriate for the LO setting, the spacing between scan legs in maps, and the space between readouts along scan legs. This information is present for observations from OD 835 onwards and this work will be completed for earlier observations with HIPE 9.

The doGridding task has been updated to use this information, where it is present, to create cubes that accurately reflect how the observation was carried out and therefore more accurately reflect the map you requested in HSpot. Maps observed from OD 835 onwards are gridded using the scan leg and scan readout spacings used in the observations, whilst earlier observations are gridded using a better approach than in HIPE 7.

In order to take advantage of these updates, data must be pipelined using HIPE 8 and a step from the level 0 pipeline, doUplink must be run. This will automatically be the case for data taken from the HSA that is processed with HIPE 8. Data processed with previous HIPE versions will have to be re-pipelined using the following script:

from herschel.hifi.pipeline.level0 import DoUplink
doUplink=DoUplink()
backend = "WBS-V"
htp=obs.refs["level1"].product.refs[backend].product
htp1=doUplink(htp=htp.copy(), auxiliary=obs.getAuxiliary())
l1=obs.refs["level1"].product
l1.setProduct(backend,htp1)
obs.setProduct("level1",l1)
obs = hifiPipeline(obs=obs, fromLevel=1, upToLevel=2, save=0, apids=[backend])
#
# Now repeat replacing backend with "WBS-H", "HRS-H", "HRS-V".  
# Save your observationContext to keep the updated metadata!

If you prefer not to repipeline you data in HIPE 8 for some reason but do want to take advantage of the better map gridding, you can also run the needed tasks in the following way:

htp=obs.refs["level2"].product.refs["WBS-H-USB"].product
from herschel.hifi.pipeline.level0 import DoUplink
doUplink=DoUplink()
htp=doUplink(htp=htp, auxiliary=obs.getAuxiliary())
from herschel.hifi.dp.otf.util import DoHpbwTask
cal=obs.calibration
doHpbw=DoHpbwTask()
doHpbw(cal=cal,htp=htp)
cubes1=doGridding(htp=htp)

You would then either have to put the HTPs back into the observationContext and save that, or run this script each time before gridding.