jzuhone / pyxsim

Simulating X-ray observations from astrophysical sources.
http://hea-www.cfa.harvard.edu/~jzuhone/pyxsim
Other
20 stars 8 forks source link

The neutral hydrogen columns #37

Closed tekkamanmaverick closed 2 years ago

tekkamanmaverick commented 2 years ago

Hi John,

Accroding to your code, there are two nHs used for foreground galactic absorption. One is for the point-sources; the other is for the observed object. The former is fixed to 5e20 cm-2; the later can be changed by the user. Shouldn't they be consistent under considering the same line of sight?

Thank you.

jzuhone commented 2 years ago

Where in the code are you speaking of? This is SOXS, I think, not here in pyXSIM. And yes, they should be consistent for the same line of sight, but it's not hard-coded for the point-sources either, you can change it.

tekkamanmaverick commented 2 years ago

Let's look at http://hea-www.cfa.harvard.edu/~jzuhone/pyxsim/cookbook/Thermal_Emission.html

n_events = pyxsim.project_photons("sloshing_photons", "sloshing_events", "z", (45.,30.), absorb_model="tbabs", nH=0.04)

In here, you set nH= 0.04 for the observed object.

soxs.instrument_simulator("sloshing_simput.fits", "evt.fits", (100.0, "ks"), "chandra_acisi_cy0",
                          [45., 30.], overwrite=True)

In here, you convolved events with instrumental responses and added in point-source background. However, you didn't set nH for the point-sources.

Let's check instrument_simulator at https://hea-www.cfa.harvard.edu/soxs/_modules/soxs/instrument.html#instrument_simulator

...
def make_background(exp_time, instrument, sky_center, foreground=True,
                    ptsrc_bkgnd=True, instr_bkgnd=True, no_dither=False,
                    dither_params=None, roll_angle=0.0, subpixel_res=False,
                    input_sources=None, absorb_model="wabs", nH=0.05, 
                    aimpt_shift=None, prng=None):
...

def instrument_simulator(input_events, out_file, exp_time, instrument,
                         sky_center, overwrite=False, instr_bkgnd=True, 
                         foreground=True, ptsrc_bkgnd=True, 
                         bkgnd_file=None, no_dither=False, 
                         dither_params=None, roll_angle=0.0, 
                         subpixel_res=False, aimpt_shift=None,
                         prng=None):
...
            bkg_events, _ = make_background(
                exp_time, instrument, sky_center, foreground=foreground,
                instr_bkgnd=instr_bkgnd, no_dither=no_dither,
                dither_params=dither_params, ptsrc_bkgnd=ptsrc_bkgnd, prng=prng,
                subpixel_res=subpixel_res, roll_angle=roll_angle, 
                aimpt_shift=aimpt_shift)

...

The point-source used nH = 0.05.

tekkamanmaverick commented 2 years ago

The absorb_models are also different.

jzuhone commented 2 years ago

First, in the future please try to escape code in code blocks like this:

n_events = pyxsim.project_photons("sloshing_photons", "sloshing_events", "z", (45.,30.), absorb_model="tbabs", nH=0.04)

Second, see http://hea-www.cfa.harvard.edu/soxs/users_guide/background.html#using-a-background-from-an-event-file, where you can use make_background_file to adjust the absorption model and nH for the point-source component. The API doc for make_background_file is here:

http://hea-www.cfa.harvard.edu/soxs/api/instrument.html#soxs.instrument.make_background_file

tekkamanmaverick commented 2 years ago

So the example you provided should be modified?

tekkamanmaverick commented 2 years ago

In soxs.instrument_simulator, the nH for the point sources is always 0.05. This should be modified.

jzuhone commented 2 years ago

This is now enabled in https://github.com/lynx-x-ray-observatory/soxs/commit/73759914163da980984347bd9aa82a46bf82262d.

tekkamanmaverick commented 2 years ago

Thank you!