require ("fits");
require ("wcsfuns");
require ("imageplot");

define slsh_main ()
{
   variable file = "acis_cti_evt1a_MEG_all.fits";
   variable img = fits_read_img (file);
   variable wcs = fitswcs_get_img_wcs (file);
   variable dims = array_shape (img);
   variable nx = dims[1], ny = dims[0];
   variable xgrid, ygrid;
   (,xgrid) = wcsfuns_deproject (wcs, Int_Type[nx], [1:nx]);
   (ygrid,) = wcsfuns_deproject (wcs, [1:ny], Int_Type[ny]);
   
   imageplot ("ordersort.png", img, "ds9sls"
	      ;title="\\verb|$file|"$,
	      xlabel="\large $m\lambda$"R,
	      ylabel="\large $m$"R,
	      xgrid=xgrid, 
	      ygrid=ygrid,
	      aspect=1,
	      xform="sqrt"
	     );
}
