6.9. Recipe for SPIRE Photometry

__________________________________________________________________________

6.9.1. SPIRE Source Extraction & Photometry in HIPE

HIPE has many methods available for source extraction and photometry. In this section, we will show how to perform both source extraction and photometry on the Level 2 product maps for a variety of source types (see Section 6.9.1.3 for an overview of the point source photometry methods available in HIPE). In Section 6.9.1.4 the source extraction and photometry using the HIPE algorithms SUSSEXtractor and DAOphot is explained. In Section 6.9.1.5 photometry via timeline fitting of the Level 1 products is explained. In Section 6.9.1.6 aperture photometry on SPIRE images is outlined.

The current recommendation for point source photometry is to use the Timeline Fitting algorithm for photometry of all but the faintest SPIRE maps, however all photometry methods return broadly similar results for SPIRE data . Source coordinates can either be fed directly to the Timeline Fitter or alternatively can be provided via the output of the source extraction from SUSSEXtractor or DAOphot. These recommendations are shown pictorially in Section 6.9.1.6.

Summary of Source Extraction and Photometry.

Figure 6.81. Summary of Source Extraction and Photometry.


6.9.1.1. SPIRE Flux Calibration

Full details of the SPIRE calibration can be found in the SPIRE Observers Manual and in dedicated publications: the calibration scheme is described in Griffin et al. (2013) and the implementation using Neptune as the primary calibration standard, is describe in Bendo et al. (2013). The treatment of the calibration for extended emission can be found in North et al. (2013)

The SPIRE photometer flux calibration has two sources of uncertainties which should be included in addition to the statistical errors of any measurement for point source calibration. One is a systematic uncertainty in the flux calibration related to the uncertainty in the models used for Neptune, the primary calibrator; these uncertainties, which are correlated across all three SPIRE bands, are currently quoted as 4%. The other source of uncertainty is a random uncertainty related to the ability to repeat flux density measurements of Neptune. This random uncertainty is <1.5% for all three bands.

For extended emission calibration, in addition to the above uncertainties, there is an additional 1% uncertainty due to the current uncertainty in the measured beam area.

6.9.1.2. Converting Jy/beam to surface brightness or flux densities in the SPIRE pipeline

Pipeline data and Level-2 maps are calibrated in Jy/beam. It is important to note that, since the SPIRE photometer flux calibration is performed on the timeline data, the beam areas equivalent to the beams of the timeline data must be used when calibrating extended emission in terms of surface brightness (Jy/pixel or /sr). To convert maps from from Jy/beam to Jy/pixel, the point source calibrated maps need to be divided by the beam. The beam areas corresponding to the 1 arcsec pixel scale for a spectral index (α) of -1 as used in the pipeline should be used(see Table 6.10). However, point source fluxes measured on surface brightness maps (e.g. Jy/pixel) need to be corrected by a multiplicative factor corresponding to the ratio of the pipeline beam (α=-1) and the effective beam for the assumed spectral index of the source, which take into account the RSRF, the aperture efficiency and the variation of beam profile with frequency. These ratios are given in Table 6.11.

The standard SPIRE pipeline flux calibration assumes a point source calibration for the standard spectral index of α = -1 adopted for Herschel. Conversion factors to transform RSRF-weighted fluxes densities to monochromatic flux densities for point and extended sources are applied automatically in the the pipeline. All the flux conversion parameters are explained in detail in the ( SPIRE Handbook). The parameters are listed in Table 6.9. K4P is the pipeline point source flux conversion parameter. KMonE(α = −1) is the conversion to monochromatic surface brightness for an extended source with α = −1. KPtoE is the conversion from point source flux density to extended source surface brightness for a source spectrum α = −1. Ωpip is the beam solid angle for a source with α = −1, i.e. The effective beam area (Ωeff) for α =-1. K4E is the flux conversion parameter used in the pipeline, defined as KMonE(α = −1)Ωpip, which converts to the flux density of an extended source.

The conversion between exteneded and point source calibration is given by the ratio K4E/K4P. This ratio is referred to as K4EdivK4P and converts a point source monochromatic flux density to a monochromatic extended source surface brightness (see Table 6.9, not to be confused with KPtoE which includes the beam in the parameter and cannot be derived directly from the SPIRE Calibration Tree - see the code examples below).

All these factors are automatically applied to the standard pipeline products point source (psrcPxW in Jy/beam) and extended emission (extdPxW in MJy/sr) products. The extended emission (extdPxW, see Table 6.1) products have also been processed with the relative gains applied and have been absolute zero-point corrected using the Planck maps.

The K4E and K4P are the only K parameters explicitly included within the SPIRE Calibration Tree. For the purposes of Point source photometry, dividing by the K4E/K4P (K4EdivK4P) parameter converts from extended to point source calibration.

The relationship between the various K parameters is given by;

KPtoE = KMonE / K4P = (K4E / Ωeff) / K4P = (K4EdivK4P)/ Ωeff)

Note that the pipeline assumes a value of α = -1, therefore for other spectral indicies, the appropriate colour corrections should also be applied (see Section 6.9.1.8).

For the purposes of point source extraction, where the absolute scale of the beam model is unimportant, the appropriate FWHM corresponding to the 1 arcsec pixel scale should be used from Table 6.12 below

Table 6.9. SPIRE pipeline conversion factors for point and extended sources.

Parameter PSW PMW PLW
Wavelength (microns) 250 350 500
K4P 1.0102 1.0095 1.0056
KMonE (MJy/sr per Jy/beam) 91.5670 51.6654 23.7113
KPtoE (MJy/sr per Jy/beam) 90.6462 51.1806 23.5798
Beam Area (arcsec2) 469.3542 831.275 1804.3058
K4E 1.0102 1.0095 1.0056
K4E/K4P (K4EdivK4P) 1 1 1


Table 6.10. Beam Areas assumed by the pipeline (α = -1)

Spectral Index Beam Area (arcsec2) Beam Area (/10-8sr)
(Fnu=nuα) PSW PMW PLW PSW PMW PLW
-1.0 469.35423 831.27497 1804.30575 1.10319 1.95386 4.24092


Table 6.11. Effective Beam Area ratios (beam correction) as function of spectral index (α)

Spectral Index Effective Beam Area Ratio (Ω(-1)/Ω(α))
(Fnu=nuα) PSW PMW PLW
-4 0.9593 0.9603 0.9311
-3.5 0.9658 0.9666 0.9419
-3 0.9724 0.973 0.953
-2.5 0.9791 0.9795 0.9643
-2 0.986 0.9862 0.976
-1.5 0.9929 0.9931 0.9879
-1 1 1 1
-0.5 1.0072 1.007 1.0123
0 1.0145 1.0142 1.0247
0.5 1.0219 1.0214 1.0371
1 1.0294 1.0287 1.0496
1.5 1.037 1.036 1.0621
2 1.0446 1.0434 1.0746
2.5 1.0523 1.0508 1.0869
3 1.06 1.0581 1.0991
3.5 1.0677 1.0655 1.1111
4 1.0755 1.0729 1.1229
4.5 1.0832 1.0802 1.1344
5 1.0908 1.0875 1.1456


