TwiceAsNice
2019-02-18
|
Public Member Functions | |
def | __init__ (self) |
def | initVar (self) |
def | initUI (self) |
def | stuffPup (self) |
def | genPSF (self) |
def | savePSF (self) |
def | doDone (self) |
def | logStatus (self, theText) |
UTILITY routines. More... | |
def | pupZin (self) |
def | pupZout (self) |
def | psfZin (self) |
def | psfZout (self) |
def | togRad (self) |
def | togImg (self) |
def | togMono (self) |
def | togPoly (self) |
Public Attributes | |
cThSaved | |
Assemble Header. More... | |
zoomInFactor | |
zoomOutFactor | |
ui | |
pupScn | |
Push Buttons. More... | |
psfScn | |
pup | |
scrnPup | |
pxScl | |
lam0 | |
rOut | |
Grab values from UI. More... | |
rIn | |
fPSF | |
Monochromatic case - evaluate at self.lam0. More... | |
psf | |
DBG. More... | |
Modal dialog to generate a theoretical PSF with Strehl = 1. The calculation proceeds as follows: 1. If the PSF is polychromatic, set up a loop to execute steps 2-4 below in sequence (the final PSF is the average of the wavelength slices). 2. Create the input pupil image, whose dimension is SR_Conf.tLarge. Note that the actual illuminated portion is usually considerably smaller (see doc). It also depends on wavelength, and hence for polychromatic PSFs, this must be done for each wavelength. Subroutine stuffPup does the actual work of stuffing ones and zeros into the input array. 3. Calculate the PSF (for that wavelength) using numpy.fft.rfft2 (see http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfft2.html) and then numpy.absolute to derive the modulus. See: http://docs.scipy.org/doc/numpy/reference/generated/numpy.absolute.html Note that the calculation has been scaled a factor SR_Conf.reSamp (typically 4) to minimize "sampling versus binning issues." See the doc. 4. If polychromatic, accumulate the average of the PSF. If using a stellar template, scale each slice using the effective temperature of the star. 5. Re-bin the PSF by the factor SR_Conf.reSamp. This brings the pixel scale to the correct value. 6. Scale the psf image values between 0.0 and 1.0 SUPERSEDED === 6. Calculate the total flux in the PSF within radius SR_Conf.fluxRad. Determine the peak value of the PSF. Both the total flux and peak value remain part of the PSF. === THIS IS NOW DONE WHEN LOADING THE THEORETICAL PSF! All of this happens when the user clicks "Generate PSF" Note also that the calculation involves re-binning, both to make small, onscreen versions of the pupil and psf and for step 5 above. Here is info on re-binning: Re-binning ==> b = a.reshape(tLarge//reSamp,reSamp,tLarge//reSamp,reSamp) reBin = b.mean(axis=3).mean(axis=1) see http://wiki.scipy.org/Cookbook/Rebinning and http://stackoverflow.com/questions/14916545/numpy-rebinning-a-2d-array Note that this dialog does not use the standard "Ok / Cancel" paradigm. Instead, the user interacts with the controls, generating and saving PSFs as desired. The interaction ends when (s)he presses "Done." At that point, the self.cThSaved flag indicates whether the last action was a save, and hence, whether SR_Conf.theoPSF contains the desired fits file name.
def CalcTheoretical.CalcTheoretical.__init__ | ( | self | ) |
def CalcTheoretical.CalcTheoretical.doDone | ( | self | ) |
def CalcTheoretical.CalcTheoretical.genPSF | ( | self | ) |
def CalcTheoretical.CalcTheoretical.initUI | ( | self | ) |
Initializes the GUI, especially attaching widgets to routines
def CalcTheoretical.CalcTheoretical.initVar | ( | self | ) |
Initializes important variables
def CalcTheoretical.CalcTheoretical.logStatus | ( | self, | |
theText | |||
) |
UTILITY routines.
def CalcTheoretical.CalcTheoretical.psfZin | ( | self | ) |
def CalcTheoretical.CalcTheoretical.psfZout | ( | self | ) |
def CalcTheoretical.CalcTheoretical.pupZin | ( | self | ) |
def CalcTheoretical.CalcTheoretical.pupZout | ( | self | ) |
def CalcTheoretical.CalcTheoretical.savePSF | ( | self | ) |
Prompts the user for a suitable file name and then writes out a FITS file containing the theoretical PSF. Note that this image has a size: SR_Conf.pSiz - typically 300 pixels across Note that the FITS write code comes from: http://docs.astropy.org/en/stable/io/fits/
def CalcTheoretical.CalcTheoretical.stuffPup | ( | self | ) |
Stuffs self.pup with the appropriate image, given the pupil parameters. This can be based on either the GUI parameters for radii, etc., or on an input image (not yet implemented). In order to speed things up (in my mind, perhaps), the calculation works with the squared distance, saving several millions of square roots.
def CalcTheoretical.CalcTheoretical.togImg | ( | self | ) |
def CalcTheoretical.CalcTheoretical.togMono | ( | self | ) |
def CalcTheoretical.CalcTheoretical.togPoly | ( | self | ) |
def CalcTheoretical.CalcTheoretical.togRad | ( | self | ) |
CalcTheoretical.CalcTheoretical.cThSaved |
Assemble Header.
Get file name and write... Set flags that all is well
CalcTheoretical.CalcTheoretical.fPSF |
Monochromatic case - evaluate at self.lam0.
CalcTheoretical.CalcTheoretical.lam0 |
CalcTheoretical.CalcTheoretical.psf |
DBG.
STUFF THEORETICAL PSF (see doc)
END DBG
CalcTheoretical.CalcTheoretical.psfScn |
CalcTheoretical.CalcTheoretical.pup |
CalcTheoretical.CalcTheoretical.pupScn |
Push Buttons.
Other UI Elements Create QGraphics Scenes to display pupil and psf
CalcTheoretical.CalcTheoretical.pxScl |
CalcTheoretical.CalcTheoretical.rIn |
CalcTheoretical.CalcTheoretical.rOut |
Grab values from UI.
CalcTheoretical.CalcTheoretical.scrnPup |
CalcTheoretical.CalcTheoretical.ui |
CalcTheoretical.CalcTheoretical.zoomInFactor |
CalcTheoretical.CalcTheoretical.zoomOutFactor |