install poppy and astropy and picloud locally:

 http://docs.astropy.org/en/stable/install.html:
 $ pip install --no-deps astropy

 http://www.stsci.edu/~mperrin/software/poppy/:
 $ pip install poppy --upgrade

 https://www.picloud.com/accounts/start/:
 $ sudo pip install cloud


sign up for picloud: http://docs.picloud.com/

$ picloud setup

On the website setup a picloud Ubuntu 12.04 environment named "poppy".

http://docs.picloud.com/environment.html

from the configuration console in that environment, install FFTW and astropy:

  sudo apt-get install fftw3
  sudo pip install astropy

then jusy run the code below.

In [2]:
import poppy 
import astropy
import cloud
import matplotlib.pyplot as plt
WARNING: No thermal tables found, no thermal calculations can be performed. No files found for /Users/edouglas/Documents/projects/PICTURE/synphot/mtab/*_tmt.fits. [pysynphot.refs]
In [2]:
 
In [2]:
 
In [2]:

In [3]:
def psf(wavelength):
    osys = poppy.OpticalSystem(oversample=10)
    osys.addPupil(function='Circle', radius=.25,pad_factor = 1.0) # pupil radius in meters
    osys.addDetector(pixelscale=0.18, fov_arcsec=23)  # image plane coordinates in arcseconds
    return osys.calcPSF(wavelength,display_intermediates=False)
In [4]:
wavelength=0.633e-6
manywaves=400e-9 + 1e-8*np.arange(10,41) #400 to 800  nm
x=cloud.call(psf,wavelength,_env='poppy',_profile=True)
multiwave=cloud.result(cloud.map(psf,manywaves,_env='poppy',_profile=True))
In [5]:
poppy.display_PSF(cloud.result(x))
In [6]:
#add up the returned psfs for each wavlength:
summed=np.sum([(wave[0].data) for wave in multiwave[:]],axis=0)
   
imshow(log10(summed))
Out[6]:
<matplotlib.image.AxesImage at 0x10d8e0c50>

save as fits file to local disk:

In [10]:
hdufieldresult = astropy.io.fits.HDUList(astropy.io.fits.PrimaryHDU(np.array(summed)))
hdufieldresult.writeto('summed.fits')
In [ ]: