jzuhone / pyxsim

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

Can I combine two Photon Lists from two different redshifts? #9

Closed dingjiao22 closed 6 years ago

dingjiao22 commented 7 years ago

I have already known the redshift of two different data sources: one is 0.01, the other is 0.03. When I create photons from these two data sources, I use the redshift above, which means when I run: photons = pyxsim.PhotonList.from_data_source(sp, redshift, area, exp_time, source_model), I use different redshifts. Then I find that I can't combine these two photons together: RuntimeError: The values for the parameter 'fid_d_a' in the two inputs are not identical (42.07188892541447 Mpc vs. 123.25262279554553 Mpc)! So how can I combine two Photon Lists from two different redshifts? Thank you very much!

jzuhone commented 7 years ago

This behavior is by design. We don't want to combine two PhotonLists from different redshifts because when we call PhotonList.project_photons it needs to know what the redshift is in order to properly shift the photon energies.

However, if you project the PhotonLists to EventLists, you should be able to combine those without any trouble. You will need to make sure the exposure times and areas are the same, but otherwise this should work.

dingjiao22 commented 7 years ago

Thank you so much!!! (≧▽≦)

dingjiao22 commented 7 years ago

Hi, jzuhone! I tried to project the PhotonLists to EventLists and combined them, but it still can't work: The values for the parameter 'd_a' in the two inputs are not identical (980.9859850665596 Mpc vs. 1038.9939933013945 Mpc)! The two EventLists's parameters are: events_z112.parameters Out[6]: {'exp_time': 500000.0 s, 'area': 3000.0 cm2, 'redshift': 0.33000000000000002, 'd_a': 980.9859850665596 Mpc, 'sky_center': YTArray([ 45., 30.]) deg}

events_z110.parameters Out[7]: {'exp_time': 500000.0 s, 'area': 3000.0 cm2, 'redshift': 0.35999999999999999, 'd_a': 1038.9939933013945 Mpc, 'sky_center': YTArray([ 45., 30.]) deg}

What is 'd_a' ? Can I solve this problem and combine them together?

Thank you!!

jzuhone commented 7 years ago

Hi @dingjiao22,

d_a is the angular diameter distance to the source. The two EventList instances will also include a redshift parameter as well.

I suppose it is no longer desirable to have these parameters in an EventList, though it was before. There was another bug I recently fixed, and between that and removing these parameters from EventList I should cut another release this upcoming week, but in the meantime you can hackily remove these parameters before combining them by doing this (where events1 below is an EventList:

events1.parameters.pop("redshift") events1.parameters.pop("d_a")

and it looks like to combine them you might have to pop "sky_center" too if it's different.

Clearly doing this correctly will take a new release, hopefully next week.

dingjiao22 commented 7 years ago

Thank you so much!