Table 6.12. SPIRE FWHM Parameters for 1 arcsec pixels.

Band FWHM Mean FWHM Ellipticity (Flattening)
(micron) (arcsec) (arcsec) (%)
250 18.4x17.4 17.9 5.1
350 24.9x23.6 24.2 5.4
500 37.0x33.8 35.4 8.7


6.9.1.3. Recipes for SPIRE Point Source Photometry

The SPIRE pipeline and HIPE have several methods available for point source photometry, e.g. map based methods (SUSSEXtractor and DAOphot Section 6.9.1.4), timeline fitting (Section 6.9.1.5) and aperture photometry Section 6.9.1.6. Each method requires different input parameters (e.g. effective beam areas, FWHM, aperture sizes, colour and aperture corrections, etc). The rationale behind the various steps required for photometry can be found in the SPIRE Handbook (formerly the SPIRE Observers Manual), where as, in the following sections, photometry methodology specifically within the HIPE enviroment is explained. In Figure 6.82 and the associated table, the algorithmic steps required within HIPE to perform point source photometry are summarized for the main photometry tasks available.

Summary of Point Source Photometry methods in HIPE. The necessary inputs are summarised in the table below.

Figure 6.82. Summary of Point Source Photometry methods in HIPE. The necessary inputs are summarised in the table below.


Input Reference
K4EdivK4P conversion factor Table 6.9
Pipeline Beam Areas (α = -1) Table 6.10
Effective Beam ratios (beam correction) Table 6.11
FWHM Table 6.12
rpeak parameters Table 6.13
Apertures Table 6.14
Aperture Corrections Table 6.15
Colour Corrections Table 6.16

6.9.1.4. Source Extraction with SUSSEXtractor or DAOphot

HIPE provides two tasks to carry out source extraction on the SPIRE Level 2, Level 2.5, Level 3 maps. sourceExtractorDaophot and sourceExtractorSussextractor tasks are both included within HIPE, with sourceExtractorSussextractor optimized for use with SPIRE maps.

These algorithms are explained in detail in the Herschel Data Analysis Guide Section 4.18

This section explains how to use the source extractors via the graphical interface; advanced usage is described in the User Reference Manual:

The two tasks are listed in the Applicable folder of the Tasks view whenever an image is selected in the Variables view. Figure 6.83 shows the lists of parameters for the two tasks (hover the mouse pointer on a parameter to reveal the tooltip):

List of parameters for the two source extraction tasks.

Figure 6.83. List of parameters for the two source extraction tasks.


Example

Both SUSSEXtractor and DAOphot work on the Level 2 maps. For the purposes of source extraction the point source calibrated maps (psrcPxW) can be used for both algorithms. For photometry, SUSSEXtractor should use the point source calibrated maps (psrcPxW). However, since DAOphot actually carries out aperture photometry, for optimal results, for DAOphot the maps calibrated for extended emission (extdPxW) should be used for photometry.

The required inputs to be specified are the input map, the FWHM, as given in Table 6.12 for map pixel sizes of 1 arcsec for the PSW, PMW, PLW arrays respectively and the detection threshold. DAOphot also requires the pipeline beam area in Table 6.10 to convert the map to surface brightness units since it is carrying out aperture photometry.

The examples below are adapted from the official SPIRE Photometry script available from the Useful Scipts menu within HIPE and shows how to extract the necessary calibration parameters from the SPIRE calibration Tree and how to perform source extraction and photometry with SUSSEXTractor and DAOphot for a single SPIRE band.

SPIRE photometry is based on the assumption of a spectrum of the form nu.F(nu) = constant. In the case of a source having a different spectral shape multiplicative corrections must be applied to any point source photometry. All the necessary corrections for photometry are contained within the SPIRE Calibration Products and can be interrogated as a function of spectral index (α).

Changing the SUSSEXtractor PRF

Note that for HIPE12, SUSSEXtractor flux densities could as much as 5 percent lower due to a change in the default PRF from 5x5 to 13x13 pixels. The original default value of 5x5 pixels for the PRF has been restored for HIPE version 13 onwards. Note a change in PRF will affect the flux density measured by SUSSEXtractor. A 5x5 PRF (the default) provides consistent flux density measurements with the SPIRE Timeline Fitter. However, the PRF can be changed using the example below;

        
############################### Setup #####################################
# Loading an observation (Gamma Draconis) from the HSA 
obsid = 1342198160

# For a source with spectrum S(nu) proportional to S^alpha
# SPIRE default pipeline assumes alpha = -1
alpha = 2.0

# Run for an individual SPIRE band
array = "PSW"  # SPIRE Array Bands: "PSW", "PMW", "PLW"
 
 
############################ Import Data ##################################
# Loading an observation of Gamma Dra from the HSA 
obs     = getObservation(obsid, useHsa=True, instrument='SPIRE')
# For observation from your own local pool use the following line instead
# obs     = getObservation(obsid, poolName='mypool', instrument='SPIRE')


# Extract the Point Source (Jy/beam) and Extended (MJy/sr) calibrated maps
# from the Observation Context
mapPsrc = obs.level2.refs["psrc"+array].product
mapExtd = obs.level2.refs["extd"+array].product     
 
######################## Correction Parameters ############################
# Values are obtained from the SPIRE calibration tree assuming
# a point source with the spectral index alpha specified above
# N.B.: spire_cal_12_2 or later version is needed
# Beam Area for pipeline (alpha=-1)
# Beam Corrections: Beam(alpha=-1)/Beam(alpha)
# Aperture Corrections derived from carrying out aperture photometry on beam map
# See the HIPE Useful Script -Photometer Calibration Bundle Point/ext source-
# for more details on the aperture corrections.
# Colour Corrections for point sources (pipeline assumes alpha=-1)
cal = spireCal()

beamCorrTable  = cal.phot.refs["ColorCorrBeam"].product
aperCorrTable  = cal.phot.colorCorrApertureList.refs[0].product
kCorrPsrcTable = cal.phot.colorCorrKList.refs[0].product

beamArea  = beamCorrTable.meta["beamPipeline"+array.title()+"Arc"].double
beamCorr  = beamCorrTable.getAlphaCorrection(alpha, array)
kCorrPsrc = kCorrPsrcTable.getAlphaCorrection(alpha, array)
aperCorr  = aperCorrTable.getApertColorCorrection(alpha, array)

# K4p is the conversation factor (colour correction) applied in the standard
# pipeline to give flux for nu S_nu= constant point source
#(converts from alpha=0 to alpha=-1)
# Since this factor is automatically applied in the standard photmetric calibration,
# we need it for removal and replacement by that for extended sources.
k4P = cal.phot.fluxConvList.refs[2].product[array].meta['k4P_'+array].double

# K4e is similar to K4p but includes the frequency-dependent beam,
# making it applicable to fully extended sources with nu F nu=constant spectrum
k4E = cal.phot.fluxConvList.refs[2].product[array].meta['k4E_'+array].double

# Therefore the conversion between exteneded and point source calibration is
K4EdivK4P = k4E / k4P

# FWHM of point source beam profile taken from Calibration Tree
fwhm = cal.phot.getBeamProf(array).meta['FWHM_gMean%s'%array.title()].value

