pynrc.reduce.ref_pixels.NRC_refs

class pynrc.reduce.ref_pixels.NRC_refs(data, header, DMS=False, altcol=True, do_all=False, **kwargs)[source]

Bases: object

Reference pixel correction object

Object class for reference pixel correction of NIRCam data (single integration). Specify the data cube, header, and whether or not the header is in DMS format.

General usage of functions:

  1. Create instance: ref = NRC_refs(data, header)

  2. Determine reference offset values: ref.calc_avg_amps(). Stored at ref.refs_amps_avg.

  3. Fix amplifier offsets: ref.correct_amp_refs(). Removes offsets that are stored at ref.refs_amps_avg.

  4. Determine average of column references tracking 1/f noise: ref.calc_avg_cols(). Reference values offset for a mean value of 0. Averages are stored at ref.refs_side_avg.

  5. Optimal smoothing of side reference values: ref.calc_col_smooth(). Stores smoothed version at ref.refs_side_smth.

  6. Remove approximation of 1/f noise: ref.correct_col_refs().

Parameters
  • data (ndarray) – Input datacube. Can be two or three dimensions (nz,ny,nx).

  • header (obj) – NIRCam Header associated with data.

  • DMS (bool) – Is the header in DMS format?

  • altcol (bool) – Calculate separate reference values for even/odd columns? Default=True.

  • do_all (bool) – Perform the default pixel correction procedures.

__init__(data, header, DMS=False, altcol=True, do_all=False, **kwargs)[source]

Methods

__init__(data, header[, DMS, altcol, do_all])

calc_avg_amps([top_ref, bot_ref])

Calculate amplifier averages

calc_avg_cols([left_ref, right_ref, avg_type])

Calculate average of column references

calc_col_smooth([perint, edge_wrap, savgol])

Optimal smoothing of side reference pixels

correct_amp_refs([supermean])

Correct amplifier offsets

correct_col_refs()

Remove 1/f noise from data

Attributes

multiaccum

A multiaccum object

multiaccum_times

Exposure timings in dictionary

refs_bot

Return raw bottom reference values

refs_left

Return raw left reference values

refs_right

Return raw right reference values

refs_top

Return raw top reference values

calc_avg_amps(top_ref=True, bot_ref=True)[source]

Calculate amplifier averages

Save the average reference value for each amplifier in each frame. Each array has a size of (namp, ngroup). Average values are saved at self.refs_amps_avg.

Parameters
  • top_ref (bool) – Include top reference rows when correcting channel offsets.

  • bot_ref (bool) – Include bottom reference rows when correcting channel offsets.

calc_avg_cols(left_ref=True, right_ref=True, avg_type='frame', **kwargs)[source]

Calculate average of column references

Create a copy of the left and right reference pixels, removing the average value of the reference pixels on an int, frame, or pixel basis. Do this after correcting the amplifier offsets with correct_amp_refs(). Averages are stored in self.refs_side_avg.

Parameters
  • left_ref (bool) – Include left reference cols when correcting 1/f noise.

  • right_ref (bool) – Include right reference cols when correcting 1/f noise.

  • avg_type (str) – Type of ref col averaging to perform. Allowed values are ‘pixel’, ‘frame’, or ‘int’.

  • mean_func (func) – Function to use to calculate averages of reference columns

calc_col_smooth(perint=False, edge_wrap=False, savgol=False, **kwargs)[source]

Optimal smoothing of side reference pixels

Geneated smoothed version of column reference values. Uses calc_avg_cols() to determine approx 1/f noise in data and store in self.refs_side_smth.

Parameters
  • perint (bool) – Smooth side reference pixel per int, otherwise per frame.

  • edge_wrap (bool) – Add a partial frames to the beginning and end of each averaged time series pixels in order to get rid of edge effects.

correct_amp_refs(supermean=False)[source]

Correct amplifier offsets

Use values in self.refs_amps_avg to correct amplifier offsets.

Parameters

supermean (bool) – Add back the overall mean of the reference pixels.

correct_col_refs()[source]

Remove 1/f noise from data

Correct 1/f noise using the approximation stored in self.refs_side_smth.

property multiaccum

A multiaccum object

property multiaccum_times

Exposure timings in dictionary

property refs_bot

Return raw bottom reference values

property refs_left

Return raw left reference values

property refs_right

Return raw right reference values

property refs_top

Return raw top reference values