TwiceAsNice  2019-02-18
Public Member Functions | Public Attributes | List of all members
CalcTheoretical.CalcTheoretical Class Reference
Inheritance diagram for CalcTheoretical.CalcTheoretical:
Inheritance graph
Collaboration diagram for CalcTheoretical.CalcTheoretical:
Collaboration graph

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def CalcTheoretical.CalcTheoretical.__init__ (   self)

Member Function Documentation

◆ doDone()

def CalcTheoretical.CalcTheoretical.doDone (   self)

◆ genPSF()

def CalcTheoretical.CalcTheoretical.genPSF (   self)

◆ initUI()

def CalcTheoretical.CalcTheoretical.initUI (   self)
Initializes the GUI, especially attaching widgets to routines 

◆ initVar()

def CalcTheoretical.CalcTheoretical.initVar (   self)
Initializes important variables

◆ logStatus()

def CalcTheoretical.CalcTheoretical.logStatus (   self,
  theText 
)

UTILITY routines.

◆ psfZin()

def CalcTheoretical.CalcTheoretical.psfZin (   self)

◆ psfZout()

def CalcTheoretical.CalcTheoretical.psfZout (   self)

◆ pupZin()

def CalcTheoretical.CalcTheoretical.pupZin (   self)

◆ pupZout()

def CalcTheoretical.CalcTheoretical.pupZout (   self)

◆ savePSF()

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/

◆ stuffPup()

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.

◆ togImg()

def CalcTheoretical.CalcTheoretical.togImg (   self)

◆ togMono()

def CalcTheoretical.CalcTheoretical.togMono (   self)

◆ togPoly()

def CalcTheoretical.CalcTheoretical.togPoly (   self)

◆ togRad()

def CalcTheoretical.CalcTheoretical.togRad (   self)

Member Data Documentation

◆ cThSaved

CalcTheoretical.CalcTheoretical.cThSaved

Assemble Header.

Get file name and write... Set flags that all is well

◆ fPSF

CalcTheoretical.CalcTheoretical.fPSF

Monochromatic case - evaluate at self.lam0.

◆ lam0

CalcTheoretical.CalcTheoretical.lam0

◆ psf

CalcTheoretical.CalcTheoretical.psf

DBG.

STUFF THEORETICAL PSF (see doc)

END DBG

◆ psfScn

CalcTheoretical.CalcTheoretical.psfScn

◆ pup

CalcTheoretical.CalcTheoretical.pup

◆ pupScn

CalcTheoretical.CalcTheoretical.pupScn

Push Buttons.

Other UI Elements Create QGraphics Scenes to display pupil and psf

◆ pxScl

CalcTheoretical.CalcTheoretical.pxScl

◆ rIn

CalcTheoretical.CalcTheoretical.rIn

◆ rOut

CalcTheoretical.CalcTheoretical.rOut

Grab values from UI.

◆ scrnPup

CalcTheoretical.CalcTheoretical.scrnPup

◆ ui

CalcTheoretical.CalcTheoretical.ui

◆ zoomInFactor

CalcTheoretical.CalcTheoretical.zoomInFactor

◆ zoomOutFactor

CalcTheoretical.CalcTheoretical.zoomOutFactor

The documentation for this class was generated from the following file: