# wfc3tools package

## Submodules

## wfc3tools.calwf3 module

`wfc3tools.calwf3.``calwf3`(input, printtime=False, save_tmp=False, verbose=False, debug=False, parallel=True)

  calwf3 Version 1.3.1 updated on unspecified

  `calwf3` is the name of the main executable which processes data from the WFC3 instrument onboard Hubble taken with either the UVIS or IR detectors.

  Running calwf3:

  `calwf3` can be run on a single input raw file or an asn table listing the members of an associtaion. When processing an association, it retrieves calibration switch and reference file keyword settings from the first image listed in the asn table. `calwf3` does not accept a user-defined list of input images on the command line (e.g. `*raw.fits` to process all raw files in the current directory).

  > In Python without TEAL:

  >     >>> from wfc3tools import calwf3
  >     >>> calwf3(filename)

  > In Python with TEAL:

  >     >>> from stsci.tools import teal
  >     >>> from wfc3tools import calwf3
  >     >>> teal.teal('calwf3')

  > In Pyraf:

  >     >>> import wfc3tools
  >     >>> epar calwf3

`wfc3tools.calwf3.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.calwf3.``help`(file=None)

  Print out syntax help for running wf3ir

`wfc3tools.calwf3.``run`(configobj=None)

  TEAL interface for the ‘calwf3’ function.

## wfc3tools.embedsub module

`wfc3tools.embedsub.``embedsub`(files)

  embedsub Version 1.3.1 updated on unspecified

  embedsub:

  Given an image specified by the user which contains a subarray readout, return a full-frame image with the subarray implanted at the appropriate location.

  Usage :

      >>> python
      >>> from wfc3tools import embedsub
      >>> embedsub(files)

  Parameters:

  > files [file]
  >   Input image name or list of image names. The rootname will be used to create the output name

  Returns:

  Return the full-frame location of the subarray coordinates using a file specified by the user.

`wfc3tools.embedsub.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.embedsub.``help`(file=None)

  Print out syntax help for running wf3ir

## wfc3tools.pstack module

`wfc3tools.pstack.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.pstack.``help`(file=None)

  Print out syntax help for running wf3ir

`wfc3tools.pstack.``pstack`(filename, column=0, row=0, extname='sci', units='counts', title=None, xlabel=None, ylabel=None, plot=True)

  pstack Version 1.3.1 updated on 06-Sep-2013

  pstack:

  Plot the stack of MultiAccum sample values for a specified pixel in an IR multiaccum image. Pixels from any of the SCI, ERR, DQ, or TIME image extensions can be plotted. The total number of samples is determined from the primary header keyword NSAMP and all samples (excluding the zeroth read) are plotted. The SCI, ERR, DQ, values are plotted as a function of sample time, while TIME values are plotted as a function of sample number. The sample times are read from the SAMPTIME keyword in the SCI header for each readout. If any of the ERR, DQ, SAMP, or TIME extensions have null data arrays, the value of the PIXVALUE extension header keyword is substituted for the pixel values. The plotted data values can be saved to an output text table or printed to the terminal.

  The BUNIT keyword value is used to determine the starting units of the data, but you can plot either counts or rate using the optional keyword `units`.

      In [1]: xdata,ydata=pstack.pstack('ibh719grq_ima.fits',column=100,row=25,extname='sci')

  The plotting data is returned as two arrays, to save them into variables issue the command as above:

      In [1]: xdata
      Out[2]:
      array([ 100.651947,   93.470573,   86.2892  ,   79.107826,   71.926453,
               64.745079,   57.563702,   50.382328,   43.200954,   36.019581,
               28.838205,   21.65683 ,   14.475455,    7.29408 ,    0.112705,
                0.      ])

      In [3]: ydata
      Out[4]:
      array([ 221.36606389,  219.5396653 ,  182.63100095,  169.178308  ,
              186.44084352,  158.3105126 ,  129.46997895,  129.92935701,
              106.14521852,   72.71721539,   69.68652119,   55.98828663,
               42.30755279,   13.12659422,   27.71404187,    0.        ])

  Warning

  Note that the arrays are structured in SCI order, so the final exposure is the first element in the array

  Parameters:

  - input [file]

      Input MultiAccum image name. This should be either a _ima or _raw file, containing all the data from multiple readouts. You must specify just the file name, with no extension designation.

  - col [integer]

      The column index of the pixel to be plotted.

  - row [integer]

      The row index of the pixel to be plotted.

  - extname = “sci” [string, allowed values: sci | err | dq | samp | time]

      Extension name (EXTNAME keyword value) of data to plot.

  - units = “counts” [string, allowed values: counts | rate]

      Plot “sci” or “err” data in units of counts or countrate (“rate”). Input data can be in either unit; conversion will be performed automatically. Ignored when plotting “dq”, “samp”, or “time” data.

  - title = “” [string]

      Title for the plot. If left blank, the name of the input image, appended with the extname and column and row being plotted, is used.

  - xlabel = “” [string]

      Label for the X-axis of the plot. If left blank, a suitable default is generated.

  - ylabel = “” [string]

      Label for the Y-axis of the plot. If left blank, a suitable default based on the plot units and the extname of the data is generated.

  - plot = True [bool] set plot to false if you only want the data returned

  Usage:

      >>> python
      >>> from wfc3tools import pstack
      >>> xdata,ydata=pstack(inputFilename,column=x,row=y,extname="sci",units="counts|rate",title="",ylabel="",xlabel="")

