jzuhone / pyxsim

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

Empty photon list from pickle file #23

Closed Rudrani18 closed 2 years ago

Rudrani18 commented 4 years ago

Hello @jzuhone

I am trying to read some _pickle files containing the information of the gas particles around AGN using 'load_particle' command. I then try to generate the photons using the command - photons=pyxsim.PhotonList.from_data_source(ad,redshift,area,exp_time,source_model,center=center,cosmology=cosmo)

where, redshift = 1.0 area = (3000., "cm**2") exp_time = (200., "ks") center = ad.center cosmo = Cosmology(hubble_constant=0.7, omega_matter=0.3, omega_lambda=0.7) source_model = pyxsim.ThermalSourceModel("apec", 0.1, 20.0, 10000, Zmet=0.5)

This is generating no photons.

pyxsim : [INFO ] 2020-02-29 12:15:47,223 Finished generating photons. pyxsim : [INFO ] 2020-02-29 12:15:47,223 Number of photons generated: 0 pyxsim : [INFO ] 2020-02-29 12:15:47,223 Number of cells with photons: 0

Could you please suggest me what modification is needed to get non-zero number of photons?

The code is as follows -

with open ('m_v_K15_dataEdt.p','rb') as fr: data = pl.load(fr) # 'm_v_K15_dataEdt.p' is the pickle file having the information of the gas particles around many black holes arr = data['9223372040010295661'].T # we are choosing the most active black hole and the information of gas particles around it

Dict = {'temperature': arr[0], 'density': arr[1], 'particle_position_x': arr[2], 'particle_position_y': arr[3], 'particle_position_z': arr[4], 'smoothing_length': arr[5], 'particle_mass' : arr[6], 'particle_velocity_x' : arr[7], 'particle_velocity_y' : arr[8], 'particle_velocity_z' : arr[9]}

bbox_lim = 5e5 # size of the region containing the information of gas particles around BH is 50 kpc

bbox = [[-bbox_lim,bbox_lim], [-bbox_lim,bbox_lim], [-bbox_lim,bbox_lim]]

ds = yt.load_particles(Dict, bbox=bbox) ad = ds.all_data()

Rudrani18 commented 4 years ago

Thanks a lot @jzuhone for your advice but I am creating the box with the AGN at the centre. Then the properties of the gas particles inside the box are stored in the pickle file. So, I think the coordinates of the particles are well within the box by definition.

jzuhone commented 4 years ago

Hi @Rudrani18,

Any chance you can post the pickle file somewhere for me to download and try working on my own?

Rudrani18 commented 4 years ago

Hello Dr. ZuHone,

Our city has been locked down due to COVID-19. I donot have access to most of my research materials. I will send you the file as soon as I can recover it. I am extremely sorry for the inconvenience.

Regards, Rudrani


Rudrani Kar Chowdhury, Department of Physics, Presidency University, Kolkata

On Sat, Mar 21, 2020 at 6:18 PM John ZuHone notifications@github.com wrote:

Hi @Rudrani18 https://github.com/Rudrani18,

Any chance you can post the pickle file somewhere for me to download and try working on my own?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jzuhone/pyxsim/issues/23#issuecomment-602039411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWCTGE4LEP33GHEUHQXX53RISZQNANCNFSM4LQZNKFQ .

Rudrani18 commented 4 years ago

Hello @jzuhone ,

I have emailed you the data file containing the information of gas particles around the most active BH in a region of radius 25 kpc. The structure of the data file is same as the 'arr' as I have mentioned above in my code.

jzuhone commented 4 years ago

@Rudrani18 first question--what are the units for the different arrays in the dict that gets fed to yt.load_particles?

Rudrani18 commented 4 years ago

Hello @jzuhone ,

The units are as follows -

Temperature : Kelvin Density : M_sun / kpc^3 Position : kpc Length : kpc Mass : 10^10 M_sun Velocity : km/sec

jzuhone commented 4 years ago

Hi @Rudrani18,

I'm looking into this (I can reproduce the 0 photons), but just a note: z = 1 is pretty far away, and expecting to get many photons from a small 50 kpc region is asking a lot given your parameters.

What are your science goals exactly?

jzuhone commented 4 years ago

Also, you should make sure that your dataset you made knows about the units of the fields, e.g.:

data = {'temperature': (arr[0], "K"),
        'density': (arr[1], "Msun/kpc**3"),
        'particle_position_x': (arr[2], "kpc"),
        'particle_position_y': (arr[3], "kpc"),
        'particle_position_z': (arr[4], "kpc"),
        'smoothing_length': (arr[5], "kpc"),
        'particle_mass' : (arr[6], "Msun"),
        'particle_velocity_x' : (arr[7], "km/s"),
        'particle_velocity_y' : (arr[8], "km/s"),
        'particle_velocity_z' : (arr[9], "km/s")}

then when you make the dataset:

ds = yt.load_particles(data, bbox=bbox, length_unit="kpc", mass_unit="Msun", velocity_unit="km/s")
jzuhone commented 4 years ago

@Rudrani18 actually it doesn't look like it's your redshift necessarily.

Your gas densities are really small: maximum is only 3.57290667e-33 g/cm**3. Can you check this?

Rudrani18 commented 4 years ago

Thanks a lot @jzuhone for looking into this problem.

  1. Our plan regarding this work is to produce synthetic X-ray observation for the upcoming X-ray telescopes. Our primary science goal is to compare different properties of the ICM obtained from the synthetic X-ray observation with the theoretical values obtained using plasme emission code like APEC. We have chosen 50kpc region because it is the typical size of the galaxies.

  2. Thank you very much for your suggestion. I will make the dataset along with the units as you mentioned above.

3.I have checked the units once again. The unit of density is actually 10^10 (M_sun/h) / (kpc/h)^3. This is comoving unit. So, the maximum is 6.3844902458e-22 gm/cm**3.

jzuhone commented 4 years ago

@Rudrani18 yes, if you make the dataset with the units, and especially fix the density units, you should get photons now, event at z = 1.

Rudrani18 commented 4 years ago

Hello @jzuhone

Thanks for your help. I have tried to follow what you suggested but I am still getting 0 photons. Following is the output I am getting -

yt : [INFO ] 2020-04-11 15:30:45,575 Allocating for 4.360e+04 particles (index particle type 'all') yt : [INFO ] 2020-04-11 15:30:45,587 Identified 3.729e+03 octs pyxsim : [INFO ] 2020-04-11 15:30:46,868 Using emission measure field '(io, emission_measure)'. pyxsim : [INFO ] 2020-04-11 15:30:46,868 Using temperature field '(io, temperature)'. Processing cells/particles : 38%|▍| 15289/39985 [00:00<00:00, 152360.88Processing cells/particles : 50%|▍| 19860/39985 [00:00<00:00, 112928.71Processing cells/particles : 65%|▋| 25824/39985 [00:00<00:00, 96918.09iProcessing cells/particles : 78%|▊| 31240/39985 [00:00<00:00, 84090.56iProcessing cells/particles : 90%|▉| 35991/39985 [00:00<00:00, 67651.15it/s]pyxsim : [INFO ] 2020-04-11 15:31:08,628 Finished generating photons. pyxsim : [INFO ] 2020-04-11 15:31:08,628 Number of photons generated: 0 pyxsim : [INFO ] 2020-04-11 15:31:08,628 Number of cells with photons: 0

Following is the code I used

import yt from yt.units import parsec, Msun from yt.utilities.cosmology import Cosmology import pyxsim import numpy as np

arr = np.loadtxt('data.txt')

arr[1] = arr[1] 8 1e10/0.72 # physical density in M_sun/kpc3

data = {'temperature': (arr[0], "K"), 'density': (arr[1], "Msun/kpc**3"), 'particle_position_x': (arr[2], "kpc"), 'particle_position_y': (arr[3], "kpc"), 'particle_position_z': (arr[4], "kpc"), 'smoothing_length': (arr[5], "kpc"), 'particle_mass' : (arr[6], "Msun"), 'particle_velocity_x' : (arr[7], "km/s"), 'particle_velocity_y' : (arr[8], "km/s"), 'particle_velocity_z' : (arr[9], "km/s")}

bbox_lim = 5e5

bbox = [[-bbox_lim,bbox_lim], [-bbox_lim,bbox_lim], [-bbox_lim,bbox_lim]]

ds = yt.load_particles(data, bbox=bbox, length_unit="kpc", mass_unit="Msun", velocity_unit="km/s")

ad = ds.all_data()

redshift = 1.0 area = (3000., "cm**2") exp_time = (200., "ks") center = ad.center cosmo = Cosmology(hubble_constant=0.7, omega_matter=0.3, omega_lambda=0.7) source_model = pyxsim.ThermalSourceModel("apec", 0.1, 20.0, 10000, Zmet=0.5)

photons=pyxsim.PhotonList.from_data_source(ad,redshift,area,exp_time, source_model,center=center,cosmology=cosmo)

jzuhone commented 3 years ago

@Rudrani18 sorry that this slipped off my radar. Did you ever figure this out?

jzuhone commented 2 years ago

Closing due to lack of activity, but feel free to re-open if necessary.

Rudrani18 commented 2 years ago

Hello Dr. ZuHone,

I got busy with a new problem in the last few months as well as my Phd thesis defense and moving to a new country for post doc. I have again started working on this problem recently. I will let you know if there is any update.

Regards, Rudrani


Rudrani Kar Chowdhury, Department of Physics, University of Hong Kong

On Wed, Nov 10, 2021 at 10:04 PM John ZuHone @.***> wrote:

Closing due to lack of activity, but feel free to re-open if necessary.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jzuhone/pyxsim/issues/23#issuecomment-965523261, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWCTGHCIWAD2QC3RJUPEOTULKNIVANCNFSM4LQZNKFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.