# radius (aperture radius needed by timeline fitter and aperture photometry)
# Default map pixel size
radiusValues        = {"PSW":22,   "PMW":30,   "PLW":42}
pixelSizeValues     = {"PSW":6.0,   "PMW":10.0,   "PLW":14.0}

# Radii of inner and outer annulus for background estimation
innerArcsec=60.0
outerArcsec=90.0

################################################################################
# Select parameters for the given array
radius    = radiusValues[array]
annulus   = AnnulusValues[array]
pixelSize = pixelSizeValues[array]


format = '%30s = %5.1f mJy'            #Format string for printout
################################################################################    
 

SUSSEXtractor can either perform source extraction on the entire map but also supports a Region of Interest(ROI), as shown below, to constrain the search area to a smaller map region.

      
################################################################################
########################## Running Sussextractor ###############################
# Define region of interest (ROI) around requested position from FITS header
# Find source position within 3 * FWHM of requested position
# Alternatively remove ROI and provide source position as inputSourceList=[ra,dec]
wcs = mapPsrc.wcs
roi = SkyMaskCircle(obs.meta["raNominal"].value, obs.meta["decNominal"].value, fwhm*3./60.)
srcSussex = sourceExtractorSussextractor(image=mapPsrc, \
  fwhm=fwhm, useSignalToNoise=True, roi=roi)

# The default PRF for SUSSEXtractor from HIPE is 5x5 pixels
# To change the PRF to a different size please use the following
# e.g. for  13x13 pixels (NOTE: the flux will change!).
#prfNew = PrfGaussian([13,13],fwhm/pixelSize)
#srcSussex = sourceExtractorSussextractor(image=mapPsrc, detThreshold=5.0, \
#           fwhm=fwhm, useSignalToNoise=True, prf=prfNew, roi=roi)
 
if len(srcSussex["sources"]["ra"].data) > 1:
   print "Warning: More than one source found around requested position!"

# Get position of first source in list.
ra  = srcSussex["sources"]["ra"].data[0]
dec = srcSussex["sources"]["dec"].data[0]

# Apply colour correction for given alpha
fluxSussex = srcSussex["sources"]["flux"].data[0] * kCorrPsrc
print
print format%('Flux from SUSSEXtractor', fluxSussex)
################################################################################   
 

Both DAOphot and SUSSEXtractor can detect and extract sources independently but they can also take a source list or RA and Dec as input. In the example below, DAOphot takes as input the RA and Dec of the first source found by SUSSExtractor from the previous example above.

As emphasized earlier, DAOphot photometry should be made using the maps calibrated for extended emission (extdPxW). . In order to use these maps for point source photometry the maps must be converted to a point source calibration and the units should be in Jy/pix. These two steps are shown in the example code below.

Fluxes obtained via SUSSEXtractor do not require any aperture correction. However, the fluxes obtained from DAOphot do require an multiplicative aperture correction. By default, DAOphot estimates the aperture correction automatically itself by setting the parameter doApertureCorrection = True. The automatic aperture correction is calculated from photometry on the point response function (PRF) to determine the correction. Alternatively, the user can estimate their own aperture correction using different aperture sizes within DAOphot to estimate a curve of growth or use the numbers given in Table 6.15. The aperture corrections in Table 6.15 are given for the typical case where there is a background around the source but also for the scenario where the background has been subtracted. Note that if DAOphot is run with the parameter doApertureCorrection = False then the resulting flux must also be multiplied by the effective beam ratio (beam correction), for the appropriate spectral index, α, given in Table 6.11, in order totake into account the RSRF, the aperture efficiency and the variation of beam profile with frequency.

Note that there are also aperture corrections for arbitrary apertures (from 0 to 700 arcsec) in the SPIRE Calibration Tree in the RadialCorrBeam product under normArea Table. The corrections in this table (by means of the Encircled Energy fraction = normalized beam area) are only for an α=-1 source, however, the colour corrections for the normalized beam are very small and in most cases can be ignored without too much concern.

 
################################################################################
######################     RunningDAOphot          #############################
# For optimal results begin with MJy/sr calibrated maps 
# ExtdPxW maps include the relative gain correction which flatfield the 
# detectors of the arrays for their integral beam profiles rather than their peaks

# Remove colour correction for extended sources and apply that for point sources
mapExtd = imageDivide(image1= mapExtd, scalar=K4EdivK4P)

# Convert map units to [Jy/pixel] for Aperture Photometry algorithm.
mapExtd = convertImageUnit(mapExtd, newUnit="Jy/pixel", beamArea=beamArea)

################################################################################
################## Running DAOphot (automatic aperture correction) #############
# By default DAOphot applies an internally derived auomatic aperture correction 
# set with doApertureCorrection=True  
srcDaoAuto = sourceExtractorDaophot(image=mapExtd, detThreshold=5.0, \
 doApertureCorrection=True, fwhm=fwhm, \
 beamArea=beamArea, inputSourceList=[ra,dec], \
 innerArcsec=innerArcsec, outerArcsec=outerArcsec)

# Colour correcting results for a source with defined alpha (default being -1)
# The automatic aperture correcion also corrects for the beam variation therefore
# no correction for beam variation as function(alpha) is required
fluxDaoAuto = srcDaoAuto["sources"]["flux"].data[0] * kCorrPsrc
print format%('Flux from DAOphot (auto)', fluxDaoAuto)


################################################################################
################## Running DAOphot (aperture correction from table) ############
# no automatic aperture correction set with doApertureCorrection=False  
srcDaoTable = sourceExtractorDaophot(image=mapExtd, detThreshold=5.0, \
doApertureCorrection=False, fwhm=fwhm, 
beamArea=beamArea, inputSourceList=[ra,dec],\
radiusArcsec=radius, \
innerArcsec=innerArcsec, outerArcsec=outerArcsec)

# Apply beam correction, colour correction, aperture correction for given alpha
fluxDaoTable = srcDaoTable["sources"]["flux"].data[0] * beamCorr * kCorrPsrc * aperCorr 
print format%('Flux from DAOphot (table)', fluxDaoTable)


################################################################################     

For both SUSSEXtractor and DAOphot, the default, the point response function (PRF) is assumed to be Gaussian, with full-width-half-maximum (in arcsec) provided by the fwhm parameter. Alternatively, you can specify a custom PRF via the prf parameter. This should be a variable of type SimpleImage. The image should be of odd dimension, with the peak at the centre, normalised such that it gives the (central pixels) of a point source of flux 1 Jy, in the units of the input map. The PRF image is assumed to have the same pixel scale of the main image, and does not need to have an associated WCS.

A PRF can be extracted from the beam profile in the calibration tree. Assuming that cal is your SPIRE calibration context and myImage is your image (in Jy/beam units) for the PSW band, issue the following command:

                myPRF = cal.phot.beamProfList.getProduct('PSW') 
            

Be sure to verify that the PRF image has the peak value at the image centre. Similar commands may be used to construct PRF images for the PMW and PLW bands.

The output from the source extraction is a SourceListProduct and is called sourceList by default. You can inspect it in the Product Viewer like any other product, as shown in Figure 6.84. To access the measured fluxes and positions directly, the SourceListProduct must be addressed in the following way flux = srcSussex['sources']['flux'].data[0] (see also the example code snippet)

