Wednesday, December 16, 2009

updated Webspec for Chandra Cycle 12

Replaced the Cycle 11 responses and arfs with those for Cycle 12 and bumped the Chandra mission options to the top of the menu.

Tuesday, December 15, 2009

Snow Leopard

I've upgraded my MacBook Pro from Tiger all the way to Snow Leopard so here are a few observations.

1. Heasoft builds and runs successfully using gcc from Xcode (4.2.1) and gfortran from the R project Mac installer (http://r.research.att.com/tools/ : 4.2.3).

2. Heasoft builds and runs successfully using gcc from Xcode (4.2.1) and gfortran from the fink-installed gcc44 package (4.4.2).

3. Heasoft builds but xspec crashes using gcc and gfortran from the fink-installed gcc44 package. The problem appears to be conflicts in exception handling perhaps involving the system X11 library.

4. The iStat Menus application can be used to monitor usage of individual cores. I find that when running compute-intensive processes (such as xspec) both cores on my laptop get hammered. This implies that Apple, at least, are performing some parallelization in the compiler without specific user directives. This may depend on optimization settings.

Tuesday, November 17, 2009

replaced broken power law model code with C++

Rationalized the broken power law model code. Rewritten in C++ and calls powerLaw to evaluate individual sections of the model.

Friday, November 13, 2009

cflux model

One thing to note about the cflux model which is not clear in the documentation is that the model component(s) to which cflux is applied must integrate to a non-zero flux. For instance, cflux*pow where the pow norm is zero will generate NaNs from a divide-by-zero.

obscure extractor bug

Under some circumstances ROTANG elements in the output region extension could have junk values but only for region types where the rotation angle is irrelevant. This is fixed in extractor v5.14.

Wednesday, November 04, 2009

updated xselect XMM script

Updated the script run by save spectrum in the XMM case since I had assumed that CCDNR was the first DS keyword which appears not to always be the case.

Friday, October 23, 2009

WebSpec diagonal response

In answer to a request from Andy Lawrence I've added a unit diagonal response option to WebSpec. It appears at the bottom of the Mission/Instrument menu.

Thursday, October 08, 2009

bug in addascaspec

The addascaspec perl script in HEAsoft v6.7 does not run. A fixed version is available through the HEAsoft bugs page. Note that addascaspec can be used for spectra from missions other than ASCA.

definition of cemekl model

Paul Nulsen points out that the help for the cemekl (and cevmkl) model is misleading. The actual differential emission measure equation is dEM = (T/T_{max})^{alpha-1} dT/T_{max}. The documentation will be changed to match this.

patches for xspec v12.5.1

Patches 12.5.1a - k are available at the usual place. The most important are 12.5.1c and e which add the Solar abundances from Asplund et al. (2009) to the options and 12.5.1i which modifies the way the recorn model works (following comments from Rick Rothschild).

Thursday, September 03, 2009

max size of GTI arrays in extractor

At Lorella's request I increased the allowed GTI array size to 200,000. This should really be a dynamic array but that would require an extensive rewrite.

Wednesday, August 19, 2009

Solar abundances in xspec

Jeremy Sanders provided Solar abundances from Asplund, Grevesse & Sauval (2005) which I have added to abundances.dat in the develop version of xspec.

Update 9/8/09: Martin Asplund supplied values from his 2009 ARAA paper so I used them instead for the aspl abundance option.

light curves with extractor

Alex requested a way of better controlling the start time of a light curve created using extractor. I've added a new parameter lcstart which sets the time of the first bin (in spacecraft time units). This is checked into the development version as extractor v5.12.

cleansis

We have seen a few cases of observations of bright sources using Suzaku where running cleansis creates a hole in the image. Part of the problem is running with too high a log probability parameter but there is also a subtle error when iterating. Pixels which are already identified as bad and have their counts set to zero are still included when calculating the local background. This artificially lowers the estimated background hence increases the probability that a pixel will be flagged as bad.

I changed the algorithm so that pixels flagged as bad in previous iterations are ignored when calculating the local background. This change has been checked into the development version.

New release

HEAsoft 6.7 is now available. This includes XSPEC v12.5.1. The biggest change is in gain fitting which has been reworked as the preliminary step towards allowing the creation of response models. Response models will be created analogously to spectral models and will be used to either replace or augment response matrices.

This release is also the first which does not include XSPEC v11. This version has in practice not been supported for some time and it is getting increasingly difficult to ensure that it builds and runs on all systems.

Friday, June 12, 2009

XSPEC bug fixes update

12.5.0af The zredden multiplicative model component is calling the same function as redden, and therefore its redshift parameter has no effect. Our thanks to Brian Refsdal for pointing this out. Report added on May 05, 2009.

12.5.0ag When in setplot wave mode and the user's Xspec.init file entry for WAVE_PLOT_UNITS is set to angstrom, plot efficiency and plot icounts don't display due to a missing plot label error. Our thanks to Maurice Leutenegger for pointing this out. Report added on May 08, 2009.

12.5.0ah Fix to sqrt(2) error in the definition of the thermal broadening used in APEC models. Our thanks to Irina Zhuravleva for pointing this out. Report added on May 21, 2009.

12.5.0ai This adds a new C-callable function to provide access to the version string for users linking the XSPEC models library into their own programs. The function is declared in src/XSUtil/FunctionUtils/xsFortran.h, and has the prototype:

int xs_getVersion(char* buffer, int buffSize);

Report added on May 22, 2009.

12.5.0aj The model command fails to parse expressions that are explicitly of the form: M(M1(A1)+M2(A2)+M3(A3)). Our thanks to Jeremy Sanders for pointing this out. Report added on May 22, 2009.

12.5.0ak When soft limits are in use during fitting, the pegged parameter test should be comparing the actual value against the hard limits, not the adjusted value. Otherwise the parameter may in some cases peg too soon. Report added on June 08, 2009.

12.5.0al The same sqrt(2) fix mentioned in patch 12.5.0ah is needed when thermal broadening is turned on for v2.0 NEI models. Our thanks to Richard Sturm for pointing this out. Report added on June 08, 2009.

xselect cleansis

Fixed a bug spotted by Ed Cackett that the iterate_clean parameter is not recognized. Just needed to add it to the xselect.key file.

Note that there are issues turning up using the probabilistic sisclean tool for bright Suzaku sources. There is a tendency for the core of the PSF to be removed. Suggested fixes are either to change the critical probability or turn the iteration off.

Tuesday, May 26, 2009

self-irradiated funnel

Pavel Abolmasov sent in his self-irradiated funnel model (Abolmasov et al. 2009) and I added an entry to the new models web page.

addascaspec

The perl script addascapec, which is actually useful for other missions in addition to ASCA, had a couple of problems which I've fixed. The default errmeth should have been POISS-0 instead of POISS-1 and this parameter was not being used when summing background spectra.

Friday, May 15, 2009

bug in thermal broadening

Irina Zhuravleva at MPE pointed out that the thermal broadening option in the xspec apec model gives a sigma which is a factor of sqrt(2) too large. Fortunately, I don't think has any science implications since there have been no observations capable of measuring this broadening.

update on 6/8/09: Richard Sturm points out there is the same error in the NEI code.

Monday, May 11, 2009

panda/epanda/bpanda regions

I've added support to cfitsio region filtering for the panda/epanda/bpanda regions produced by ds9. Note that this assumes only one azimuthal region and one annulus although the region specification itself allows multiple for both. Made corresponding changes in extractor though note that the FITS region extension written in this case is not covered by the standard which does not include these shapes.

Thursday, May 07, 2009

Spectral file format standard document

I updated the PHA file standard document to try to make it clearer. I fixed an error in the type II example which had HDUCLAS3 and HDUCLAS4 inverted.

Tuesday, April 14, 2009

XSPEC bug fixes update

Here are the bug fixes from the last month. They can be found in the usual place.

12.5.0w A new tclout option has been added to make it easier to retrieve the fit parameters' sigma values. The syntax for this option is:

tclout sigma [<>:]n

where n is the parameter number. If it is not a variable parameter or if the fit was unable to calculate its sigma, a value of -1.0 is returned. Report added on Mar 06, 2009.

12.5.0x The model.dat entry for the vequil model is missing the parameter for Ar abundance, causing the vequil parameters which follow it to be misinterpreted in the code. (This bug does not affect the equil model.) Report added on Mar 06, 2009.

12.5.0y The kerrconv convolution model code is still using the xspec11-only LMODDIR environment variable for locating the kerrtable.dat model data file. This should be modified for usage in xspec12, where LMODDIR doesn't exist. Report added on Mar 11, 2009.

12.5.0z This removes an ambiguous reference build error specific to gcc-4.1.1 on the Solaris-2.9 platform. Our thanks to Dacheng Lin for pointing this out. Report added on Mar 26, 2009.

12.5.0aa The diskir model goes to infinity when its rirr parameter = 1.0, which is also the default value of rirr's lower limit. Our thanks to Brian Refsdal for pointing this out. Report added on Mar 26, 2009.

12.5.0ab The nsmax model function is only able to find its auxiliary files when it is run directly from XSPEC's model data directory (heasoft-6.x/spectral/modelData). Our thanks to Stephen Doe for pointing this out. Report added on Mar 31, 2009.

12.5.0ac Fixes to a couple of obscure cases of gain parameter usage: If a gain parameter belongs to a response temporarily replaced by a dummy response, or a gain parameter is indirectly removed through the data command erasing its associated spectrum and response, the gain shift may still be applied to a response occupying its former spectrum and source number. This patch also improves the show response output. Report added on Apr 06, 2009.

12.5.0ad The nthcomp model has an uninitialized variable for the case of input energies less than kT_bb/10^4, which may cause a crash to occur. Our thanks to Gulab Dewangan for pointing this out. Report added on Apr 14, 2009.

12.5.0ae For those linking the models library into their own programs, the swind1 model crashes when outputing a warning message as it indirectly accesses a variable intended for use only in XSPEC. Our thanks to Stephen Doe for pointing this out. Report added on Apr 14, 2009.

Friday, April 03, 2009

Notes on using SWIG to import C++ in Python

As a test case using my heasp library which is being converted from C to C++. Created heasp.i file to define interface. Basically a concatenation of the heasp.h, PHA.h and PHAII.h files with the following at the top. Adding additional classes will just require cat'ing their *.h file to the end and adding the appropriate #include at the top. Note the %include of "std_string.i" which is required to make the string arguments work. Similar %include specifications will be required if other STL classes are arguments for methods.

%module heasp

%include "std_string.i"

%{
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

#include

#include "heasp.h"
#include "PHA.h"
#include "PHAII.h"
%}

The interface file is then converted to C++ using

swig -python -c++ -classic heasp.i

which creates heasp_wrap.cxx and heasp.py. These must then be combined with the *.o files to build a shareable library called _heasp.so (note that the _ prefix and .so suffix are required). Compiling heasp_wrap.cxx will require include files from python. On my mac the relevant flag is
-I/Library/Frameworks/Python.framework/Versions/Current/include/python2.5
and on the lab Linux network
-I/usr1/local/include/python2.5

On the mac the command to make the shareable library is
ld -bundle -flat_namespace -undefined suppress -o _heasp.so ${OFILES} heasp_wrap.o -L${HEADAS}/lib -lCCfits_2.1 -lcfitsio_3.12
and on Linux
$(CXX) -shared -o _heasp.so ${OFILES} heasp_wrap.o -L${HEADAS}/lib -lCCfits_2.1 -lcfi
tsio_3.13

The module is loaded into python by
>>> import heasp
On the mac this generates an undefined symbol ___eprintf. This may require an update of Xcode to fix. On linux (running python2.5) there are no problems. Example use is

>>> import heasp
>>> spectrum = heasp.PHA()
>>> spectrum.read('file1.pha',1,1)
>>> spectrum.disp()
>>> spectrum.write('test.pha')

Thursday, April 02, 2009

chkarf

Updated and much simplified chkarf so it actually lists the correct keywords as mandatory. This tool really should just be a perl script - the current program is overkill.

Wednesday, April 01, 2009

using openMP in gcc

I'm testing out parallelization using openMP on an 8-core Linux box. To build xspec to support openMP options requires the hmakerc to be edited to add -fopenmp to CFLAGS, FFLAGS, and CXXFLAGS and -lgomp to be added to F77LIBS4C (I added it immediately before -lgfortran).

First test is in sumape.f to parallelize over the individual elements when interpolating the continuum and pseudo-continuum...

C$OMP PARALLEL PRIVATE(ien,limdown,limup,ihigh,energy)

C$OMP DO SCHEDULE(DYNAMIC)

DO ielt = 1, nmelt

...


ENDDO

C$OMP END DO

C$OMP END PARALLEL

The variables defined as private are to avoid threads overwriting variables being set and used by other threads.

Timing tests show that parallelization doesn't win enough in this case. Including the parallel directives slows a newpar down from 0.02 seconds to 0.4 seconds due to the overhead.

Saturday, March 28, 2009

Computing with GPUs

There is web site all about using GPUs for general purpose computing. One particularly useful looking article goes into some of the options and issues of coding for GPUs.

Friday, March 13, 2009

problem with extractor5.09

In the course of Suzaku pipeline testing Lorella spotted a problem I introduced during the attempted speed-up of the fixwmp routine. Pixels with non-zero counts show up even within the part of the region which is supposed to be set to -1.

The particular case of Suzaku demonstrated a conceptual issue here. Those pixels showing up within the supposed excluded region are real events. What is happening is that the region is defined in sky coordinates but the WMAP is written in detector coordinates. I calculate a conversion to determine which WMAP pixels are within the image region however it is a time-averaged solution. In the pre-5.09 version the satellite attitude wobble results in some events being incorrectly excluded from the WMAP. It was these events that the 5.09 version actually included however they are potentially confusing to users.

The fix is checked in as v5.10.

Monday, March 02, 2009

xselect and Chandra grating data

Jane Turner reported that the current version of xselect fails to read Chandra HETG evt2 data. This is due to a bug in xsel_mdb.f which I think only matters for Chandra grating files.

Wednesday, February 25, 2009

XSPEC units for setplot wave

In v12.5 we switched the y-axis units under setplot wave to per Hz instead of per Angstrom. Since this has not been universally popular we have added an initialization option to decide between the two cases. This is available as patch 12.5.0t. That and other recent patches can be obtained from the usual place and are summarized below

12.5.0r Fix needed for all etable model calculations. Our thanks to Roderick Johnstone for pointing this out. Report added on Feb 12, 2009.

12.5.0s When the both the absori and pexriv models are loaded during the same XSPEC session, whichever model is loaded second will not work properly. Note: this bug originated in version 12.5.0. Report added on Feb 13, 2009.

12.5.0t This adds an option for choosing Y-axis units when plotting in setplot wave mode. The selection is made by the WAVE_PLOT_UNITS entry, which has been added to the new version of the Xspec.init file. The units may now be specified in Hz (the default for version 12.5.0), or angstroms as they were prior to 12.5.0. This applies to plots of data, counts, and all variants of model and ufspec plots. Report added on Feb 19, 2009.

12.5.0u Minor code changes mostly to clean up the messages reported when running XSPEC under the valgrind software tool. Report added on Feb 19, 2009.

12.5.0v Multiplicative model components which are created with the mdefine command should not be multiplied by the energy bin widths. Our thanks to Roderick Johnstone for pointing this out. Report added on Feb 19, 2009.

non-integer COUNTS column

Steve Snowden ran into a silent problem because he made spectrum files with non-integer COUNTS columns. This is in violation of the standard and many ftools will simply silently truncate the float value to the nearest integer. I've added checks in the low-level library routines to write warnings in this case.

Update on 5/7/09. It turns out that the RXTE s/w writes PHA files with a real COUNTS column although the values are integers. So, I've improved the checking so that no warnings are given if the values are integers even if the column is defined as real. If the values really are non-integer then a warning is written and the values truncated to integers.

Saturday, February 14, 2009

Gelman on statistics

I'm going to start linking to interesting blog posts by Andrew Gelman because they often have important points to remember. Today he talks about a couple of reviews of "The Black Swan" and includes the following note on Bayesian inference :

From a philosophical point of view, I think the most important point of confusion about Bayesian inference is the idea that it's about computing the probability that a model is true. In all the areas I've ever worked on, the model is never true. But what you can do is find out that certain important aspects of the data are highly unlikely to be captured by the fitted model, which can facilitate a "model shift" moment. This sort of falsification is why I believe Popper's philosophy of science to be a good fit to Bayesian data analysis.

Wednesday, February 11, 2009

Recent XSPEC bug fixes

The following are all available from the usual place.

12.5.0l This slightly modifies the state of newly untied parameters. When a parameter is untied, its frozen/unfrozen setting should retain the setting of the parameter(s) to which it was linked, rather than be restored to its original value. Our thanks to Phil Evans and Delphine Porquet for pointing this out. Report added on Jan 14, 2009.

12.5.0m When steppar is executed, it should not automatically run a fit at the end to place the parameters in their best-fit state. Instead it should restore the parameters to their pre-steppar values, regardless of the fit state. Our thanks to Tim Kallman for pointing this out. Report added on Jan 14, 2009.

12.5.0n Bug fix for a C-to-Fortran boolean conversion error, affecting the default setting for the thermal broadening flag of the bapec and bvapec models. Unless overridden by the APECTHERMAL setting, thermal broadening should be ON by default for bapec and bvapec. This bug has only been observed on Solaris platforms. Report added on Jan 15, 2009.

12.5.0o When a delcomp operation is performed on the unnamed (default) model and no spectra are loaded, the model calculation is not updated. Our thanks to Laura Brenneman for pointing this out. Report added on Jan 21, 2009.

12.5.0p This relaxes the OGIP requirement that spectral data files must contain a RESPFILE keyword, primarily to allow the loading of certain RXTE/PCA files. Our thanks to David Smith for pointing this out. Report added on Jan 30, 2009.

12.5.0q A new option has been added to the tclout command: tclout gain. See the online tclout manual entry for proper syntax and usage. Prior to this, it was not possible to retrieve the values of gain parameters from tclout. Our thanks to Frank Haberl for pointing this out. Report added on Feb 03, 2009.

Thursday, January 22, 2009

xselect and region filters

I've added clarification to the on-line help for xselect about region filters. It is dangerous to make region filters in Image coordinates - the correct options are WCS or Physical. If the xselect image binning is not 1 then regions in Image coordinates will not be handled correctly.

Chandra CY11 webspec updated

Updated webspec with the final ARFs for Chandra Cycle 11.

Tuesday, January 13, 2009

recent xspec patches

12.5.0j Parameter links both to and from a model which is not associated with any spectra (shown as "Active/Off" in the model display), should not be removed when the model's state gets updated (such as when using the dummyrsp command). Our thanks to Laura Brenneman for pointing this out. Report added on Dec 24, 2008.

12.5.0k The dummyrsp command may cause a crash when entering a very large number of energy bins. Our thanks to Joel Frioriksson for pointing this out. Report added on Dec 31, 2008.