[yt-users] PHOX Mock observation

Barbara Ramirez Barbara.Ramirez-Mosquera at uibk.ac.at
Thu Sep 24 06:44:58 PDT 2015


Hello John!

Thanks for your detailed answer. I tried your second suggestion first 
because it was striaghtforward and it worked! No more memory errors.  
Now that you specify your machine capabilities I can see why I was 
having problems, since I only have 8 GB of RAM.
In the future I will try to make it run parallel since we do have a 
small cluster in our department.

So I have succesfully generated a photonlist with the following parameters:

(photons_per_chunk=50E6)

     A = 2000.
     exp_time = 100.0e2
     redshift = 0.05
     cosmo = Cosmology()

(I just generated one single list, not quite sure how to do the merging 
yet!)

Now, going further on the code, I'm trying to project those photons 
using the following code:

     ARF = 
"/home/barbara/yt-x86_64/xray_data/chandra_ACIS-S3_onaxis_arf.fits"
     RMF = 
"/home/barbara/yt-x86_64/xray_data/chandra_ACIS-S3_onaxis_rmf.fits"
     normal = [0.0,0.0,1.0]
     events = photons.project_photons(normal, exp_time_new=1.0e4, 
redshift_new=0.07,             dist_new=None,
                                  absorb_model=None, 
sky_center=(187.5,12.333), responses=[ARF,RMF],
                                  convolve_energies=True, 
no_shifting=False, north_vector=None,
                                  psf_sigma=None)

Which produces the following output+traceback:


  [INFO     ] 2015-09-24 15:40:51,932 Using energy-dependent effective 
area: /home/barbara/yt-x86_64/xray_data/chandra_ACIS-S3_onaxis_arf.fits
yt : [INFO     ] 2015-09-24 15:40:52,134 Total number of photons to use: 
7776596
yt : [INFO     ] 2015-09-24 15:41:01,217 Applying energy-dependent 
effective area.
yt : [INFO     ] 2015-09-24 15:41:02,016 Total number of observed 
photons: 4518817
yt : [WARNING  ] 2015-09-24 15:41:02,017 This routine has not been 
tested to work with all RMFs. YMMV.
yt : [INFO     ] 2015-09-24 15:41:02,017 Reading response matrix file 
(RMF): /home/barbara/yt-x86_64/xray_data/chandra_ACIS-S3_onaxis_rmf.fits
yt : [INFO     ] 2015-09-24 15:41:02,032 Number of energy bins in RMF: 2340
yt : [INFO     ] 2015-09-24 15:41:02,032 Energy limits: 0.3 12
yt : [INFO     ] 2015-09-24 15:41:02,039 Number of channels in RMF: 1024
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/barbara/hires_final/photon_projection.py in <module>()
      32                                  absorb_model=None, 
sky_center=(187.5,12.333), responses=[ARF,RMF],
      33                                  convolve_energies=True, 
no_shifting=False, north_vector=None,
---> 34                                  psf_sigma=None)
      35
      36 print events

/home/barbara/yt-x86_64/src/yt-hg/yt/analysis_modules/photon_simulator/photon_simulator.pyc 
in project_photons(self, normal, area_new, exp_time_new, redshift_new, 
dist_new, absorb_model, psf_sigma, sky_center, responses, 
convolve_energies, no_shifting, north_vector)
     681
     682         if "RMF" in parameters and convolve_energies:
--> 683             events, info = 
self._convolve_with_rmf(parameters["RMF"], events)
     684             for k, v in info.items(): parameters[k] = v
     685

/home/barbara/yt-x86_64/src/yt-hg/yt/analysis_modules/photon_simulator/photon_simulator.pyc 
in _convolve_with_rmf(self, respfile, events)
     765                 for q in range(fcurr,last):
     766                     if phEE[q] >= low and phEE[q] < high:
--> 767                         channelInd = 
np.random.choice(len(weights), p=weights)
     768                         fcurr +=1
     769 detectedChannels.append(trueChannel[channelInd])

/home/barbara/yt-x86_64/lib/python2.7/site-packages/numpy/random/mtrand.so 
in mtrand.RandomState.choice (numpy/random/mtrand/mtrand.c:10565)()

ValueError: probabilities do not sum to 1


I'm not sure what does that mean? Any ideas? Is this related to the 
small photon list I'm working with?
I have increased the observation redshift from 0.01 (as in the example) 
to 0.07 because I was obtaining another error that said:

585             fak = Aratio*Tratio*Dratio
     586             if fak > 1:
--> 587                 raise ValueError("Spectrum scaling factor = %g, 
cannot be greater than unity." % fak)
     588             my_n_obs = np.uint64(n_ph_tot*fak)
     589

ValueError: Spectrum scaling factor = 8.78099, cannot be greater than unity.

But I'll admit I fixed that purely by chance and playing with the 
parameters...

Thanks again for working through this with me. I hope the community 
benefits from this discussion!


PS: I'll send you anyway a private email with a copy of my dataset so 
you can have a better idea of the kind of errors I'm encountering

-- 
Barbara L. Ramirez MSc.
Institut für Astro- und Teilchenphysik
University of Innsbruck

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150924/5cbe858d/attachment.htm>


More information about the yt-users mailing list