Skip to content

Commit

Permalink
minor: docstring improvements, remove extra whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrin committed Jan 23, 2015
1 parent 0ce63fb commit 56963b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
29 changes: 20 additions & 9 deletions poppy/poppy_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def _propagateMFTinverse(self, pupil, pupil_npix=None):
msg= ' Propagating w/ InvMFT: %.4f"/pix fov=%.3f lam/D pupil npix=%d' % (self.pixelscale, det_fov_lamD, pupil_npix)
_log.debug(msg)
self.history.append(msg)
det_offset = (0,0) # det_offset not supported for InvMFT
det_offset = (0,0) # det_offset not supported for InvMFT (yet...)

self.wavefront = mft.inverse(self.wavefront, det_fov_lamD, pupil_npix)
self._last_transform_type = 'InvMFT'
Expand Down Expand Up @@ -2224,7 +2224,16 @@ def display(self, nrows=1, row=1, **kwargs):

class Detector(OpticalElement):
""" A Detector is a specialized type of OpticalElement that forces a wavefront
onto a specific fixed pixelization.
onto a specific fixed pixelization of an Image plane.
This class is in effect just a metadata container for the desired sampling;
all the machinery for transformation of a wavefront to that sampling happens
within Wavefront.
Note that this is *not* in any way a representation of real noisy detectors;
no model for read noise, imperfect sensitivity, etc is included whatsoever.
Parameters
----------
Expand All @@ -2233,19 +2242,21 @@ class Detector(OpticalElement):
pixelscale : float
Pixel scale in arcsec/pixel
fov_pixels, fov_arcsec : float
The field of view may be specified either in arcseconds or by a number of pixels. Either is acceptable
and the pixel scale is used to convert as needed. You may specify a non-square FOV by providing two elements in an iterable.
Note that this follows the usual Python convention of ordering axes (Y,X), so put your desired Y axis size first.
The field of view may be specified either in arcseconds or by a number
of pixels. Either is acceptable and the pixel scale is used to convert
as needed. You may specify a non-square FOV by providing two elements in
an iterable. Note that this follows the usual Python convention of
ordering axes (Y,X), so put your desired Y axis size first.
oversample : int
Oversampling factor beyond the detector pixel scale
offset : tuple (X,Y)
Offset for the detector center relative to a hypothetical off-axis PSF. Specifying this lets you
pick a different sub-region for the detector to compute, if for some reason you are computing a small
subarray around an off-axis source. (Has not been tested!)
Offset for the detector center relative to a hypothetical off-axis PSF.
Specifying this lets you pick a different sub-region for the detector
to compute, if for some reason you are computing a small subarray
around an off-axis source. (Has not been tested!)
"""
def __init__(self, pixelscale, fov_pixels=None, fov_arcsec=None, oversample=1, name="Detector", offset=None, **kwargs):

OpticalElement.__init__(self,name=name, planetype=_DETECTOR, **kwargs)
self.pixelscale = float(pixelscale)
self.oversample = oversample
Expand Down
4 changes: 2 additions & 2 deletions poppy/tests/test_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_parity_FFT_forward_inverse(display = False):
sys.addPupil()
sys.addDetector(pixelscale=0.010, fov_arcsec=1)

psf, planes = sys.calcPSF(display=display, oversample=1, return_intermediates=True)
psf, planes = sys.calcPSF(display=display, oversample=1, return_intermediates=True)

# the wavefronts are padded by 0s. With the current API the most convenient
# way to ensure we get unpadded versions is via the asFITS function.
Expand All @@ -194,7 +194,7 @@ def test_parity_FFT_forward_inverse(display = False):
# for checking the overall parity it's sufficient to check the intensity.
# we can have arbitrarily large differences in phase for regions with
# intensity =0, so don't check the complex field or phase here.

absdiff = (np.abs(p0[0].data - p2[0].data))
maxabsdiff = np.max(absdiff)
assert (maxabsdiff < 1e-10)
Expand Down

0 comments on commit 56963b6

Please sign in to comment.