def plotGlasses(): ''' ''' spat = np.arange(0.1, 100, 0.1) fig = plt.figure() ax = fig.add_subplot(111) pf.AxisFormat() pf.TufteAxis(ax, ['bottom', 'left']) ax.loglog(spat, gauss(spat, 15), 'k') ax.set_ylim([10 ** -5, 1.05]) ax.set_ylabel('transfer') ax.set_xlabel('spatial frequency (cycles / deg)') plt.tight_layout() plt.show()
def computeConeActivity(Analysis, ImageData, rec_field, cpd, _meta, _brownian=True, glasses=False): """Compute the estimated activity of a cone photoreceptor. :param Receptive_Field: a handle to the spline fitted receptive field. :type Receptive_Field: function handle. """ Rec_Field = (rec_field[540]['fft'] / rec_field['max']) ImageData['fitLaw'] = ImageData['powerlaw'](cpd[1:]) powerlaw = ImageData['fitLaw'] if _brownian: temp = np.arange(1, 80) movement_filter = brownian_motion(cpd[1:], temp) powerlaw *= movement_filter # compute the diffraction limited case seperately diffract = {} diff, _x = o.diffraction(_meta['samples'], _meta['pupil_size'], 16.6, ref_index=1.4, wavelength=550.0) # now interpolate mtf into cpd's of analysis: mtf = np.interp(cpd, _x, diff) # remove zeros to avoid errors in future computations: ind = np.where(mtf != 0)[0] diffract['cpd'] = cpd[ind] diffract['mtf'] = mtf[ind] diffract['preCone'] = (powerlaw[ind] * diffract['mtf'][ind]) diffract['retina'] = (diffract['preCone'] * Rec_Field[ind]) if glasses: # if glasses on, compute effect after diffraction case powerlaw *= gauss(cpd[1:], 10) for key in Analysis: # find cone fft: wv = Analysis[key]['wavelength'] Rec_Field = (rec_field[wv]['fft'] / rec_field['max']) # generate MTFs for each condition: intensity = traceEye( Analysis[key]['dist'], Analysis[key]['off_axis'], Analysis[key]['pupil_size'], Analysis[key]['focus'], Analysis[key]['wavelength']) psf = o.genPSF(intensity, _meta['samples'])[1] Analysis[key]['mtf'] = o.genMTF(psf)[ind] Analysis[key]['preCone'] = (powerlaw[ind] * Analysis[key]['mtf']) Analysis[key]['retina'] = (Analysis[key]['preCone'] * Rec_Field[ind]) return Analysis, diffract