hipercam.window

CCD window modules

Defines classes to represent sub-windows of a CCD and associated functions.

Classes summary

Winhead(llx, lly, nx, ny, xbin, ybin, outamp)

The header parts of a CCD window

Window(win[, data, copy])

A CCD window, headers, position and data

CcdWin([wins])

All the Winhead objects of a single CCD.

MccdWin([wins])

All the Winhead objects for multiple CCDs.

class hipercam.window.Winhead(llx, lly, nx, ny, xbin, ybin, outamp, head=None, copy=False)

Bases: hipercam.header.Header

The header parts of a CCD window

Winhead objects contain everything needed to represent a CCD window other than its data. This represents an arbitrary rectangular region of binned pixels. The lower-left pixel of the CCD is assumed to have coordinates (x,y) = (1,1). Winhead dimensions are in binned pixels.

>>> from hipercam import Winhead
>>> win = Winhead(12, 6, 100, 150, 2, 3)
>>> print(win)
Attributes
llxint

X ordinate lower-left pixel, unbinned pixels

llyint

Y ordinate lower-left pixel, unbinned pixels

xbinint

X-binning factor

ybinint

Y-binning factor

nxint

Binned X-dimension of the Winhead.

nyint

Binned Y-dimension of the Winhead.

outampstr, {‘’,’LL’,’LR’,’UL’,’UR’}

output amplifier location

urxint

Unbinned X pixel at upper-right of Winhead

uryint

Unbinned Y pixel at upper-right of Winhead

xlofloat

Left-hand edge of window (llx-0.5)

xhifloat

Right-hand edge of window (urx+0.5)

ylofloat

Bottom edge of window (lly-0.5)

yhifloat

Top edge of window (ury+0.5)

class hipercam.window.Window(win, data=None, copy=False)

Bases: hipercam.window.Winhead

A CCD window, headers, position and data

Constructed from a Winhead and a numpy.ndarray which is stored in an attribute called data.

>>> import numpy as np
>>> from hipercam import Winhead, Window
>>> win = Winhead(12, 6, 100, 150, 2, 3, 'LL')
>>> data = np.ones((150,100))
>>> wind = Window(win,data)
>>> wind += 0.5
>>> wind *= 2

You cannot directly change the nx, ny values of a Window; you have to change its data array attribute and nx and ny will be taken from it.

Window objects support various arithematical operations such as subtraction or addition of constants. The end result of these always has a float type for safety to avoid problems with e.g. trying to make the result of adding a float to an integer an integer or with the range of integers.

Parameters
winWinhead

the Winhead defining the position and, optionally, headers

data2D numpy.ndarray

the data (2D). The dimensions must match those in win unless data is None in which case a zero array of the correct size will be created. A ValueError will be raised if not. Standard C-type ordering, y-then-x assumed.

copybool

flag sent to Winhead controlling whether the header is copied by value or reference. ‘False’ is lightweight and faster but when building up CCDs from multiple Windows, you should probably use ‘True’ unless you are careful to make ‘win’ a different object every time.

class hipercam.window.CcdWin(wins={})

Bases: hipercam.group.Group

All the Winhead objects of a single CCD.

Acts as a container for all of the window formats of a CCD.

Parameters
winsGroup(Winhead)

All of the Winhead objects

class hipercam.window.MccdWin(wins={})

Bases: hipercam.group.Group

All the Winhead objects for multiple CCDs.

Parameters
winsGroup(CcdWin)

All of the CcdWin objects