The list of sources shown in the Product Viewer, with the internal dataset highlighted.

Figure 6.84. The list of sources shown in the Product Viewer, with the internal dataset highlighted.


To display the extracted sources on the image, drag and drop the sourceList variable on the image in the Editor view. A circle with fixed width is overlaid at the location of each source, as shown by the following figure. Note that dragging and dropping will not work if you select the returnPixelCoordinates checkbox in the task graphical interface. When this option is selected, the task returns source coordinates in pixels rather than astronomical coordinates.

The manipulation of the sourceList is covered in detail in the Herschel Data Analysis Guide Chapter 4 which describes how to import a sourceList from a text or FITS file, overlay a sourceList on a image and change the size and colours of the circles.

Note that both DAOphot and SUSSEXtractor can take a source list (e.g. from some ancillary data catalogue) as input. When a source extractor is given a sourceList as input , it measures fluxes and flux error for all of the positions in that list. The flux returned in the estimate of the flux of a source at that position, regardless of whether there really is a source at that position, or whether a formal detection is possible. In this way, the source extractors will effectively also return an upper limit for an undetected source. See the Herschel Data Analysis Guide Section 4.18 for more details.

Common problems
  • No error extension (sourceExtractorSussextractor only)

    sourceExtractorSussextractor requires the input image to have an error extension, and if this is not present the task will fail. The error (uncertainty) in the pixel values should be determined as part of the map-making algorithm. However, an easy way to add an error extension to a SimpleImage, image, assuming the uncertainty in each pixel is 0.001, is to use:

    image.setError(image.getImage() * 0 + 0.001)
  • Invalid units, or units not specified

    Both source extraction tasks require the input image to specify its units in a valid format. If the task cannot recognise the units of the image as units of surface brightness then it will fail. To set the units of the SimpleImage, image, to be "Jy/beam" (for example), use image.setUnit("Jy/beam"). Other units based on Jy, mJy, MJy, beam, pixel, sr, etc. are recognised.

  • Reducing the number of NaNs in the DAOphot background radii

    The default values for the DAOphot background annulus of 60-90 arsec can produce a substantial number of NaN results in some cases. Although the current values for the background annulus produce the most consistent photometry, in severe cases, the number of NaNs can be reduced by changing the default backgroud annulus radii as follows;

    • PSW: inner radius = 22.0 arcsec, outer radius = 33.0 arcsec
    • PSW: inner radius = 30.0 arcsec, outer radius = 45.0 arcsec
    • PSW: inner radius = 42.0 arcsec, outer radius = 63.0 arcsec

6.9.1.5. Source Fitting of Point Sources in Timeline Data

The sourceExtractorDaophot and sourceExtractorSussextractor source extraction algorithms work on the final image maps, however SPIRE also provides an alternative method for photometry working on the timeline data itself before the map making process. The Timeline Source Fitter performs photometry at a give position (or set of positions) by fitting a Gaussian to the timeline samples on the sky. The Timeline Fitter is currently the recommended algorithm for SPIRE point source photometry The Timeline Source Fitter does not work on maps and does not perform source extraction. The Timeline Source Fitter requires Level 1 destriped timelines as input and the locations of sources at which to fit. The Timeline Source Fitter can be accessed via a GUI in the Tasks window within HIPE under sourceExtractorTimeline as shown in Figure 6.85

GUI for the Timeline Fitter

Figure 6.85. GUI for the Timeline Fitter


From the GUI box in Figure 6.85, it can be seen that there are various parameters for the Timeline Fitter. The input (destripedLevel1) is a destriped (or baseline subtracted) level 1 context or Scan Context (i.e. the output from the destriper or baseline removal algorithms). The other input required is a set of RA, Dec coordinates in decimal degrees for a single source ([RA,DEC]) or a list of coordinates ([[RA1,RA2,...][DEC1,DEC2,....]]). Alternatively a source list can be appended (see below). Additional parameters are explained below in Table 6.13

The Timeline Source Fitter can also be run from the command line as;

              sourceList = sourceExtractorTimeline(input=destripedLevel1,  \
              array='PSW', inputSourceList=[RA,DEC], rPeak=22,\
              allowVaryBackground=True, useBackInFit=True,\
              fitMaxIterations=10000)
          

Table 6.13. Parameters for the Timeline Fitter

Parameter Options
array String parameter for SPIRE array "PSW", "PMW", "PLW".
inputSourceList Either a Double1d array with 2 entries containing the estimated RA and Dec of source in degrees. Or a Source List Product from,for example, the output of SUSSEXtractor
rpeak Optional parameter for radius of the region that will include the peak of the source. Appropriate values are 22, 30, 42 for the PSW, PMW, PLW respectively and exclude the airy rings.
rbackground Optional parameter (double1D with 2 entries) for the inner and outer radius of the annulus for use as background subtraction. Setting either to a negative value will result in no background being subtracted. Default value is array dependent and is PSW [70.,74.], PMW [98.,103.], PLW [140.,147.]
useBackInFit Optional Boolean parameter. If True then all data samples from background annulus will be used in the fit. Otherwise the median value will be removed from the data to fit. Default value is True. Note: using useBackInFit = True will improve the fit.
allowVaryBackground Optional Boolean parameter. If True then background is treated as a free parameter in the fit. This parameter is ignored if the background is ignored in the fit. Default value is True. Note: using allowVaryBackground = True will improve the fit.
allowTiltBack Optional Boolean parameter. If True then a tilted plane is used for the background. Default value is False. This is ignored if allowVaryBackground is set to False
fitEllipticalGauss2d Optional Boolean parameter. If True then an elliptical Gaussian is fit to the data. Otherwise a circular Gaussian is used. Default value is False. Note that for relatively bright sources elliptical Gaussians are fine, however for sources fainter than approximately 30mJy, circular Gaussians should be used in preference.
modelGauss2dSigma Optional Double set in degrees will perform a circular Gaussian it with the sigma parameter of the Gaussian fixed (ignored if fitEllipticalGauss2d parameter set). Default value is -1.0
fitMaxIterations Optional integer parameter to set a limit on the number of iterations performed by the Levenberg Marquardt Fitter. Default value is 10000
fitTolerance Optional (Double) parameter that sets the tolerance the Levenberg Marquardt Fitter attempts to achive when performing the fit. Default value is 1e-4.
roi Region of Interest. A skymask where only the sources lying inside the ROI will be included.
slow By default, if processing more than one source, the task will attempt to store all of the data in memory at once. If it runs out of memory, it will use a slower method, which involves iterating over all of the data for each source. Set this parameter to True to use this slower method without first attempting to store all of the data in memory.