## wfc3tools.pstat module

`wfc3tools.pstat.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.pstat.``help`(file=None)

  Print out syntax help for running wf3ir

`wfc3tools.pstat.``pstat`(filename, extname='sci', units='counts', stat='midpt', title=None, xlabel=None, ylabel=None, plot=True)

  pstat Version 1.3.1 updated on unspecified

  pstat:

  Plot statistics for a specified image section up the stack of a an IR MultiAccum image. Sections from any of the SCI, ERR, DQ, image extensions can be plotted. A choice of mean, median, mode, standard deviation, minimum and maximum statistics is available. The total number of samples is determined from the primary header keyword NSAMP and all samples (excluding the zeroth-read) are plotted. The SCI, ERR, DQ statistics are plotted as a function of sample time. The sample times are read from the SAMPTIME keyword in the SCI header for each readout.

  SAMP and TIME aren’t generally populated until the FLT image stage To plot the samptime vs sample, use wfc3tools.pstat and the “time” extension

      In [1]: pstat('ibh719grq_ima.fits')

  The plotting data is returned as two arrays:

      Out[2]:
      (array([ 100.651947,   93.470573,   86.2892  ,   79.107826,   71.926453,
                64.745079,   57.563702,   50.382328,   43.200954,   36.019581,
                28.838205,   21.65683 ,   14.475455,    7.29408 ,    0.112705,
                 0.      ]),
       array([ 171.85813415,  162.44643275,  148.99918831,  137.60458714,
               125.91510743,  114.71149769,  102.63038466,   90.97130078,
                78.26479365,   67.16825321,   53.6897243 ,   41.71639092,
                29.36628817,   16.47151355,   -0.20821257,    0.        ]))

  If you want to save the plotting data into the variables `time` and `counts` you can issue the command like this:

      In [1]: time,counts =pstat.pstat('ibh719grq_ima.fits')

      In [2]: time
      Out[3]:
      array([ 100.651947,   93.470573,   86.2892  ,   79.107826,   71.926453,
               64.745079,   57.563702,   50.382328,   43.200954,   36.019581,
               28.838205,   21.65683 ,   14.475455,    7.29408 ,    0.112705,
                0.      ])

      In [4]: counts
      Out[5]:
      array([ 171.85813415,  162.44643275,  148.99918831,  137.60458714,
              125.91510743,  114.71149769,  102.63038466,   90.97130078,
               78.26479365,   67.16825321,   53.6897243 ,   41.71639092,
               29.36628817,   16.47151355,   -0.20821257,    0.        ])

  Warning

  Note that the arrays are structured in SCI order, so the final exposure is the first element in the array

  Parameters:

  - filename [file]

      Input MultiAccum image name with optional image section specification. If no image section is specified, the entire image is used. This should be either a _raw or _ima file, containing all the data from multiple readouts. You must specify just the file name and image section, with no extname designation.

  - extname = “sci” [string, allowed values: sci | err | dq ]

      Extension name (EXTNAME keyword value) of data to plot.

  - units = “counts” [string, allowed values: counts | rate]

      Plot “sci” or “err” data in units of counts or countrate (“rate”). Input data can be in either unit; conversion will be performed automatically. Ignored when plotting “dq”, “samp”, or “time” data.

  - stat = “midpt” [string, allowed values: mean|midpt|mode|stddev|min|max]

      Type of statistic to compute.

  - title = “” [string]

      Title for the plot. If left blank, the name of the input image, appended with the extname and image section, is used.

  - xlabel = “” [string]

      Label for the X-axis of the plot. If left blank, a suitable default is generated.

  - ylabel = “” [string]

      Label for the Y-axis of the plot. If left blank, a suitable default based on the plot units and the extname of the data is generated.

  - plot = True [bool] set plot to false if you only want the data returned

  Usage:

      pstat.py  inputFilename [pixel range]

      >>> python
      >>> from wfc3tools import pstat
      >>> pstat(inputFilename,extname="sci",units="counts",stat="midpt",title="",xlabel="",ylabel="" )

## wfc3tools.sampinfo module

`wfc3tools.sampinfo.``getHelpAsString`(docstring=False)

  Returns documentation on the ‘sampinfo’ function.

  return useful help from a file in the script directory called __taskname__.help

`wfc3tools.sampinfo.``help`()

`wfc3tools.sampinfo.``sampinfo`(imagelist, add_keys=None, mean=False, median=False)

  sampinfo Version 1.3.1 updated on unspecified

  sampinfo:

  Sampinfo prints information about a WFC3/IR MultiAccum image, including exposure time information for the individual samples (readouts). The global information listed (and the names of the header keywords from which it is retrieved) includes:

  - the total number of image extensions in the file (NEXTEND)
  - the name of the MultiAccum exposure sample sequence (SAMP_SEQ)
  - the total number of samples, including the “zeroth” read (NSAMP)
  - the total exposure time of the observation (EXPTIME).

  Information that is listed for each sample is the IMSET number (EXTVER), the sample number (SAMPNUM), the sample time, which is the total accumulated exposure time for a sample (SAMPTIME), and the delta time, which is the additional exposure time accumulated since the previous sample (DELTATIM).

  Note that the samples of a MultiAccum exposure are stored in the FITS file in reverse time order. The initial, or “zeroth” read, appears last in the FITS file, with IMSET=NSAMP, SAMPNUM=0, SAMPTIME=0, and DELTATIM=0. The final read of the exposure appears first in the file and has IMSET=1, SAMPNUM=NSAMP-1 (SAMPNUM is zero-indexed), and SAMPTIME=EXPTIME.

  Options:

  This version will accept a single image name or a python list of images. The list of images should be a python style list, such as:

        >>> ["image1.fits","image2.fits"]

  add_keys=list(): You can also supply a supplimental list of keywords to print for each sample, if the key isn’t found in the sample the global header will be checked.If a key is not found the “NA” string will be printed. Additionally you can ask for the median or mean of the datavalues for each sample using the appropriate switch.

  median=False: Set to True in order to report the median pixel value for each sample

  mean=False: Set to True in order to report the mean pixel value for each sample (as measured with np.min and np.max)

  Usage:

  Typical:

        >>> python
        >>> from wfc3tools import sampinfo
        >>> sampinfo(imagename)

  Where imagename can be a single filename or a python list() of names

  To get the median value for each sample:

        >>> sampinfo.sampinfo(imagename, median=True)

  To print additional keys for information:

        >>> sampinfo.sampinfo(imagename,add_keys=["DETECTOR"])

  To get the average balue for each sample:

        >>> sampinfo.sampinfo(imagename, mean=True)

  Example Output:

  Default output:

      In [3]: wfc3tools.sampinfo('ibcf02faq_raw.fits')
      IMAGE                       NEXTEND SAMP_SEQ        NSAMP   EXPTIME
      ibcf02faq_raw.fits  80      STEP50          16      499.234009

      IMSET       SAMPNUM SAMPTIME        DELTATIM
      1   15      499.234009      50.000412
      2   14      449.233582      50.000412
      3   13      399.233154      50.000412
      4   12      349.232727      50.000412
      5   11      299.2323        50.000412
      6   10      249.231873      50.000412
      7   9       199.231461      50.000412
      8   8       149.231049      50.000412
      9   7       99.230637       50.000412
      10  6       49.230225       25.000511
      11  5       24.229715       12.500551
      12  4       11.729164       2.932291
      13  3       8.796873        2.932291
      14  2       5.864582        2.932291
      15  1       2.932291        2.932291
      16  0       0.0     0.0

  with median=True:

      In [4]: wfc3tools.sampinfo('ibcf02faq_raw.fits',median=True)
      IMAGE                       NEXTEND SAMP_SEQ        NSAMP   EXPTIME
      ibcf02faq_raw.fits  80      STEP50          16      499.234009

      IMSET       SAMPNUM SAMPTIME        DELTATIM
      1   15      499.234009      50.000412       MedPixel: 11384.0
      2   14      449.233582      50.000412       MedPixel: 11360.0
      3   13      399.233154      50.000412       MedPixel: 11335.0
      4   12      349.232727      50.000412       MedPixel: 11309.0
      5   11      299.2323        50.000412       MedPixel: 11283.0
      6   10      249.231873      50.000412       MedPixel: 11256.0
      7   9       199.231461      50.000412       MedPixel: 11228.0
      8   8       149.231049      50.000412       MedPixel: 11198.0
      9   7       99.230637       50.000412       MedPixel: 11166.0
      10  6       49.230225       25.000511       MedPixel: 11131.0
      11  5       24.229715       12.500551       MedPixel: 11111.0
      12  4       11.729164       2.932291        MedPixel: 11099.0
      13  3       8.796873        2.932291        MedPixel: 11097.0
      14  2       5.864582        2.932291        MedPixel: 11093.0
      15  1       2.932291        2.932291        MedPixel: 11090.0
      16  0       0.0     0.0     MedPixel: 11087.0

