DavidT3 / XGA

X-ray: Generate and Analyse is a module designed to make the analysis of XMM observations simple and efficient. It provides an interface with SAS for the creation of XMM data products, as well as a way to easily perform fits (scalable for multiple observations) and retrieve information about an object, all within a Python package.
BSD 3-Clause "New" or "Revised" License
29 stars 3 forks source link

MPE-IKE border regions in eRASS are going to cause problems #1107

Closed DavidT3 closed 8 months ago

DavidT3 commented 9 months ago

Unfortunately, in addition to FITSIO being upset about being asked to read in the image headers from jointly owned images, I don't think the exposure maps are going to match the images:

https://erosita.mpe.mpg.de/dr1/eSASS4DR1/eSASS4DR1_cookbook/ - 3.10

That means that images and exposure maps generated for these tiles are not going to be the same as is - they are going to be different which means that RateMap declaration won't work.

This possibly ties in with issue #1105

DavidT3 commented 9 months ago

Okay so the header reading problem isn't actually all border regions I don't think - just some.

This one for instance: 096054_combined_0.2-2.3keVimg.fits

Throws this error:

OSError: FITSIO status = 224: missing NAXISn keywords ffgtknjj found unexpected keyword or value for keyword no. 5. Expected positive integer keyword NAXIS2, but instead found keyword ORIGIN with value 'MPE ' ffopen could not interpret primary array header of file: /mnt/lustre/projects/astro/general/dt237/test_xga/xga_output/erosita/096054/0960 54_combined_0.2-2.3keVimg.fits

DavidT3 commented 9 months ago

The error raised by the eSASS task makes it clear why - all the events are outside the region apparently??


evtool: eSASS4EDR Apr 06 16:05:20 2023 evtool/validate_tEvtool: WARNING1 If pixel size (parameter --rebin) is not left at 80, reliable source detection is not guaranteed. evtool/evtool_main: memset==.false., so memory setting for large files is used. evtool/merge_extensions: Merging 1 files. evtool/merge_extensions: Infiles will be read 1 extension at a time. evtool/evtool_main: Applying filters. evtool/apply_filter_eventfile: Creating image. evtool/create_from_events_tImage2D_i4: WARNING1 2301 out of 2301 possible events fall outside the image bounds. evtool/evtool_main: Writing outfile. evtool/ffits_create_img: ERROR3 illegal NAXISn keyword value evtool/write_tEventFile: Write of events was not requested; no events written. evtool/write_tEventFile: Since events were not requested, HK and other extensions are also not written. evtool/createTable_tBinTable: WARNING0 missing NAXISn keywords- extension GTI1 evtool/createFITSCol_tColumn: WARNING0 keyword not found in header - column START evtool/createFITSCol_tColumn: Appended the column START. evtool/createFITSCol_tColumn: WARNING0 keyword not found in header - column STOP evtool/createFITSCol_tColumn: Appended the column STOP. evtool/write_tBinTable: WARNING0 missing NAXISn keywords- extension GTI1

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:

0 0x7f2aaf0f53ff in ???

1 0x7f2ab02de717 in ffgrsz

at /its/home/dt237/dt237/software/heasoft-6.27.2/heacore/cfitsio/buffers.c:765

2 0x7f2ab03e9d07 in ftgrsz_

at /its/home/dt237/dt237/software/heasoft-6.27.2/heacore/cfitsio/f77_wrap3.c:858

3 0x451cc2 in __erolib_bintable_mod_MOD_write_tbintable

at task/erolib/erolib_bintable_mod.f90:3345

4 0x4ae9a5 in __erolib_eventfile_mod_MOD_write_teventfile

at task/erolib/erolib_eventfile_mod.f90:1004

5 0x40bf94 in evtool_main

at task/evtool/evtool_main.f90:144

6 0x40657c in main

at task/evtool/evtool_main.f90:22

/bin/sh: line 1: 109978 Floating point exception(core dumped) evtool eventfiles=/mnt/lustre/projects/astro/general/dt237/test_daxa/daxa_output/erosita_all_sky_de_dr1_raw/096054/EXP_010/096054-clean_evts.fits outfile=096054_combined_0.2-2.3keVimg.fits image=yes emin=0.2 emax=2.3 events=no size='auto' rebin=87 center_position=0


jessicapilling commented 9 months ago

Had a look at the documentation and it gives this advice:

If you choose size='auto' but leave center_position at its default, the resulting image will be sized to contain all the events, but it will be centred on the zero coordinates of the X/Y column values, as recalculated during the event merging process (see Algorithm section below). If this zero location is significantly offset from the geometrical centre of the projected events (as may happen, since it is taken simply from the first event list), you may end up with a lot of empty space in your image. Thus it is better to choose both size and center_position as 'auto' rather than one but not the other.

I tried the command using both 'center_position' and 'size' as auto, and this works fine, makes an image with the events in and that has NAXIS2 in, so doesn't break FITSIO. However the image is an odd shape ~3000 by ~1800.

Event lists with shared photons with MPE and IKI all begin with "eb" and have OWNER = 'MIXED' in their header. I think this would only be the border regions, so we could search for this key word and then use centre_position, size = auto. That way we will have images that aren't just mostly empty space.

Another option is to set size=3240, center_position=0 and rebin=80, this would make images with a size of 3.6x3.6 square degrees, each pixel with a size of 4x4 arcsec, ie. guarenteed to have all the events within one skyfield included in the image. This is possible on the border regions as well, you just get a mostly blank image with a few non-blank pixels in the corner. This is also how the eROSITA team make their images that you can download.

DavidT3 commented 8 months ago

All is now well - generating images for the border tiles works fine