The output from the Timeline Fitter is a standard Source List Product (default name is sourceList) containing results from the fitting, including;

  • Positional information ra, dec and associated errors raPlusErr, decPlusErr, raMinusErr, decMinusErr.

  • Fitted point source flux density flux and associated errors fluxPlusErr, fluxMinusErr in mJy.

  • The background measurement and error backgroundParm1, backgroundParm1Err.

  • The Chi-squared result, evidence and reduced chi-squared chiSquare, evidence, reducedChiSquare. Note that although the Task returns the Chi-squared, reduced Chi-squared, and a Bayesian evidence value, tests with simulated sources added to real timeline data showed that these numbers did not necessarily reflect the accuracy of the resulting fit. For example, the evidence values for a Gauss2DModel with a fixed width fit to the simulated source was systematically higher (e.g. better) than fit, although the standard Gauss2DModel fit (with the variable width) and the Gauss2DRotModel fit produced more accurate measurements. Users should therefore keep in mind that so many data points are used in the fit that the reduced chi squared values will vary very little between models with different numbers of parameters. Use these metrics with extreme caution.

  • The number of iterations in the fit nIter and whether the fit was successful fitSuccessful.

  • The number of data points used to fit the background nRdoutBack and source nRdoutPeak respectively.

  • The width of the fitted Gaussian and errors sigma, sigmaErr in degrees where the FWHM = 2SQRT(2ln2)*sigma

The Source List Product can be written to an output ASCII file by the following command

              #Save Source List as ascii file
              AsciiFileResults = AsciiTableTool()
              AsciiFileResults.save("SourceListTLF_PSW.dat",sourceList["sources"])
              
Example

It is also possible to provide a source list from another source extraction algorithm, for example using SUSSEXTractor to extract the sources and passing the output source list as input for the timeline fitter as shown below (note that in this example the sources are not colour corrected);

# Example of using a source list as input to the Timeline Fitter
# Get an observation from Herschel Science Archive
obs = getObservation(1342195871, useHsa=True, instrument='SPIRE')
          
# Get the level 2 maps
# Note: delete psrc prefix for pre-HIPE10
mapPsw=obs.level2.getProduct("psrcPSW")
          
# Extract sources with SUSSEXtractor
sourcesSxtPSW = sourceExtractorSussextractor(image=mapPsw, fwhm=17.9, \
           detThreshold=5)
                    
# Timline Source Fitter
sourceList = sourceExtractorTimeline(input=obs.level1, array='PSW', \
          inputSourceList=sourcesSxtPSW, rPeak=22, \
          allowVaryBackground=True, useBackInFit=True,\
          fitMaxIterations=10000)
          
# Write to ASCII file
AsciiFileResults = AsciiTableTool()
AsciiFileResults.save("/Users/cpearson/"+"SourceListTLF_PSW.dat",sourceList["sources"])
        

Recommended Settings for the Timeline Fitter

To fit point sources in fields with flat backgrounds (such as extragalactic fields where the background is dominated by confused extragalactic sources), he following settings are recommended:

  • The parameter rPeak should be set to 22, 30, and 42 for PSW, PMW, and PLW, respectively. This aperture was selected because it includes the Gaussian part of the PSF (the region from the centre up to the gap between the peak and the first Airy ring).

  • The parameter rbackground has different defaults for each array. The values will potentially work for most sources, as the signal in this smaller annuli will be dominated by background noise except for very bright sources.

  • The parameter AllowTiltBack should be set to False.

  • The parameter fitEllipticalGauss2d should normally be set to False. This is only useful if attempting to distinguish between elongated and truly unresolved sources.

  • The parameter modelGauss2dSigma depends on the source brightness and the scan speed. For slow or nominal scan speeds, for sources brighter than 35mJy in the PSW band, 50 mJy in the PMW and PLW bands, modelGauss2dSigma should not be set. Allowing the FWHM of the Gaussian to vary usually produces a more accurate fit. However, users should check that the FWHM from the fit falls within nominal ranges for the data (15-21 arcsec for PSW, 19-28 arcsec for PMW, and 28-40 arcsec for PLW). For sources fainter than 35 mJy in the PSW band or 50 mJy in the PMW or PLW bands or for sources observed using the fast scan speed, modelGauss2dSigma should be set to 17.6 for PSW, 23.9 for PMW, and 35.2 for PLW. Fixing the width of the PSF normally produces more accurate results in these cases.

  • The parameter useBackInFit should be set to True.

  • The parameter allowVaryBack should be set to True.

The following optional set-ups can also be used to handle the background:

  • The parameter allowVaryBack can be set to False while still specifying rBackground and setting useBackInFit to True. In this scenario, the background will not be treated as a free parameter in the fit, an initial background offset will be measured and subtracted before the data is fitted.

  • The parameter allowVaryBack can be set to False and useBackInFit can be set to False if rBackground is specified. The data in the background annulus will still be used to measure and subtract an initial background before a Gaussian function is fit to the PSF, but the data in the background annulus will not be used in the fit, and the background will not be treated as a free parameter.

  • The parameter rBackground does not need to be given as an input, but allowVaryBack should be set to False and useBackInFit should be set to False. This is appropriate if the background has already been subtracted (for example, by using removeBaselines).

To fit sources in regions with significant background variations (such as sources observed in fields with thick cirrus emission), the following settings are recommended:

  • The parameter rBackground should not be specified. No background annulus should be used in the PSF fitting.

  • The parameter allowTiltBack should be set to True.

  • The parameter fitEllipticalGauss2d should be set to False.

  • The parameter useBackInFit should normally be set to False.

  • The parameter allowVaryBack should normally be set to False.

6.9.1.6. Performing Aperture Photometry on SPIRE Images

Aperture photometry of both point source and extended sources can be made using 3 tasks in HIPE, the annularSkyAperturePhotometry, rectangularSkyAperturePhotometry, fixedSkyAperturePhotometry tasks. These algorithms are explained in detail in the Herschel Data Analysis Guide Section 4.20 In the following 2 sections specific information is provided for aperture photometry on point sources and extended emission respectively.

Recipe for Point Source Aperture Photometry

Although, in principle, aperture photometry is not recommended for point sources in SPIRE maps, the framework to do so does exist. To measure integrated flux densities of point sources via aperture photometry, the following steps are performed (the explicit algorithmic steps within HIPE are also shown in Figure 6.82 and the HIPE script is shown below);

  1. The starting point is the Level 2 extdPxW extended emission calibrated maps in MJy per steradian.

  2. Convert to point source calibration

    SPIRE maps for extended emission have been calibrated for a monochromatic extended source surface brightnes using the K4EdivK4P parameter described in Section 6.9.1.2 and Table 6.9. Therefore, the maps must first be divided by the K4EdivK4P parameter.

  3. Divide the image by the beam area to convert the image to Jy/pixel, for an image with small (<1”) pixels using the pipeline beams for 1” pixels given in Table 6.10. Note that HIPE provides a specfic task convertImageUnit, available from the tasks window, to both divide the image by the beam and convert the units.

  4. Measure the integrated flux density within the desired aperture and background annulus, using the appropriate aperture photometry task as explained in Herschel Data Analysis Guide Chapter 4 . For point sources the recommended aperture radii are selected to contain just the main lobe of the beam, and are given below in Table 6.14 along with the values for the annulus to estimate the background level.

  5. The SPIRE flux calibration assumes a flat spectrum for the source (nu.F(nu)=constant). For other spectral indicies, the flux density needs to be multiplied by the appropriate beam ratios Ω(α=-1)/Ω(α) for given in Table 6.11, in order to take into account the RSRF, the aperture efficiency and the variation of beam profile with frequency.

  6. The SPIRE flux calibration assumes a flat spectrum for the source (nu.F(nu)=constant). For other spectral indicies, the flux density needs to be multiplied by the appropriate point source color correction for the assumed spectral index using the Colour Corrections for Point Sources given in Table 6.16

  7. Aperture correction factors are required, since this method measures the sky brightness in a fraction of the beam, and therefore underestimates the integrated flux density. The corrections have been tested and bring the integrated flux densities obtained through aperture photometry into agreement with those obtained from fitting timeline data, which is in general a more accurate method. The aperture corrections are also listed in Table 6.15 Note that there are also aperture corrections for arbitrary apertures (from 0 to 700 arcsec) in the SPIRE Calibration Tree in the RadialCorrBeam product under normArea Table. The corrections in this table (by means of the Encircled Energy fraction = normalized beam area) are only for an α=-1 source, however, the colour corrections for the normalized beam are very small and in most cases can be ignored without too much concern.

Example

The above procedure is shown in the script below and is adapted from the official SPIRE Photometry script available from the Useful Scipts menu within HIPE. Note as with the earlier examples for SUSSEXtractor and DAOphot, all the necessary calibration is contained within the SPIRE Calibration Tree which can be interogated as a function of spectral index, alpha. In the example for Aperture Photometry below, the source position for photometry is supplied via SUSSEXtractor, although, in practice could just as easily be supplied as a string variable for RA and Dec respectively.

                    
############################### Setup #####################################
# Loading an observation (Gamma Draconis) from the HSA 
obsid = 1342198160

# For a source with spectrum S(nu) proportional to S^alpha
# SPIRE default pipeline assumes alpha = -1
alpha = 2.0

# Run for an individual SPIRE band
array = "PSW"  # SPIRE Array Bands: "PSW", "PMW", "PLW"


############################ Import Data ##################################
# Loading an observation of Gamma Dra from the HSA 
obs     = getObservation(obsid, useHsa=True, instrument='SPIRE')
# For observation from your own local pool use the following line instead
# obs     = getObservation(obsid, poolName='mypool', instrument='SPIRE')


# Extract the Point Source (Jy/beam) and Extended (MJy/sr) calibrated maps
# from the Observation Context
mapPsrc = obs.level2.refs["psrc"+array].product
mapExtd = obs.level2.refs["extd"+array].product     

######################## Correction Parameters ############################
# Values are obtained from the SPIRE calibration tree assuming
# a point source with the spectral index alpha specified above
# N.B.: spire_cal_12_02 or later version is needed
# Beam Area for pipeline (alpha=-1)
# Beam Corrections: Beam(alpha=-1)/Beam(alpha)
# Aperture Corrections
# Colour Corrections for point sources (pipeline assumes alpha=-1)
cal = spireCal()

beamCorrTable  = cal.phot.refs["ColorCorrBeam"].product
aperCorrTable  = cal.phot.colorCorrApertureList.refs[0].product
kCorrPsrcTable = cal.phot.colorCorrKList.refs[0].product

beamArea  = beamCorrTable.meta["beamPipeline"+array.title()+"Arc"].double
beamCorr  = beamCorrTable.getAlphaCorrection(alpha, array)
kCorrPsrc = kCorrPsrcTable.getAlphaCorrection(alpha, array)
aperCorr  = aperCorrTable.getApertColorCorrection(alpha, array)

# K4p is the conversation factor (colour correction) applied in the standard 
# pipeline to give flux for nu S_nu= constant point source 
# (converts from alpha=0 to alpha=-1)
# Since this factor is automatically applied in the standard pipeline,
# we need it for removal and replacement by that for extended sources.
k4P = cal.phot.fluxConvList.refs[2].product[array].meta['k4P_'+array].double

# K4e is similar to K4p but includes the frequency-dependent beam, 
# making it applicable to fully extended sources with nu F nu=constant spectrum
k4E = cal.phot.fluxConvList.refs[2].product[array].meta['k4E_'+array].double

# Therefore the conversion between exteneded and point source calibration is 
K4EdivK4P = k4E / k4P

# FWHM of point source beam profile taken from Calibration Tree
fwhm = cal.phot.getBeamProf(array).meta['FWHM_gMean%s'%array.title()].value

# radius (aperture radius needed by timeline fitter and aperture photometry)
# Default map pixel size
radiusValues        = {"PSW":22,   "PMW":30,   "PLW":42}
pixelSizeValues     = {"PSW":6.0,   "PMW":10.0,   "PLW":14.0}

# Radii of inner and outer annulus for background estimation
innerArcsec=60.0
outerArcsec=90.0

################################################################################
# Select parameters for the given array
radius    = radiusValues[array]
pixelSize = pixelSizeValues[array]

format = '%30s = %5.1f mJy'            #Format string for printout
################################################################################                        

################################################################################
########################## Running Sussextractor ###############################
# Define region of interest (ROI) around requested position from FITS header
# Find source position within 3 * FWHM of requested position
# Alternatively remove ROI and provide source position as inputSourceList=[ra,dec]
wcs = mapPsrc.wcs
roi = SkyMaskCircle(wcs.crval1, wcs.crval2, fwhm*3./60.)
srcSussex = sourceExtractorSussextractor(image=mapPsrc, \
detThreshold=5.0, fwhm=fwhm, roi=roi)

# The default PRF for SUSSEXtractor from HIPE is 5x5 pixels
# To change the PRF to a different size please use the following
# e.g. for  13x13 pixels (NOTE: the flux will change!).
#prfNew = PrfGaussian([13,13],fwhm/pixelSize)
#srcSussex = sourceExtractorSussextractor(image=mapPsrc, detThreshold=5.0, \
#                                        fwhm=fwhm, prf=prfNew, roi=roi)



if len(srcSussex["sources"]["ra"].data) > 1:
   print "Warning: More than one source found around requested position!"

# Get position of first source in list.
ra  = srcSussex["sources"]["ra"].data[0]
dec = srcSussex["sources"]["dec"].data[0]

################################################################################
######################## Aperture Photometry ##################################
# For optimal results begin with MJy/sr calibrated maps 
# ExtdPxW maps include the relative gain correction which flatfield the 
# detectors of the arrays for their integral beam profiles rather than their peaks

# Remove colour correction for extended sources and apply that for point sources
mapExtd = imageDivide(image1= mapExtd, scalar=K4EdivK4P)

# Convert map units to [Jy/pixel] for Aperture Photometry algorithm.
mapExtd = convertImageUnit(mapExtd, newUnit="Jy/pixel", beamArea=beamArea)

################################################################################
#################### Running Annular Aperture Photometry #######################
# We use standard radii for aperture and background annulus
resultAper = annularSkyAperturePhotometry(image=mapExtd, \
centerRA="%s"%(ra), centerDec="%s"%(dec),\
fractional=1, centroid=False, radiusArcsec=radius,
innerArcsec=innerArcsec, outerArcsec=outerArcsec)

# Apply beam correction, colour correction, aperture correction for given alpha
fluxAper = resultAper.getTargetTotal() * 1.e3 * beamCorr * aperCorr * kCorrPsrc

print format%('Flux from Aperture Photometry', fluxAper)


print
############################### End of script ##################################
################################################################################

Table 6.14. Parameters for Aperture Photometry

Band Aperture Annulus
(microns) (arcsec) (arcsec)
250 22 60-90
350 30 60-90
500 42 60-90


Table 6.15. Aperture Corrections for Annular Aperture Photometry

Spectral Index Background included Case of background removed
(Fnu=nuα) PSW PMW PLW PSW PMW PLW
-4 1.294 1.255 1.293 1.29 1.246 1.254
-3.5 1.293 1.254 1.29 1.288 1.245 1.252
-3 1.292 1.253 1.287 1.287 1.244 1.249
-2.5 1.291 1.251 1.285 1.286 1.243 1.247
-2 1.29 1.25 1.282 1.285 1.242 1.245
-1.5 1.288 1.249 1.279 1.284 1.241 1.243
-1 1.287 1.248 1.277 1.283 1.24 1.24
-0.5 1.286 1.247 1.274 1.281 1.239 1.238
0 1.285 1.246 1.271 1.28 1.238 1.236
0.5 1.284 1.245 1.268 1.279 1.237 1.234
1 1.282 1.244 1.266 1.278 1.235 1.232
1.5 1.281 1.243 1.263 1.277 1.234 1.229
2 1.28 1.242 1.261 1.276 1.233 1.227
2.5 1.279 1.241 1.258 1.275 1.232 1.225
3 1.278 1.24 1.256 1.273 1.231 1.223
3.5 1.276 1.239 1.253 1.272 1.23 1.221
4 1.275 1.238 1.251 1.271 1.229 1.219
4.5 1.274 1.236 1.249 1.27 1.228 1.218
5 1.273 1.235 1.247 1.269 1.227 1.216


Recipe for Aperture Photometry on Extended Emission Maps

To measure integrated flux densities of extended sources or to work with surface density measurements for extended emission(See the SPIRE Handbook for details of the calibration for extended emission), the following steps should be performed (the explicit algorithmic steps within HIPE are also shown in Figure 6.86 and the HIPE script is shown below);

  1. Start from the Level 2 extdPxW extended emission calibrated maps in MJy per steradian.

  2. Convert image units to Jy/pix

    The HIPE Aperture Photometry task requires images specifically in units of Jy/pixel. Convert the image to units of Jy/pixel by using the convertImageUnit task, available from the HIPE tasks window. Since the extended emission maps were originally in MJy/sr, no beam area is required.

  3. The SPIRE flux calibration assumes a flat spectrum for the source (nu.F(nu)=constant). For other spectral indicies, the flux density needs to be multiplied by the appropriate color correction for Extended Emission for the assumed spectral index using the Colour Corrections for Extended Sources given in Table 6.16. Note that for extended emission, the colour correction also takes into account the various beam effects so the values in Table 6.11 are not required

  4. Measure the flux density within the desired aperture if integrated flux densities are required. The aperture photometry tasks are explained in Herschel Data Analysis Guide Chapter 4 .

Example

The procedure for aperture photometry for extended emission is summarized below for a single SPIRE band. To run the script for a different SPIRE band, simply edit the line array = "PSW" # SPIRE Array Bands: "PSW", "PMW", "PLW".

##############################################################################
# Example for performing Aperture Photometry for Extended Emission within HIPE
##############################################################################

############################### Setup #####################################
# Loading an observation (Gamma Draconis) from the HSA 
obsid = 1342189432

# For a source with spectrum S(nu) proportional to S^alpha
# SPIRE default pipeline assumes alpha = -1
alpha = -3

# Run for an individual SPIRE band
array = "PSW"  # SPIRE Array Bands: "PSW", "PMW", "PLW"

############################ Import Data ##################################
# Loading an observation of Gamma Dra from the HSA 
obs     = getObservation(obsid, useHsa=True, instrument='SPIRE')
# For observation from your own local pool use the following line instead
# obs     = getObservation(obsid, poolName='mypool', instrument='SPIRE')


# Extract  Extended (MJy/sr) calibrated maps
# from the Observation Context
mapExtd = obs.level2.refs["extd"+array].product     

######################## Correction Parameters ############################
# Values are obtained from the SPIRE calibration tree assuming
# a extended source with the spectral index alpha specified above
# N.B.: spire_cal_12_0 or later version is needed
# Beam Area for pipeline (alpha=-1)
# Colour Corrections for extended sources (pipeline assumes alpha=-1)
cal = spireCal()

beamCorrTable  = cal.phot.refs["ColorCorrBeam"].product
kCorrExtdTable = cal.phot.colorCorrKList.refs[0].product

beamArea  = beamCorrTable.meta["beamPipeline"+array.title()+"Arc"].double

kCorrExtd = kCorrExtdTable.getAlphaCorrection(alpha, array)


################################################################################
############################################################################### 

# Target RA and Dec and string values
ra  = '6.659144'
dec = '64.20587616'

# Use the convertImageTask to convert maps from MJy/sr to Jy/pix
# HIPE Aperture photometry requires maps with units of Jy/pix
mapExtended = convertImageUnit(image=mapExtd, newUnit='Jy/pixel')

# Colour Correct the map for a alpha=-3 spectral index                  
mapExtendedCorrected = imageMultiply(image1=mapExtended, scalar=kCorrExtd)

# Carry out the Aperture Photometry
annularPSW = annularSkyAperturePhotometry(image= mapExtendedCorrected, \
   centerRA=ra, centerDec=dec, fractional=1, \
   radiusArcsec=350.0, innerArcsec=400.0, outerArcsec=450.0)

# Final target brightness in Jy/pixel 
flux = annularPSW.getTargetTotal() 
print 'PSW flux = %5.3f Jy'%(flux)

###############################################################################               
 

Summary of Photometry methods for Extended Emission in HIPE. The necessary inputs are summarised in the table below.

Figure 6.86. Summary of Photometry methods for Extended Emission in HIPE. The necessary inputs are summarised in the table below.


Input Reference
K4EdivK4P conversion factor Table 6.9
Pipeline Beam Areas (α = -1) Table 6.10
Colour Corrections Table 6.16
Apertures Table 6.14

6.9.1.7. Image Map Gaussian Source Fitting in HIPE

HIPE also provides a general task for the fitting of Gaussians to a source position in an image map. Note that this is a general task within HIPE and not a specific SPIRE photometry task, therefore this task is not generally recommended for use on SPIRE data.

The sourceFitting task will fit a 2-D Gaussian to a source in a specified rectangular region in an image map. The code example below shows the typical call to the sourceFitting task. The inputs to the task are the min x-pixel and y-pixel position of the rectangle, the width and height of the rectangle in pixels, whether the source is assumed to be elongated and whether the background has a gradient. Note that since the Gaussian fitting task is measuring data that has been mapped onto pixels the appropriate pixelization factors need to be applied to account for the Gaussian fit underestimating the peak flux (other SPIRE photometry tasks in HIPE do not require this correction).

obsid=1342226998
obs=getObservation(obsid,useHsa=True)
mapPSW = obs.level2.refs["psrcPSW"].product
    
# Get a source position with SUSSEXtractor
fwhmPSW = 17.9
sourceListPSW = sourceExtractorSussextractor(image=mapPSW, detThreshold=5.0, \
        fwhm=fwhmPSW, fitBackground=True)

# input to Source Fittin is an assumed source position
SXTflux = sourceListPSW["sources"]["flux"].data[0]
x = sourceListPSW["sources"]["x"].data[0]
y = sourceListPSW["sources"]["y"].data[0]
    
boxSize = 5  # width of fitting box in pixels
    
# Source Fitting Task
ps = sourceFitting(elongated=False, image=mapPSW, \
    minX=x-boxSize, minY=y-boxSize, \
    width=2*boxSize+1, height=2*boxSize+1)
    
# Pixelization Correction
pixelCorrPSW = 0.941
pixelCorrPMW = 0.917
pixelCorrPLW = 0.903

# *1000 to convert to mJy
# divide by pixelization correction
fittedFlux = ps["Column1"].data[0]*1000/pixelCorrPSW

# Compare with SUSSEXtractor flux
print "SUSSEXtractorflux = %f"%(SXTflux)
print "Fitted flux = %f"%(fittedFlux)

The output of the sourceFitting task is a parameters box containing the fitted flux in Jy/beam, centre x,y and RA, Dec positions. Gaussian width in both pixels and arcsec and the measured background in Jy/beam (see Figure 6.87).

Results from HIPE source fitting task

Figure 6.87. Results from HIPE source fitting task


6.9.1.8. Colour corrections

SPIRE photometry is based on the assumption of a spectrum of the form nu.F(nu) = constant. In the case of a source having a different spectral shape multiplicative corrections must be applied to any point source photometry. To obtain the colour correction for a given spectral shape the following values in Table 6.16 must be used to multiply the data to get the correct photometry.

Similarly, for extended emission the colour correction values in Table 6.16 must be used to multiply the data to get the correct photometry.

Further examples of colour corrections for grey bodies with varying values of Beta and temperatures can be found in the SPIRE Handbook and can be accessed within the SPIRE Calibration Tree. Colour corrections can be accessed from the SPIRE CAlibration Tree using the following commands;

    
cal = spireCal()
# Load Point Source Colour Correction Table
kCorrPsrcTable = cal.phot.colorCorrKList.getProduct("point")

array = "PSW"
alpha = 2
beta =1.5
tempK =100
# Query Colour Corrections for a given spectral index alpha
kCorrPsrcAlpha = kCorrPsrcTable.getAlphaCorrection(alpha, array)
    
# Query Colour Corrections for a given grey body Beta and Temperature
kCorrPsrcBeta = kCorrProduct.getTempBetaCorrection(tempK, beta, array)
    

Table 6.16. Color Corrections for Point Sources and Extended Emission

Spectral Index Point Source Colour Correction Extended Emission Colour Correction
(Fnu=nuα) PSW PMW PLW PSW PMW PLW
-4 0.98 0.9791 0.9333 0.9401 0.9403 0.8689
-3.5 0.9884 0.9875 0.9525 0.9546 0.9545 0.8971
-3 0.9948 0.994 0.9687 0.9674 0.9672 0.9231
-2.5 0.9992 0.9986 0.9817 0.9784 0.9782 0.9467
-2 1.0016 1.0011 0.9913 0.9875 0.9873 0.9675
-1.5 1.0019 1.0016 0.9974 0.9948 0.9946 0.9854
-1 1 1 1 1 1 1
-0.5 0.996 0.9963 0.999 1.0032 1.0034 1.0113
0 0.9899 0.9906 0.9945 1.0043 1.0047 1.019
0.5 0.9818 0.9829 0.9864 1.0033 1.0039 1.0231
1 0.9716 0.9732 0.9751 1.0002 1.0011 1.0235
1.5 0.9594 0.9615 0.9606 0.9949 0.9962 1.0203
2 0.9454 0.9481 0.9432 0.9876 0.9892 1.0135
2.5 0.9296 0.9329 0.923 0.9782 0.9802 1.0033
3 0.9121 0.9161 0.9005 0.9668 0.9693 0.9897
3.5 0.893 0.8978 0.8757 0.9535 0.9566 0.973
4 0.8725 0.878 0.8492 0.9383 0.942 0.9535
4.5 0.8507 0.8571 0.821 0.9214 0.9258 0.9314
5 0.8278 0.835 0.7916 0.903 0.908 0.9069


6.9.1.9. Calibration Beam Information Bundle

From HIPE version 13 onwards, additional scripts are provided to enable advanced Users to produce calibration corrections for beam corrections and colour corrrrections for a wide variety of input spectra. Two scripts are available from the HIPE Useful Scripts menu (see Figure 6.88). The Photometer Calibration Bundle point/ext source script produces results for point and extended sources. The Photometer Calibration Bundle semi-ext source script produces results for semi-extended sources. These scripts also Users to implement the beam model. Users should consult the scripts and the ( SPIRE Handbook) for more information.

Summary of Source Extraction and Photometry.

Figure 6.88. Summary of Source Extraction and Photometry.


6.9.1.10. List Driven Photometry

SPIRE maps are normally very crowded (confused) which can make the measurement of faint flux densities problematical. A standard method of dealing with this confusion is to take source positions derived from ancilliary data at shorter wavelengths and simultaneously find the SPIRE fluxes for these sources via a matrix inversion technique (e.g Roseboom et al., 2010, MNRAS, 409, 48).

The sourceExtractorSimultaneous task within HIPE allows for such simultaneous list driven photometry. The most straightforward way to use the sourceExtractorSimultaneous task is outlined in Figure 6.89, where the source list obtained in the SPIRE 250 micron band is used to derive flux densities in the SPIRE PLW band image.

The sourceExtractorSimultaneous task requires the following inputs (see Figure 6.90); an input image, an input list in the form of a sourceListProduct or alternatively positions as [RA,Dec], and the beam FWHM. Optional inputs are the beamArea, prf, roi and fitBackground parameter which are all the same as used in the SUSSEXtractor task (described in Section 6.9.1.4). The output of the task is a sourceListProduct containing positions and the measured flux densities of the sources at the supplied input positions. A simple code example is shown below;

obsid=1342226998
obs=getObservation(obsid,useHsa=True)
    
mapPSW = obs.level2.refs["psrcPSW"].product
mapPLW = obs.level2.refs["psrcPLW"].product
fwhmPSW = 17.9
fwhmPLW = 35.4
    
srcSussexPSW = sourceExtractorSussextractor(image=mapPSW, detThreshold=5.0, \
    fwhm=fwhmPSW, fitBackground=True)
    
sourceList = sourceExtractorSimultaneous(image=mapPLW, \
    inputSourceList=srcSussexPSW, fwhm=fwhmPLW, fitBackground=True)

Note that the memory required increases approximately as nSources x nSources of the input source list so small chunks of a map are preferable rather than many degrees. The final simultaneously measured flux list should be examined carefully for negative sources (especially around the edge of the map).

Measuring source fluxes with list driven photometry.

Figure 6.89. Measuring source fluxes with list driven photometry.


sourceExtractorSimultaneous GUI

Figure 6.90. sourceExtractorSimultaneous GUI


__________________________________________________________________________