## wfc3tools.sub2full module

`wfc3tools.sub2full.``getHelpAsString`(docstring=False)

  Returns documentation on the ‘sub2full’ function.

  return useful help from a file in the script directory called __taskname__.help

`wfc3tools.sub2full.``help`()

`wfc3tools.sub2full.``sub2full`(filename, x=None, y=None, fullExtent=False)

  sub2full Version 1.3.1 updated on unspecified

  sub2full:

  Given an image specified by the user which contains a subarray readout, return the location of the corner of the subarray in a full frame reference image (including the full physical extent of the chip), in 1-indexed pixels. If the user supplies an X and Y coordinate, then the translated location of that point will be returned.

  Usage:

      >>> python
      >>> from wfc3tools import sub2full
      >>> coords=sub2full(filename,x=None, y=None,fullExtent=False)

  Parameters:

  - filename [file]

      Input image name or list of image names. The rootname will be used to find the _SPT files in the same directory, the SPT file has all the necessary information for the transform.

  - x = None [integer] Optional

      Specify an x coordinate in the subarray to translate. If an x and y are specified, the fullExtent option is turned off and only the translated x,y coords are returned

  - y = None [integer] Optional

      Specify a y coordinate in the subarray to translate. If an x and y are specified, the fullExtent option is turned off and only the translated x,y coords are returned

  - fullExtent = False [bool] Optional

      If set, the returned values will include the full extent of the subarray in the reference image, for example: (x0,x1,y0,y1)

  Returns:

  A list of tuples which specify the translated coordinates, either (x0,y0) for each image or the full extent sections

  Example Output:

  Default output:

      > sub2full('ibbso1fdq_flt.fits')
      > [(3584.0, 1539)]

  Optional output:

      Specify a list of images:

      >im = ['ic5p02e0q_spt.fits',
             'ic5p02e1q_spt.fits',
             'ic5p02e2q_spt.fits',
             'ic5p02e3q_spt.fits',
             'ic5p02e4q_spt.fits']
      >
      > sub2full(im)
      > [(1062.0, 1363),
      > (1062.0, 1363),
      > (1410.0, 1243),
      > (1410.0, 1243),
      > (1402.0, 1539)]

      Return the full extent of the subarray:

      > sub2full('ibbso1fdq_flt.fits',fullExtent=True)
      > [(3584.0, 4096, 1539, 2050)]

