Keith's blog on XSPEC, related software and anything else I need to remember

Thursday, May 18, 2006

xspec 12 start-up script

Eliminated the xspec v12 start-up script so that we just need the executable. The XSPECROOT environment variable is not used anywhere. SPECTRAL is used by routines in Global.cxx and XSGlobal.cxx where it can be replaced by HEADAS. POW_LIBRARY is set in headas-init. TCLRL_LIBRARY is used in xspec.cxx but the information it contains is available in tclreadline.h so just include that. The PGPLOT variables can all be removed once we merge the versions of pgplot under the Xspec and tcltk trees. The difference is Ben's PS driver. This uses PGPLOT_DIR for the directory containing pgprolog.ps - at the moment this is in the bin directory but should be moved to lib. PGPLOT_FONT is the font file which is an ASCII file in the Xspec tree and a binary unformatted file in the tcltk tree.

Fixed Ben's PS driver so that it is no longer necessary to set PGPLOT_PS_BBOX to MAX to avoid the chance of text being lost outside the bounding box. The trick is to have GRTEXT perform all the operations used for other devices which divide text up into line segments but not actually draw any of the lines. This ensures that the bounding box is set correctly. Thetext is then written to the PostScript output. Also changed the write text option from IFUNC=30 to 31 because 30 is used for scrolling a rectangle in the X-window driver. The functions in src/grpssy.f are properly part of the PS driver so appended them to the end of psdriv.f.

Note that writing text the way we do at the moment does not conform to the pgplot architecture since it requires an explicit test for a PS device type in the routine grtext, which ought to be device-independent. The correct way to handle this is to define a new driver attribute to specify whether text needs to be split into line segments or can be written directly by the driver. grtext would then query this attribute rather than check for a specific device type.

PGPLOT_PS_BBOX should be set to MAX for Ben's PS driver otherwise text may end up lost off the edge of the bounding box.

Note that Ben's PS driver pretty clearly subverts the way that PGPLOT works. In standard drivers the text is written by drawing lines. Since PS handles text internally Ben set up a device-dependent diversion in GRTEXT to pass the text to the driver (using IFUNC=30). One consequence of this is that the bounding box variables (BBXMIN etc) are not updated for the position of the text hence the need to set PGPLOT_PS_BBOX. This ought to be fixable.