lucabaldini / ixpeobssim

Simulation and analysis framework for the Imaging X-ray Polarimetry Explorer
GNU General Public License v3.0
9 stars 12 forks source link

Missing modf files with the gray filter #710

Closed lucabaldini closed 1 year ago

lucabaldini commented 1 year ago

Originally reported by Michal:

Dear Luca,

I have tried unweighted and weighted with irfname='ixpe:obssim_gray:v12' and irfname='ixpe:obssim_gray_alpha075:v12', respectively and it did not work

Input file /usr/local/share/IXPEobssim/ixpeobssim/caldb/ixpe/gpd/cpf/modfact/ixpe_d1_obssim_gray_mfact_v012.fits does not exists and Input file /usr/local/share/IXPEobssim/ixpeobssim/caldb/ixpe/gpd/cpf/modfact/ixpe_d1_obssim_gray_alpha075_mfact_v012.fits does not exists

In the directory modfact there are no gray filter responses. I am using ixpeobssim v.30.5.0.

Cheers,

Michal.

lucabaldini commented 1 year ago

You are right.

I only created the arf and mrf files for the gray filter, not the modf. We have all we need for fitting in xspec but, sadly, I overlokked the fact that the modulation factor is necessary for the pcubes.

*** Quick fix: just copy the ixpe:obssim_gray:v12 files for the three DUs in the same folder adding the _gray suffix in the name. The gray filter does not change the modulation factor and this will work fine, modulo the fact that some of the header keyword will be inconsistent.

This is not a big deal---probably one hour worth of work on my side. I will be in meetings most of the day, today, but I'll do my best to fix this and tag a new version of ixpeobssim by tomorrow night. I opened https://github.com/lucabaldini/ixpeobssim/issues/710 to track this.

My apologies for the inconvenience, and thanks for helping debug this!

lucabaldini commented 1 year ago

It worked in unweighted case giving larger PD below 4keV.

It did not work in weighted case giving me the following error:

Traceback (most recent call last): ... File "/usr/local/share/IXPEobssim/ixpeobssim/core/pipeline.py", line 378, in xpbin return _xpbin(*_parse_args(XPBIN_PARSER, args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/bin/xpbin.py", line 121, in xpbin eventbinning.bin() File "/usr/local/share/IXPEobssim/ixpeobssim/binning/polarization.py", line 324, in bin_ aeff = self.load_aeff_for_polarization_analysis() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/binning/base.py", line 228, in load_aeff_for_polarization_analysis aeff = load_arf(self.irf_name, self.event_file.du_id(), simple_weighting=self.get('weights')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/irf/init.py", line 137, in load_arf return _load_irf_base(xEffectiveArea, 'arf', irf_name, du_id, caldb_path, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/irf/init.py", line 119, in _load_irf_base raise RuntimeError('No simple weightig available for %s intent.', intent) RuntimeError: ('No simple weightig available for %s intent.', 'obssim_gray_alpha075') ...

Cheers,

Michal.

lucabaldini commented 1 year ago

And this is correct, as well.

For the PCUBE you want to use the weighted file with the SIMPLE prescription. (When I said "leave it alone" yesterday I was referring to the spectro-polarimetric fit in XSPEC only. The PCUBE is the very reason we have files with the simple prescription in the first place.)

So for a weighted PCUBE you need to specify --irfname 'ixpe:obssim_gray_alpha075simple:v12' and, until I tag a new version of the package, you need yet another copy of the modf files cp ixpe_d1_obssim_alpha075_mfact_v012.fits ixpe_d1_obssim_gray_alpha075simple_mfact_v012.fits

I know this sounds overly complicated---I have presented this multiple times at the SASWG telecons and I keep getting confused myself. Good that we have a sensible book-keeping in place within the response files and that xpbin is equipped with a check preventing people to do the wrong thing 😄

Luca

lucabaldini commented 1 year ago

...no, still the same error... M.

File "/usr/local/share/IXPEobssim/ixpeobssim/core/pipeline.py", line 378, in xpbin return _xpbin(*_parse_args(XPBIN_PARSER, args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/bin/xpbin.py", line 121, in xpbin eventbinning.bin() File "/usr/local/share/IXPEobssim/ixpeobssim/binning/polarization.py", line 324, in bin_ aeff = self.load_aeff_for_polarization_analysis() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/binning/base.py", line 228, in load_aeff_for_polarization_analysis aeff = load_arf(self.irf_name, self.event_file.du_id(), simple_weighting=self.get('weights')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/irf/init.py", line 137, in load_arf return _load_irf_base(xEffectiveArea, 'arf', irf_name, du_id, caldb_path, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/IXPEobssim/ixpeobssim/irf/init.py", line 119, in _load_irf_base raise RuntimeError('No simple weightig available for %s intent.', intent) RuntimeError: ('No simple weightig available for %s intent.', 'obssim_gray_alpha075simple')

lucabaldini commented 1 year ago

And I now believe we really need a code change. The culprit appears to be

SUPPORTED_SIMPLE_INTENTS = ('obssim_alpha075', )

in ixpeobssim/irf/init.py

lucabaldini commented 1 year ago

And I now think we should not add more file, and handle the gray filter via a command-line option in the proper place, see issue #712

lucabaldini commented 1 year ago

Pull request #716

lucabaldini commented 1 year ago

Shipped in 30.6.0