## wfc3tools.util module

`wfc3tools.util.``display_help`()

  display local html help in a browser window

## wfc3tools.version module

This is an automatically generated file created by stsci.distutils.hooks.version_setup_hook. Do not modify this file by hand.

## wfc3tools.wf32d module

`wfc3tools.wf32d.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.wf32d.``help`(file=None)

`wfc3tools.wf32d.``run`(configobj=None)

  TEAL interface for the `wf32d` function.

`wfc3tools.wf32d.``wf32d`(input, output='', dqicorr='PERFORM', darkcorr='PERFORM', flatcorr='PERFORM', shadcorr='PERFORM', photcorr='PERFORM', verbose=False, quiet=True)

  wf32d Version 1.3.1 updated on unspecified

  wf32d:

  Use this function to facilitate batch runs or for the TEAL interface.

  The wf32d primary functions include:
    - DARKCORR: dark current subtraction
    - FLATCORR: flat-fielding
    - PHOTCORR: photometric keyword calculations
    - FLUXCORR: photometric normalization of the UVIS1 and UVIS2 chips

  Only those steps with a switch value of PERFORM in the input files will be executed, after which the switch will be set to COMPLETE in the corresponding output files.

  Examples:

  > In Python without TEAL:

  >     >>> from wfc3tools import wf32d
  >     >>> wf32d(filename)

  > In Python with TEAL:

  >     >>> from stsci.tools import teal
  >     >>> from wfc3tools import wf32d
  >     >>> teal.teal('wf32d')

  > In Pyraf:

  >     >>> import wfc3tools
  >     >>> epar wf32d

  Parameters:

  > input : str

  >   Name of input files

  >   > - a single filename (`iaa012wdq_raw.fits`)
  >   > - a Python list of filenames
  >   > - a partial filename with wildcards (`\*raw.fits`)
  >   > - filename of an ASN table (`\*asn.fits`)
  >   > - an at-file (`@input`)

  > output: str
  >   Name of the output FITS file.
  > dqicorr: str, “PERFORM/OMIT”, optional
  >   Update the dq array from bad pixel table
  > darkcorr: str, “PERFORM/OMIT”, optional
  >   Subtract the dark image
  > flatcorr: str, “PERFORM/OMIT”, optional
  >   Multiply by the flatfield image
  > shadcorr: str, “PERFORM/OMIT”, optional
  >   Correct for shutter shading (CCD)
  > photcorr: str, “PERFORM/OMIT”, optional
  >   Update photometry keywords in the header
  > fluxcorr; str, “PERFORM/OMIT”, optional
  >   Perform chip photometry normalization
  > verbose: bool, optional
  >   Print verbose time stamps?
  > quiet: bool, optional
  >   Print messages only to trailer file?

  The wf32d function can also be called directly from the OS command line:

      >>> wf32d.e input output [-options]

  Where the OS options include:

  - -v: verbose
  - -f: print time stamps
  - -d: debug
  - -dark: perform dark subtraction
  - -dqi: update the DQ array
  - -flat: perform flat correction
  - -shad: perform shading correction
  - -phot: perform phot correction

## wfc3tools.wf3ccd module

`wfc3tools.wf3ccd.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.wf3ccd.``help`(file=None)

`wfc3tools.wf3ccd.``run`(configobj=None)

  TEAL interface for the `wf3ccd` function.

