#!/usr/bin/perl
#
# Compute values of the PSF at certain distances
#    for a set of common functions used to describe PSFs
#
# MWR 10/24/2016

use POSIX;


$debug = 1;

$I = 1.0;
$fwhm = 1.0;
$sigma = $fwhm/2.35;

$dx = $fwhm*0.5;

for ($x = 0; $x <= 5.0*$fwhm; $x += $dx) {

  # the simple gaussian
  $gauss = $I*exp(  0.0 - (($x*$x)/(2.0*$sigma*$sigma)) );
  $sqrt_gauss = sqrt($gauss);
  $mag_gauss = -2.5*log10($sqrt_gauss);

  printf "%8.3f  %9.4e %9.3e %6.3f    \n", $x, $gauss, $sqrt_gauss, $mag_gauss;


}


exit 0;


