Index

PointingFit fit_pointing(Double hpbw, Double bg_flux, listof TrialPosition trials)

Fit a guassian beam to the fluxes and offsets of a list of trial pointings.

Arguments:
Double hpbw
The half-power full-width of the telescope beam (degrees).
Double bg_flux
The average off-source background flux.
listof TrialPosition trials
The list of trial offset positions, their fluxes and the uncertainties of those fluxes.

Example:
There is no trivial way to use this command, since it is designed for use to define canned pointing commands within schedules. So the following example is somewhat complicated. First the example estimates the background flux, by moving the telescope a degree off source, and asking the receiver to measure the flux there. It then measures fluxes and their standard deviations, at 3 slightly offset positions from the expected position of the source. Finally it fits a gaussian beam profile to these offset fluxes, to estimate the offset of the peak of the source from the expected position of the source.

  # Set up a list of trial offset positions, with initially zeroed fluxes

  listof TrialPosition trials = {
    {-0:1:0, 0, 0},                  # A -1 arcminute position offset
    { 0:0:0, 0, 0},                  # A  0 arcminute position offset
    {+0:1:0, 0, 0}                   # A +1 arcminute position offset
  }

  # Start moving to a suitable point source.

  track saturn

  # Measure a flux a degree off source in azimuth, to estimate the
  # background flux.

  offset x=-1.0                            # Move to the offset position.
  until $acquired(source)                  # Wait to acquire the source.
  request_flux kuband, ant, 0:0:10         # Ask for a 10s integrated flux.
  until $acquired(flux)                    # Wait for the flux to be returned.
  Double bg_flux = $requested_flux().flux  # Record the background flux.

  # Measure the flux at each of the above trial offsets from Saturn.

  foreach(TrialPosition p) $trials {
    offset x=$p.offset               # Move to the latest offset position.
    until $acquired(source)          # Wait to acquire the source.
    request_flux kuband, ant, 0:0:10 # Ask for a 10s integrated flux.
    until $acquired(flux)            # Wait for the flux to be returned.
    p.flux = $requested_flux().flux  # Record the flux in the list.
    p.sdev = $requested_flux().sdev  # Record the uncertainty in the list.
  }

  # Attempt to fit a gaussian beam to the above offset fluxes.

  PointingFit fit = $fit_pointing(0:2:6, $bg_flux, $trials)

  # Display the results.

  print "Fit: good=", $fit.ok, " x=", $fit.offset, " flux=", $fit.flux

Context:
This function is designed to be a building block within pointing procedures. Note that whereas the above example shows how to re-write an existing list of trial pointings, and send this to the fit_pointing, one could also do place the pointing measurements in separate TrialPosition variables, and assemble them into a list on the fly, like:

  PointingFit fit = $fit_pointing(0:2:6, $bg_flux, {$left, $middle, $right})
Note that in this example, left, middle and right are the individual TrialPosition variables.

Martin Shepherd (21-Mar-2010)