Package wfpc2tools :: Module wfpc2destreak
[hide private]
[frames] | no frames]

Module wfpc2destreak

source code


Version: 2.2 (2010 March 12)

Classes [hide private]
  Wfpc2destreak
Calculate magnitude of and remove streaks from specified group of wfpc2 data.
Functions [hide private]
 
check_py_pars(input_file, group, bias_thresh, row_thresh, input_mask, niter)
When run under python, verify that each unspecified parameter should take the default value, and give the user the opportunity to change it.
source code
int, float, float, int
check_cl_pars(input_file, group, bias_thresh, row_thresh, input_mask, niter)
When run from linux command line, verify that each parameter is valid.
source code
 
cr_reject(SubArray, niter)
Identify and replace cosmic rays in the given subarray.
source code
Int32
check_neighbors(new_cr, residual, cutoff, sub_shape)
Check for cosmic rays in neighboring pixels.
source code
float
median(y, mask)
Return the median of the array y, ignoring masked elements.
source code
tuple of two floats
fitline(x, y, mask)
Fit a straight line to y vs x, where mask is 0.
source code
 
update_header(self, hdr, verbosity)
update header from input c0 file with specified header, and updated data
source code
 
write_mask(data, filename)
write specified mask
source code
 
write_to_file(data, filename, hdr, verbosity, im_mean, im_sigma) source code
Variables [hide private]
  NUM_SIG = 2.5
  TOT_ITER = 4
  ERROR_RETURN = 2
  __package__ = 'wfpc2tools'

Imports: pyfits, N, boxcar, pytools, OptionParser, ndimage, fileutil, wfpc2util, opusutil, sys, string


Function Details [hide private]

check_py_pars(input_file, group, bias_thresh, row_thresh, input_mask, niter)

source code 
When run under python, verify that each unspecified parameter should take the default value, and
    give the user the opportunity to change it.

@param input_file: name of input file
@type input_file: string
@param group: number of group to process
@type group: int
@param bias_thresh: bias threshold (no correction will be performed if this is exceeded by im_mean)
@type bias_thresh: float
@param row_thresh: row threshold (no correction will be performed if this exceeds the calculated row correction)
@type row_thresh: float
@param input_mask: name of input mask
@type input_mask: string
@param niter: number of CR rejection iterations   
@type niter: int
@return: group, row_thresh,
@return: group, bias_thresh, row_thresh
@rtype:  int, float, float

check_cl_pars(input_file, group, bias_thresh, row_thresh, input_mask, niter)

source code 

When run from linux command line, verify that each parameter is valid.

Parameters:
  • input_file (string) - name of input file
  • group (int) - number of group to process
  • bias_thresh (float) - bias threshold (no correction will be performed if this is exceeded by im_mean)
  • row_thresh (float) - row threshold (no correction will be performed if this exceeds the calculated row correction)
  • input_mask (string) - name of input mask file
  • niter (int) - number of CR rejection iterations
Returns: int, float, float, int
group, row_thresh, niter

cr_reject(SubArray, niter)

source code 

Identify and replace cosmic rays in the given subarray.

Parameters:
  • SubArray (ndarray) - subarray of the data
  • niter (int) - the number of iterations used when rejecting cosmic rays

check_neighbors(new_cr, residual, cutoff, sub_shape)

source code 

Check for cosmic rays in neighboring pixels.

Parameters:
  • new_cr (Int32) - 1-D array of ones or zeros (1 indicates a cosmic ray)
  • residual (Float64) - 1-D array of residuals, subarray - fit
  • cutoff (float) - criterion for flagging an outlier as a cosmic ray
  • sub_shape (tuple) - numbers of lines and columns in subarray
Returns: Int32
new_cr, possibly with additional cosmic rays flagged

median(y, mask)

source code 

Return the median of the array y, ignoring masked elements.

Parameters:
  • y (Float64) - array of values
  • mask (Int32) - array of ones or zeros (0 indicates a good value)
Returns: float
median of y, ignoring masked elements

fitline(x, y, mask)

source code 

Fit a straight line to y vs x, where mask is 0.

Parameters:
  • x (Float64) - array of independent-variable values
  • y (Float64) - array of dependent-variable values
  • mask (Int32) - array of ones or zeros (0 indicates a good value)
Returns: tuple of two floats
coefficients of fit, the slope and intercept

update_header(self, hdr, verbosity)

source code 

update header from input c0 file with specified header, and updated data

Parameters:
  • hdr (Pyfits header object) - header
  • verbosity (string) - verbosity level (0 for quiet, 1 verbose, 2 very verbose)

write_mask(data, filename)

source code 

write specified mask

Parameters:
  • data (array of floats) - mask array
  • filename - mask file name
  • verbosity (string) - verbosity level (0 for quiet, 1 verbose, 2 very verbose)

write_to_file(data, filename, hdr, verbosity, im_mean, im_sigma)

source code 
Parameters:
  • data (array of floats) - array
  • filename - mask file name
  • hdr (Pyfits header object) - header
  • verbosity (string) - verbosity level (0 for quiet, 1 verbose, 2 very verbose)
  • im_mean (float) - clipped mean of image region
  • im_sigma (float) - clipped sigma of image region