`wfc3tools.wf3ccd.``wf3ccd`(input, output='', dqicorr='PERFORM', atodcorr='PERFORM', blevcorr='PERFORM', biascorr='PERFORM', flashcorr='PERFORM', verbose=False, quiet=True)

  wf3ccd Version 1.3.1 updated on unspecified

  wf3ccd:

  This routine contains the initial processing steps for all the WFC3 UVIS channel data. These steps are:

  > - DQICORR - initializing the data quality array
  > - ATODCORR - perform the a to d conversion correction
  > - BLEVCORR - subtract the bias level from the overscan region
  > - BIASCORR - subtract the bias image
  > - FLSHCORR - subtract the post-flash image

  `wf3ccd` first subtracts the bias and trims the overscan regions from the image. If an associated set of UVIS CR-SPLIT or REPEAT-OBS images is being processed, all of the overscan-trimmed images are sent through `wf3rej` to be combined and receive cosmic-ray rejection. The resulting combined image then receives final calibration with `wf32d`, which includes dark subtraction and flat-fielding. If there are multiple sets of CR-SPLIT or REPEAT-OBS images in an association, each set goes through the cycle of `wf3ccd`, `wf3rej` and `wf32d` processing.

  If BLEVCORR is performed the output contains the overcan-trimmed region.

  Only those steps with a switch value of PERFORM in the input files will be executed, after which the switch will be set to COMPLETE in the corresponding output files.

  Example:

  > In Python without TEAL:

  >     >>> from wfc3tools import wf3ccd
  >     >>> wf3ccd(filename)

  > In Python with TEAL:

  >     >>> from stsci.tools import teal
  >     >>> from wfc3tools import wf3ccd
  >     >>> teal.teal('wf3ccd')

  > In Pyraf:

  >     >>> import wfc3tools
  >     >>> epar wf3ccd

  Parameters:

  > input : str

  >   Name of input files

  >   > - a single filename (`iaa012wdq_raw.fits`)
  >   > - a Python list of filenames
  >   > - a partial filename with wildcards (`\*raw.fits`)
  >   > - filename of an ASN table (`\*asn.fits`)
  >   > - an at-file (`@input`)

  > output: str
  >   Name of the output FITS file.
  > dqicorr: str, “PERFORM/OMIT”, optional
  >   Update the dq array from bad pixel table
  > atodcorr: str, “PERFORM/OMIT”, optional
  >   Analog to digital correction
  > blevcorr: str, “PERFORM/OMIT”, optional
  >   Subtract bias from overscan regions
  > biascorr: str, “PERFORM/OMIT”, optional
  >   Subtract bias image
  > flashcorr: str, “PERFORM/OMIT”, optional
  >   Subtract post-flash image
  > verbose: bool, optional
  >   Print verbose time stamps?
  > quiet: bool, optional
  >   Print messages only to trailer file?

  The wf3ccd function can also be called directly from the OS command line:

      >>> wf32ccd.e input output [-options]

  Where the OS options include:

  - -v: verbose
  - -f: print time stamps
  - -dqi: udpate the DQ array
  - -atod: perform gain correction
  - -blev: subtract bias from overscan
  - -bias: perform bias correction
  - -flash: remove post-flash image

## wfc3tools.wf3cte module

