Friday, February 26, 2010

Plotting updates

The plotting in xspec has been restructured for greater flexibility. The main changes are as follows:

1. Up to six plots can be put on a single page. eg "plot data resid ratio model"

2. There are options for the units on both x- and y-axis. "setplot energy" can now be used to plot the x-axis in keV, MeV, GeV, or Hz. "setplot wave" as the unit options angstrom, cm, micron, or nm. y-axis units are mostly modified in the obvious way depending on the x-axis choice. For setplot energy options any energies in the y-axis unit will be the same as chosen for the y-axis. The exception is for the choice of Hz when emodel/eufspec is in Jy and eemodel/eeufspec in ergs/cm^2/s. For setplot wave options energies in the y-axis unit are in ergs. An additional choice is available for setplot wave : the command "setplot wave perhz" will put y-axis units in /Hz. In this case the emodel/eufspec and eemodel/eeufspec units are the same as for setplot energy hz. The option can be turned off by "setplot wave perhz off".

3. "setplot redshift" can be used to shift energies in plots to the source frame assuming the redshift given. Note that this is not connected in any way to redshift parameters in the model and should only be used for illustrative purposes.

These changes are available in the Goddard development version and will be included in the next HEAsoft release.

5 comments:

Tsukasa said...

Dear Keith,

I wonder if a long-standing issue will be corrected. When I save a model using PLT command wd, sometimes lines are broken in weird places and minus signs are attached to previous number on the right. That is, I am getting lines, where instead of

number -number

I have two lines:

number-
number

So to deal with such files a complex sed editor call is needed to make them normal. It's apparently bug in PLT, and it's annoying for everyone who'd save plt data.

Keith Arnaud said...

@Tsukasa. I discussed this with the author of PLT and think the lines can be made longer. He notes that you can help the problem somewhat by changing the wdata command to eg "wdata myfile.qdp -2". This will limit the error numbers to two digits so allowing more columns within the 78 characters before the line wraps.

You can also use the "tclout plot" command to write out the contents of any array being plotted so this provides another way of outputting the plot data.

Tsukasa said...

Thanks Keith! So nice to have your reply here. I would say, why don't just make them as long as necessary, that is, do not introduce any wrap (note that the wrap behaves incorrectly anyway, as it attaches minus sign to previous digit).

Cheers, Askar Ibragimov
(Sabanci U., Istanbul/ Uni of Oulu, Finland)

Keith Arnaud said...

The minus sign is attached to show that the line is wrapping - it's a feature not a bug.

I'm not sure why Allyn is so against long lines.

Dave Strickland said...

In cases where restricting the number of significant digits isn't enough, or when it introduces new problems, you can simply fix the messed up files wdat produces.

For example the following (all one line):

perl -e 'while (<>) { if (/\-$/ ) { chomp; } print ;}' wdat_new_nucl_fit_acc3.dat | sed -e 's/- / /' > fixed.dat

will remove newlines preceded by "-" and then get rid of the - continuation character as well.

Could probably dont more neatly in perl without the sed part, but it works.

Dave