This section gives a detailed description of the steps involved in using POLPACK to produce a vector map from single-beam or dual-beam polarimetry or spectropolarimetry data. It is assumed that the data conforms to the model outlined in one of the two previous sections. An over-view of the data reduction process is given in Figure 6.
All POLPACK applications use standard Starlink subroutine libraries for accessing parameters, producing graphics, reporting errors, etc. They therefore look and feel very similar to applications in other Starlink packages such as KAPPA and CCDPACK. The following sections in SUN/95 (the KAPPA manual) should therefore be consulted for general information about these issues:
The first step is to ensure that your data files are in a format which POLPACK can process. The native data format used by POLPACK is the Starlink NDF format (note, NDF structures are usually stored in files with a file type of .sdf). If your data is already in this format, then you can proceed immediately to the next step. Otherwise, you have two options:
Note that the %
represents the C-shell prompt and should not be typed. The first
command initialises the commands required to use the CONVERT package. The
second command converts all FITS files with a file type of .fit within the current
directory, into equivalent NDFs with the same file names, but a file type of
.sdf4.
The .sdf files can then be given as inputs to any application from POLPACK, CCDPACK or
KAPPA.
If you adopt this approach, you may still see references to “NDFs” appearing on the screen. There is usually no significance in the use of the term “NDF” in this context (unless there are indications to the contrary), and you should understand these as referring to your own non-NDF data files.
For spectropolarimetry data, the spectral channel must vary along pixel axis 3, and pixel axes 1 and 2 must be spatial axes. The KAPPA application PERMAXES can be used to rearrange axes into the required order. If your data is one dimensional (i.e. has no spatial coverage) then you can use PERMAXES as follows to add two spatial axes each covering a single pixel:
where data-1d.sdf
is the 1-dimensional input file, and data-3d.sdf
is the 3-dimensional output file.
The section specifier “(,1,1)
” indicates that data-1d
should be treated as if it had 2 extra trailing axes
each spanning a single pixel. PERMAXES then rearranges the axes so that the spectral axis (previously
axis 1) becomes the last axis (axis 3). Of course, since there is no spatial coverage, you will not
be able to display such data using POLPLOT (use POLIMAGE and KAPPA LINPLOT
instead).
POLPACK expects your data to be calibrated so that the pixel values are proportional to the analysed intensity. You should therefore correct your data for any known instrumental effects such as non-linearity, variation of sensitivity across the detector, zero point offsets, etc., before proceeding to use POLPACK. The details will obviously depend on your detector, but if you are using a CCD camera, then the CCDPACK package (see SUN/139) will usually be able to perform these corrections.
If you are using dual-beam data, and target exposures are available at half-wave plate positions of 45.0° and 67.5° (as well as 0° and 22.5° ), then POLPACK can make corrections for the following effects when calculating the Stokes vectors:
These effects therefore do not need to be calibrated out of the raw data.
One aspect of calibration common to most detectors is flat-fielding. If your flat-fields are obtained in polarized light (such as produced by reflection or scattering, for instance), then the mean signals measured in the and ray images of dual-beam data will be different. When such a flat-field is used to calibrate your target exposures, these different mean levels will introduce an apparent difference in sensitivity between the and ray channels. If the same flat-field is used for all target exposures, then this difference in sensitivity will be constant and can be removed while calculating the Stokes parameters (provided you have target exposures at half-wave plate positions of 0, 22.5, 45 and 67.5 degrees). Appendix C contains a mathematical description of the flat-fielding process for dual-beam data, and the corrections applied by POLPACK when calculating the Stokes parameters.
Whether you are using dual-beam or single-beam data, do not forget to use the same flat-field to correct all target exposures. This will usually be a master flat-field formed by co-adding several individual flat-field exposures. This reduces the noise in the master flat-field. This is important for two reasons:
Another aspect of instrumental calibration is the estimation of the uncertainty on every pixel value. If you know the noise characteristics of your detector, you may be able to store this information with your data in the form of an NDF VARIANCE component. This is an array holding an estimate of the variance at every pixel in your data. If present, POLPACK will process this information to obtain estimates of the uncertainty in the final polarization parameters. If you use CCDPACK to calibrate your data, then the DEBIAS application can be used to create a VARIANCE component.
If you are using single-beam data, there is an option to estimate the variances associated with the input data while calculating the Stokes vectors. This enables variances to be found for the Stokes vectors even if your input data has no usable variance information. See section E for details.
The applications within POLPACK are made available from the C shell using the command:
This command must be issued before attempting to use any POLPACK applications.
POLPACK needs to know certain items of header information about each of the supplied data files. These include the half-wave plate position, the orientation of the reference direction, etc. Different instruments may store this information in different ways, and for this reason, POLPACK includes an application which finds the required items of information and stores them away in a standard place within the data file from where the other POLPACK applications can extract them when needed. This standard place is known as the “POLPACK extension”. The process of copying this information from its original, instrument specific location, into the POLPACK extension is known as “importing” the data, and is performed by the POLIMP application5, or the POLEXT application (if you have no FITS headers available).
You tell POLIMP where to find each required item of information by supplying it with a “control table”. This is a text file containing a line for each item of information to be imported into the POLPACK extension. Each such item has a name by which other POLPACK applications refer to it (these are described in appendix F). As well as the name of a POLPACK extension item, each line of the control table should contain a description of where to obtained the corresponding value. This description is given in terms of FITS keywords. For instance, the line
tells POLIMP to find the value of the FITS keyword HWPANG and store it as item “WPLATE” in the POLPACK extension (this is the half-wave plate position angle).
If your data are supplied in the form of a set of FITS files, then the HWPANG value would simply be obtained from the primary header. If your data is supplied in the form of a set of NDF structures, then the value would be read from the FITS extension in the NDF structure (which should have been created by the data acquisition system). For other data formats, the origin of the keyword value depends on how the data conversion is performed. SUN/55 contains details of how FITS keywords are created from foreign data files.
The POLIMP control table also allows POLPACK extension items to be derived from one or more FITS keyword values, combined together to form a Fortran-like mathematical expression. For instance, this may be useful if the FITS keyword uses a different set of units, or has a different sign convention. When used in this way, each FITS keyword must be “declared” earlier in the control table. This declaration tells POLIMP what sort of data values the keyword can take. For instance:
converts the value of the FITS keyword ROTA from radians to degrees, and assigns the result to the item ANGROT. The first line informs POLIMP that the keyword ROTA should be treated as a single precision floating point value. The recognized data types are:
_BYTE
_CHAR
_DOUBLE
_INTEGER
_REAL
_WORD
See the description of the POLIMP application for further details of the syntax of the control table.
There is also a POLEXP application which reverses the importing process. It copies the information stored in the POLPACK extension into named FITS keywords. The primary purpose of POLEXP is to allow the automatic format conversion facilities of the NDF library to convert a POLPACK NDF structure back into a foreign data file. It is generally not necessary for users to call POLEXP explicitly.
The POLEXT application allows the contents of the POLPACK extension to be set to explicit values
supplied by the user. This can be useful if your data does not contain any FITS headers.
POLEXT will also list the contents of the POLPACK extension. If your data is stored in NDF
format, you can also use the hdstrace
command to list the contents of the NDF extension.
For instance, to check the contents of the POLPACK extension in the NDF partproc.sdf,
do:
The reference direction within each image is recorded by adding a new co-ordinate Frame to the World Co-ordinate System (WCS) information stored with the image (see section 5.9). The new Frame has the Domain name POLANAL, and its first axis is parallel to the reference direction. This Frame will be updated by any POLPACK application which produces a change in the orientation of the reference direction. This will happen for instance if POLKA introduces a rotation into the images during the alignment process6. If you process your images using applications from another package, then be aware that the POLANAL Frame may be lost or invalidated. Basically, you will probably be safe if you only use packages which correctly propagate WCS information in form of Starlink AST FrameSets (see SUN/210). KAPPA, for instance, is such a package.
You specify the reference direction when you run POLIMP or POLEXT by giving a value for the ANGROT item (the anti-clockwise angle in degrees from the first image axis to the reference direction). In versions of POLPACK prior to V2.0, ANGROT was stored explicitly as a floating point value within the POLPACK extension. As of V2.0, ANGROT is no longer stored in the POLPACK extension. Instead, its value is implied by the orientation of the POLANAL Frame within the WCS information. However, you can consider this an “implementation detail” – as far as the general user is concerned, ANGROT can be treated like any of the genuine extension items. In particular, it can be set or examined using POLIMP, POLEXT and POLEXP just like any other POLPACK header item.
The creation of Stokes vectors from the calibrated, imported target exposures involves the following steps:
The first three of these steps can be performed using applications from KAPPA and CCDPACK, and the final step is performed by the POLPACK application POLCAL. However, this is a fairly involved process since the available applications are somewhat low-level. For this reason, POLPACK includes a tool called POLKA which simplifies the process. POLKA is effectively a script which calls the KAPPA, CCDPACK and POLPACK applications required to perform all four of the steps listed above7. While some options are provided to allow the user to customise the exact recipe used, POLKA does not provide as much versatility or control over the processing as would be available if the individual applications were called “by hand”. If you hit a problem which POLKA cannot handle, then you may need to adopt this alternative approach.
One specific restriction on POLKA is that it can only be used with 2-dimensional intensity images (i.e. not 3-dimensional spectropolarimetry data). To create Stokes vectors from 3-dimensional intensity cubes, the cubes must first be aligned in both the spatial and the spectral domain (e.g. using CCDPACK and KAPPA applications “by hand”), and then POLCAL should be used to create a 4-dimensional hyper cube containing Stokes vectors.
POLKA requires you to identify the following features within the supplied images:
A Graphical User Interface (GUI) is created for this purpose, including an image display area in which any of the input images may be displayed, and controls to select any of the above features (see Figure 7). Note, if you find the image display area uncomfortably small, it can be made larger by assigning a suitable value to the DPI parameter when POLKA is started. Once the required features have been supplied, POLKA commences the processing of the supplied data frames. This may take a significant length of time depending on your hardware, and the size and number of your images. A window displays the progress being made during this phase.
Once complete, a 3D cube is created in which the x-y plane corresponds to pixel positions within the extracted, aligned intensity images. Each plane in the cube contains a single Stokes parameter. The lowest plane is always the total intensity. The other planes contain either Q and U for linear polarization, or V for circular polarization8. In addition, the separate aligned, sky-subtracted intensity images on which the Stokes parameters were based may be saved once the processing is complete.
The reference direction (see section 3.1) for the Stokes vectors in the output cube will not in general be the same as the reference direction in the input intensity images. The output reference direction is chosen as follows:
The POLKA application has many parameters. The values used for some of these may be changed from within the GUI. However, some may not be changed and should be assigned appropriate values when invoking POLKA. Of these, the most important will usually be:
A separate guide is available describing POLKA in detail. It contains a step-by-step tutorial, detailed descriptions of each control in the GUI, answers to some common questions, etc. It may be accessed using the Help menu within the GUI. When POLKA is activated, the tutorial is automatically displayed in a WWW browser (this may be disabled using the STARTHELP parameter when running POLKA). If you are new to POLKA, it is a good idea to work your way through the tutorial first.
Linear polarimetry results are usually expressed in terms of the percentage polarization and the orientation of the plane of polarization. Vectors may be used to represent these quantities graphically. The following POLPACK applications can be used to produce a map of vectors describing the polarization at different points on the sky:
For circular polarimetry, the Q and U columns are replaced by a single V column. If variance information is available (see section 5.2) then columns are also produced holding the standard deviations associated with each of the above quantities (except X, Y and Z). Each pixel in the x-y plane of the supplied cube produces one or more rows in the catalogue, the number being equal to the number of spectral channels in the data. So for single waveband polarimetry, the catalogue will contain one row for each pixel in the x-y plane, but for spectropolarimetry data with (say) 100 spectral channels, there will be 100 rows for each pixel in the x-y plane. The reference direction for the , and columns is chosen in the same way as when producing the Stokes vectors (i.e. north, if WCS information is available to define north, or the second image axis otherwise).
POLVEC can also produce a set of 2 or 3D NDFS holding the above quantities.
In addition, the catalogues produced by POLBIN and POLVEC can be examined and interactively edited using the polarimetry toolbox within GAIA (SUN/214).
Since the polarization parameters are stored in a catalogue, TOPCAT (see http://www.starlink.ac.uk/topcat/) can be used to examine them. Also, the STILTS package (http://www.starlink.ac.uk/stilts/) can be used to manipulate them. For instance the following commands create a new catalogue called selcat.FIT which contains all the vectors from bincat.FIT for which the polarization is less than 30% and has a standard deviation less than 5%:
Note, the POLIMAGE application can be used to extract the values from a specified column of a catalogue into an image. The image can be either a simple 1-dimensional list of the column values, or it can be a 2-dimensional image in which the spatial position of each value is retained. In this case, the image is formed by binning the column values into a grid of pixels.
A typical recipe for using the above applications (together with KAPPA) to display a spatial vector map would involve the following steps:
The above basic recipe can be modified in many ways. For instance:
/acps
, from the list of graphics devices produced
by the KAPPA GDNAMES command. This causes the postscript output from each
subsequent command to be accumulated into a single postscript file, which by default
is called pgplot.ps. For instance, to produce a contour map with overlaid vectors,
do:
The file pgplot.ps then contains the combined PostScript data from both the contour plot and the vector plot, which can be converted to some other graphics format or printed on a suitable printer
Note setting environment variable PGPLOT_PS_FONT to “Times” causes text to be produced using a higher quality postscript font (Times New Roman). Other alternative font names are “Helvetica”, “Courier”, “NewCentury” and “Zapf”. Leaving the environment variable unset will cause the lower quality default PGPLOT font to be used.
These are just a few examples of the possibilities for varying the above recipe. Familiarity with the parameters of the relevant KAPPA and POLPACK applications will suggest many more.
The techniques used in the examples in the previous section can also be used to display a single spectral channel when using spectropolarimetry data, but only if the data has some spatial coverage (i.e. has more than 1 pixel in the x-y plane). To do this, specify the spectral channel to be displayed by POLPLOT, using parameter ZAXVAL or ZCOLVAL. These two parameters specify the spectral channel in different ways:
If a ZAXVAL value is supplied, it is converted into the corresponding ZCOLVAL value. Either way, only vectors for which the Z column value in the catalogue equals the specified ZCOLVAL value are plotted. If the catalogue contains no vectors with the specified ZCOLVAL, then the nearest ZCOLVAL for which some vectors are available is used instead of the supplied ZCOLVAL. The value actually used is reported to the user and included in the default title for the plot.
An alternative method for displaying spectropolarimetry data is to use KAPPA LINPLOT to display
line plots of the quantities of interest, as a function of spectral channel. This method has the
advantage that, unlike POLPLOT, it can be used even if your data has no spatial coverage (i.e.
covers only a single pixel in the x-y plane). Before using LINPLOT you need to create an
NDF containing the data to be plotted. To do this, use POLIMAGE. As an example, to plot
polarization against wavelength at ( x=1.5, y=2.5 ) for the data in catalogue mycat.FIT
,
do:
POLIMAGE creates the file pdata.sdf
which is a 3D NDF containing the values from the “P” column
in mycat.FIT
. The VARIANCE component of the NDF is filled with the square of the values in the
“DP” column (do not supply a value for parameter COLVAR if the catalogue does not contain a
suitable error column). The values assigned to the BOX parameter should usually be the same as the
bin sizes used to create the catalogue (use 1,1,1 if the catalogue has not been binned). The LINPLOT
command then plots the NDF data values at X and Y pixel indices of 2 and 3 (i.e. pixel
coordinates ( 1.5, 2.5 ) ), and covering the entire third (Z) axis. If the catalogue contains data
only for a single x-y position, then the LINPLOT parameter NDF could be assigned the
value “pdata” (without any section specified) since there is no ambiguity about which x-y
pixel to use. The ERRBAR parameter indicates that error bars are to be plotted (this would
not be possible if we had not assigned a value to the COLVAR parameter when running
POLIMAGE).
There are many other options for using these applications. See there reference documentation for details.
Information describing all POLPACK commands is available in several forms:
Additional arguments may be given indicating the subject on which help is required. For instance:
will enter the help library at the point containing information on the parameters available for application POLKA.
Information describing spatial co-ordinate Frames can be stored within the WCS component of the standard NDF structure. All NDFs know about “pixel co-ordinates”, but additional co-ordinate Frames can be added. In the context of POLPACK, the co-ordinate Frames most likely to be of interest are celestial co-ordinate systems such as RA/DEC. This information can be used in two ways:
If you are using dual-beam data, the simplest method is probably to define the RA/DEC calibration once the and ray images have been extracted into separate images (i.e. after running POLKA). With single-beam data, you can define the RA/DEC calibration at any point. So, the procedure is:
After following the above procedure, you should find that POLPLOT automatically annotates your vector map with RA/DEC values. If you want to annotate the axes in pixel co-ordinates for any reason, specify the value “PIXEL” for the FRAME parameter when running POLPLOT. You can also choose to annotate the axes in several other common celestial co-ordinate Frames by supplying suitable values for parameter FRAME. Some examples:
FRAME=GAL - this will result in the axes being annotated with galactic co-ordinates.
FRAME=ECL - this will result in the axes being annotated with ecliptic co-ordinates (referred to the B1950.0 equinox).
Ecliptic and equatorial (RA/DEC) co-ordinates are referred to a specified equinox. The required equinox can be included, in parentheses, following the co-ordinate system name. For instance:
FRAME=EQU(J2000) - this will result in the axes being annotated with RA/DEC referred to the J2000.0 equinox. The RA/DEC calibration stored with the catalogue will be precessed if necessary.
FRAME=ECL(B1983.4) - this will result in the axes being annotated with ecliptic co-ordinates referred to the B1983.4 equinox.
If you have an image containing a calibration in a suitable celestial co-ordinate system, then you can plot the polarization vectors in alignment with the image. If you follow the procedure described in section 5.7, then the vectors will be aligned automatically with the image. One niggle to watch out for is that both DISPLAY and POLPLOT draw annotated axes, potentially resulting in a bit of a mess! You should normally disable the production of one set of axes by setting parameter AXES to “NO” when running either DISPLAY or POLPLOT.
If you modify a POLPACK catalogue using other software (e.g. TOPCAT or STILTS) it is likely that the
WCS information will be removed from the resulting output catalogue, resulting in annotated axes
that look wrong and/or incorrect alignment with other data. To correct this, the WCS information can
be added back into the catalogue using the POLWCSCOPY command. Say for instance you create
catalogue mycat.FIT
using POLPACK, and then use STILTS to remove low signal-to-noise vectors,
creating a new catalogue selcat.FIT
:
The WCS information will be missing from selcat.FIT
, and so we need to copy it back again from the
original catalogue mycat.FIT
:
This creates a third catalogue selcat2.FIT
, which is a copy of selcat.FIT
but with WCS inherited
from mycat.FIT
.
4The double quotes are needed to prevent the asterisks being expanded by the shell. The expansion of these file templates is performed internally, within fits2ndf.
5Once imported, the POLPACK extension is propagated through the entire data reduction sequence, with new items being added at various points to describe the intermediate stages of processing.
6Rotation is currently only possible when processing single-beam data.
7The final step - calculating the Stokes parameters - is optional. This allows POLKA to be used as a general purpose image alignment tool for non-polarimetric data.
8POLPACK can currently only measure circular polarization for dual-beam data.