`wfc3tools.wf3cte.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3cte’ function. Required by TEAL.

`wfc3tools.wf3cte.``help`(file=None)

`wfc3tools.wf3cte.``run`(configobj=None)

  TEAL interface for the `wf3cte` function.

`wfc3tools.wf3cte.``wf3cte`(input, parallel=True, verbose=False)

  wf3cte Version 1.3.1 updated on unspecified

  wf3cte:

  The charge transfer efficiency (CTE) of the UVIS detector has inevitably been declining over time as on-orbit radiation damage creates charge traps in the CCDs. Faint sources in particular can suffer large flux losses or even be lost entirely if observations are not planned and analyzed carefully. The CTE loss will depend on the morphology of the source, the distribution of electrons in the field of view (from sources, background, cosmic rays, and hot pixels) and the population of charge traps in the detector column between the source and the transfer register. And the magnitude of the CTE loss increases continuously with time as new charge traps form.

  CTE is typically measured as a pixel-transfer efficiency, and would be unity for a perfect CCD. One indicator of CTE is the Extended Pixel Edge Response (EPER). Inefficient transfer of electrons in a flat-field exposure produces an exponential tail of charge in the overscan region. Analysis of monitoring observations through January 2013 shows that CTE continues to decline linearly over time (WFC3 ISR 2013-03).

  The CTE correction step uses it’s own dark reference files which have themselves been corrected for CTE. The specific reference file used for any dataset may be found in the image header keyword DRKCFILE. This step also uses a special bias reference file as part of the CTE correction itself, referred to in the header by the BIACFILE keyword. This BIACFILE is only used to facilitate the CTE correction, the resulting corrected image then uses the normal BIASFILE to correct the science frame after the CTE correction has been performed. After the CTE correction has been performed and the data progresses through the rest of the pipeline, the special CTE corrected dark, DRKCFILE in the header, will be used for the dark current correction instead of the DARKFILE.

  There is a PCTETAB refrence file which contains extensions of calibration images and tables of parameters used during the CTE correction stage. The header of this file also contains parameters for the CTE correction algorithm. These parameters, and important scalars which are used to correct the data are stored in the output image headers. See the UVIS2.0 reference ISR for more information.

  This routine performs the CTE correction on raw data files. The calibration step keyword is PCTECORR, if this is set to PERFORM then the CTE correction will be applied to the dataset. Some caveats for its use:

  - CTE corrections can ONLY be performed on RAW data which has not been calibrated in any way.
  - Data which have already been through BLEVCORR, BIASCORR or DARKCORR will be rejected.
  - The CTE correction step in the pipeline is currently only implemented for FULL FRAME images

  The standalone call will produce a RAC fits file by default. This contains only the CTE corrected data, no other calibrations have been performed.

  For more information the the WFC3 CTE please see the WFC3 CTE webpage .

  Example:

  > In Python without TEAL:

  >     >>> from wfc3tools import wf3cte
  >     >>> wf3cte(filename)

  > In Python with TEAL:

  >     >>> from stsci.tools import teal
  >     >>> from wfc3tools import wf3cte
  >     >>> teal.teal('wf3cte')

  > In Pyraf:

  >     >>> import wfc3tools
  >     >>> epar wf3cte

  Parameters:

  > input : str

  >   Name of input files

  >   > - a single filename (`iaa012wdq_raw.fits`)
  >   > - a Python list of filenames
  >   > - a partial filename with wildcards (`\*raw.fits`)
  >   > - filename of an ASN table (`\*asn.fits`)
  >   > - an at-file (`@input`)

  > -1 : value, as in minus one, this will make sure only 1 processor/thread is used during processing, otherwise all available are used.

  > verbose: bool, optional
  >   Print verbose time stamps?

  The wf3cte function can also be called directly from the OS command line:

      >>> wf3cte.e input  [-options]

  Where the OS options include:

  - -v: verbose
  - -1: turn off multiprocessing

## wfc3tools.wf3ir module

`wfc3tools.wf3ir.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.wf3ir.``help`(file=None)

  Print out syntax help for running wf3ir

`wfc3tools.wf3ir.``run`(configobj=None)

  TEAL interface for the `wf3ir` function.

`wfc3tools.wf3ir.``wf3ir`(input, output='', verbose=False, quiet=True)

  wf3ir Version 1.3.1 updated on unspecified

  wf3ir:

  Use this function to facilitate batch runs or for the TEAL interface.

  This routine contains all the instrumental calibration steps for WFC3 IR channel images. The steps are:

  > - DQICORR - initialize the data quality array
  > - ZSIGCORR - estimate the amount of signal in the zeroth-read
  > - BLEVCORR - subtact the bias level from the reference pixels
  > - ZOFFCORR - subtract the zeroth read image
  > - NLINCORR - correct for detector non-linear response
  > - DARKCORR - subtract the dark current image
  > - PHOTCORR - compute the photometric keyword values
  > - UNITCORR - convert to units of count rate
  > - CRCORR - fit accumulating signal and identify the cr hits
  > - FLATCORR - divide by the flatfield images and apply gain coversion

  The output images include the calibrated image ramp (ima file) and the accumulated ramp image (flt file)

  Only those steps with a switch value of PERFORM in the input files will be executed, after which the switch will be set to COMPLETE in the corresponding output files.

  Examples:

  > In Python without TEAL:

  >     >>> from wfc3tools import wf3ir
  >     >>> wf3ir(filename)

  > In Python with TEAL:

  >     >>> from stsci.tools import teal
  >     >>> from wfc3tools import wf3ir
  >     >>> teal.teal('wf3ir')

  > In Pyraf:

  >     >>> import wfc3tools
  >     >>> epar wf3ir

  Parameters:

  > input : str

  >   Name of input files

  >   > - a single filename (`iaa012wdq_raw.fits`)
  >   > - a Python list of filenames
  >   > - a partial filename with wildcards (`\*raw.fits`)
  >   > - filename of an ASN table (`\*asn.fits`)
  >   > - an at-file (`@input`)

  > output: str
  >   Name of the output FITS file.
  > verbose: bool, optional
  >   Print verbose time stamps?
  > quiet: bool, optional
  >   Print messages only to trailer file?

  The wf3ir function can also be called directly from the OS command line:

      >>> wf32ir.e input output [-options]

  Where the OS options include:

  - -v: verbose
  - -f: print time stamps

## wfc3tools.wf3rej module

`wfc3tools.wf3rej.``getHelpAsString`(docstring=False)

  Return documentation on the ‘wf3ir’ function. Required by TEAL.

`wfc3tools.wf3rej.``help`(file=None)

`wfc3tools.wf3rej.``run`(configobj=None)

  TEAL interface for the `wf3rej` function.

`wfc3tools.wf3rej.``wf3rej`(input, output='', crrejtab='', scalense='', initgues='', skysub='', crsigmas='', crradius=0, crthresh=0, badinpdq=0, crmask=False, shadcorr=False, verbose=False)

  wf3rej Version 1.3.1 updated on 12-Jul-2013

  wf3rej:

  This calls the wf3rej executable. Use this function to facilitate batch runs or for the TEAL interface.

  Example:

  In Python without TEAL:

      >>> from wfc3tools import wf3rej
      >>> wf3rej(filename)

  In Python with TEAL:

      >>> from stsci.tools import teal
      >>> from wfc3tools import wf3rej
      >>> teal.teal('wf3rej')

  In Pyraf:

      >>> import wfc3tools
      >>> epar wf3rej

  Parameters:

  input : str, Name of input files

  > - a single filename (`iaa012wdq_raw.fits`)
  > - a Python list of filenames
  > - a partial filename with wildcards (`\*raw.fits`)
  > - filename of an ASN table (`\*asn.fits`)
  > - an at-file (`@input`)

  output : str, Name of the output FITS file.

  crrejtab : string, reference file name

  scalense : string, scale factor applied to noise

  initgues : string, intial value estimate scheme (min|med)

  skysub : string, how to compute the sky (none|mode|mean)

  crsigmas : string, rejection levels in each iteration

  crradius : float, cosmic ray expansion radius in pixels

  crthresh : float, rejection propagation threshold

  badinpdq : int, data quality flag bits to reject

  crmask : bool, flag CR in input DQ imageS?

  shadcorr : bool, perform shading shutter correction?

  verbose : bool, optional, Print verbose time stamps?

  The wf3rej executable can also be called directly from the OS command line prompt:

      >>> wf3rej.e input output [-options]

  Input can be a single file, or a comma-delimited list of files.

  Where the OS options include:

  - t: print the timestamps
  - v: verbose
  - shadcorr: perform shading shutter correction?
  - crmask: flag CR in input DQ images?
  - table <filename>: the crrejtab filename
  - scale <number>: scale factor for noise
  - init <med|min>: initial value estimate scheme
  - sky <none|median|mode>: how to compute sky
  - sigmas: rejection leves for each iteration
  - radius <number>: CR expansion radius
  - thresh <number> : rejection propagation threshold
  - pdq <number>: data quality flag bits to reject

## Module contents

The wfc3tools package holds Python tasks useful for analyzing WFC3 data.

These tasks include:

Utility and library functions used by these tasks are also included in this module.