reconstruct_ifu – Reconstruct the IFU image

Reconstruct the IFU

exception pyhetdex.het.reconstruct_ifu.ReconstructIOError[source]

Error when the name and/or number fiber extracted file names is not correct

exception pyhetdex.het.reconstruct_ifu.ReconstructValueError[source]

Errors for wrong combinations of input parameters in ReconstructedIFU or from_files()

exception pyhetdex.het.reconstruct_ifu.RecontructIndexError[source]

Error for miss-matching the number of fibers in the ifu center files and the fiber extracted ones

class pyhetdex.het.reconstruct_ifu.ReconstructedIFU(ifu_center, dither, fextract=None, fe_prefix='')[source]

Reconstructed IFU head image from the fiber extracted frames given the ifu_center and the dither.

Parameters:

ifu_center : instance of IFUCenter

fiber number to fiber position mapping

dither : instance child of _BaseDither

dither relative position, illumination, image quality

fextract : None or list of fits files, optional

  • if None the list of files is inferred from dither.basename;
  • if not None must have ndither x nchannels elements. The channel name and dither number are extracted from the CCDPOS and the DITHER header keywords

fe_prefix : string, optional

when getting the names from the dither file, prepend fe_prefix to the basename

Raises:

ReconstructValueError

if an empty dither is passed and fextract is None

ReconstructIOError

if the number and/or number of fiber extracted frames is not correct; raised by _fedict()

RecontructIndexError

if the number of fibers from the fiber extracted files and from the ifu center files do not match; raised by _reconstruct()

Attributes

ifu_center  
dither  
x, y (1-dimensional arrays) x and y position of the fibers
flux (list of 2-dimensional arrays) each element is the content of one fiber extracted file
header (list of dictionaries) each element contains the CRVAL1 and CDELT1 keywords :value pairs from the headers of the fiber extracted files; used to determine the wavelength range in reconstruct()
_fedict(fextract)[source]

Organize the fiber extracted file names into a dictionary

Parameters:

fextract : None or list of string

If None get the file names from the dither, otherwise from the fextract list

Returns:

dfextract : dict

dictionary of fiber extracted frames

_reconstruct(dfextract)[source]

Read the fiber extracted files and creates a set of three lists for x, y and flux.

Parameters:

dfextract : dictionary

name of the fiber extracted file

classmethod from_files(ifu_center_file, dither_file=None, fextract=None, fe_prefix='')[source]

Read and parse the file

Parameters:

ifu_center_file : string

file containing the fiber number to fiber position mapping

dither_file : string, optional

file containing the dither relative position. If not given, a singe dither is assumed

fextract : None or list of fits files, optional

if None the list of files is inferred from the second column of the dither_file; if not None must have ndither x nchannels elements. The channel name and dither number are extracted from the CCDPOS and the DITHER header keywords

fe_prefix : string, optional

when getting the names from the dither file, prepend fe_prefix to the basename

Raises:

ReconstructValueError

if both dither_file and fextract are None

ReconstructValueError, ReconstructIOError

Notes

if dither_file is None, fextract must contain a number of files equal to the number of channels (2)

reconstruct(wmin=None, wmax=None)[source]

Returns the reconstructed IFU with the flux computed between [wmin, wmax]

Parameters:

wmin, wmax : float, optional

min and max wavelength to use. If None: use the min and/or max from the file

Returns:

x, y : 1d arrays

x and y position of the fibers

flux : 1d array

flux of the fibers within wmin and wmax

xpos(channel, dither)[source]

get the position for the x dither in channel

Parameters:

channel : string

name of the channel [L, R]

dither : string

name of the dither [D1, D2, ..]

Returns:

ndarray

x position of the fibers for the given channel and dither

ypos(channel, dither)[source]

get the position for the y dither in channel

Parameters:

channel : string

name of the channel [L, R]

dither : string

name of the dither [D1, D2, ..]

Returns:

ndarray

y position of the fibers for the given channel and dither