Hi,
Problem: Using a background region that is on a different chip with psextract.
Ciao version: 2.1
Command:
psextract events="evt2_2_0.3-10.fits[sky=region(../Regions/1.reg)]" \
bgevents="evt2_2_0.3-10.fits[sky=region(../Regions/BG.reg)]" \
root="1" aoff="../aoff1.fits" bgaoff="../aoff1.fits"
Error message:
.
.
.
Running mkarf to create source 1.arf at (3368.113483,4012.581033)
mkarf detsubsys=ACIS-I1 outfile=1.arf asphistfile=1.asphist sourcepixelx=3368.113483 sourcepixely=4012.581033 grating=NONE obsfile=1.asphist maskfile=NONE verbose=0 engrid=0.1:11.0:0.01 clobber=yes
Running mkarf to create background 1_bg.arf at (5985.849278,3574.976946)
mkarf detsubsys=ACIS-I1 outfile=1_bg.arf asphistfile=1.asphist sourcepixelx=5985.849278 sourcepixely=3574.976946 grating=NONE obsfile=1.asphist maskfile=NONE verbose=0 engrid=0.1:11.0:0.01 clobber=yes
*** WARNING: The ARF was computed to be zero at all the specified energies.
This is probably due to an incorrect source position
.
.
.
It is easy to see that mkarf is being called with the flag:
`detsubsys=ACIS-I1'
for both the source, and the background, even though the background region
is on a different chip.
The reason for this is two-fold, both within the script, psextract.
1) mkarf is being called with the wrong parameter:
(Line 609 to 623 of psextract (minus the `verbosity' lines) )
if [ $dobg -gt 0 -a $fef != $fakebgfef ]; then
mkarf detsubsys=$detname outfile=$bgarf asphistfile="$bgasphist" \
sourcepixelx=$bgpx sourcepixely=$bgpy \
grating=$grating obsfile="$bgasphist" maskfile=NONE \
verbose=$pverrid engrid=$egrid clobber=$clobber
fi
$detname is the chipname for the source region, not the background region.
Earlier in the script we have:
(Line 578 to 584 of psextract)
if [ $bgnccdid -gt 3 ]; then
bglocal_id=`expr $bgnccdid - 4`
bgdetname="ACIS-S$bglocal_id"
else
bglocal_id=$bgnccdid
bgdetname="ACIS-I$bglocal_id"
fi
where $bgdetname is defined but, alas, never used.
Or is it defined? (which brings me to problem 2)
Lines 578 to 584 are wrapped in an if-then-endif:
(Line 570 to 585 of psextract)
if [ $dobg -gt 0 -a $aoff != $bgaoff -a $fef != $fakebgfef ]; then
bgasphist=${root}_bg.asphist
if [ $verbose -gt 0 ]; then
echo "Running asphist to create background aspect histogram $bgasphist"
fi
asphist infile=$bgsaoff outfile=$bgasphist gtifile=$bgevents clobber=$clobber dtffile="" verbose=$pverrid
# Make mkarf detsubsys keyword
#
if [ $bgnccdid -gt 3 ]; then <----
bglocal_id=`expr $bgnccdid - 4` <---- The block shown above
bgdetname="ACIS-S$bglocal_id" <----
else <----
bglocal_id=$bgnccdid <----
bgdetname="ACIS-I$bglocal_id" <----
fi <----
fi
which prevents $bgdetname from being assigned if $aoff == $bgaoff.
But it is the same observation, just different chips, so the assignment
of $bgdetname should not be within that loop.
So the fix to get it to work is simply:
1) Change $detname to $bgdetname in the call to mkarf when making the ARF
for the background region.
2) Move the assignment code for $bgdetname out of the if-then-end control.
The diff (new_file) (old_file) is:
576d575
< fi
585a585
> fi
614c614
< echo mkarf detsubsys=$bgdetname outfile=$bgarf asphistfile="$bgasphist" \
--- > echo mkarf detsubsys=$detname outfile=$bgarf asphistfile="$bgasphist" \ 619c619 < mkarf detsubsys=$bgdetname outfile=$bgarf asphistfile="$bgasphist" \ --- > mkarf detsubsys=$detname outfile=$bgarf asphistfile="$bgasphist" \Of course, if I'm just doing something stupid that is confusing psextract, then let me know (and ignore the fix!). But this routine worked before the upgrade to 2.1
Cheers, Eric
------ Dr. Eric Tittley Post Doctoral Research Associate Joint Center for Astrophysics UMBC
This archive was generated by hypermail 2b29 : Wed May 15 2013 - 01:00:04 EDT