Hello!

I have written before about trying to implement the xray photon generator.
This time I've updated all the libraries, YT, Heasoft... etc.

I'm just trying to generate a photon list for the moment but I'm getting two sorts of errors:
1)

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/home/barbara/hires_final/photon_trial.py in <module>()
     90 cosmo = Cosmology()
     91
---> 92 photons = PhotonList.from_scratch(Roi, redshift, A, exp_time,thermal_model,center="center",cosmology=cosmo)
     93 photons.write_h5_file("my_photons.h5")
     94

/home/barbara/yt-x86_64/src/yt-hg/yt/analysis_modules/photon_simulator/photon_simulator.pyc in from_scratch(cls, data_source, redshift, area, exp_time, photon_model, parameters, center, dist, cosmology)
    329         parameters["Width"] = 2.*width.in_units("kpc")
    330
--> 331         photons = photon_model(data_source, parameters)
    332
    333         mylog.info("Finished generating photons.")

/home/barbara/yt-x86_64/src/yt-hg/yt/analysis_modules/photon_simulator/photon_models.pyc in __call__(self, data_source, parameters)
    188                     raise RuntimeError("Number of photons generated for this chunk "+
    189                                        "exceeds photons_per_chunk (%d)! " % self.photons_per_chunk +
--> 190                                        "Increase photons_per_chunk!")
    191
    192                 if self.method == "invert_cdf":

RuntimeError: Number of photons generated for this chunk exceeds photons_per_chunk (1000000000)! Increase photons_per_chunk!


Ok, so I increase the number of photons per chunk and I get:
2)
---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
/home/barbara/hires_final/photon_trial.py in <module>()
     90 cosmo = Cosmology()
     91
---> 92 photons = PhotonList.from_scratch(Roi, redshift, A, exp_time,thermal_model,center="center",cosmology=cosmo)
     93 photons.write_h5_file("my_photons.h5")
     94

/home/barbara/yt-x86_64/src/yt-hg/yt/analysis_modules/photon_simulator/photon_simulator.pyc in from_scratch(cls, data_source, redshift, area, exp_time, photon_model, parameters, center, dist, cosmology)
    329         parameters["Width"] = 2.*width.in_units("kpc")
    330
--> 331         photons = photon_model(data_source, parameters)
    332
    333         mylog.info("Finished generating photons.")

/home/barbara/yt-x86_64/src/yt-hg/yt/analysis_modules/photon_simulator/photon_models.pyc in __call__(self, data_source, parameters)
    156
    157             number_of_photons = np.zeros(num_cells, dtype="uint64")
--> 158             energies = np.zeros(self.photons_per_chunk)
    159
    160             start_e = 0

MemoryError:


This is just a trial, so I'm using almost a copy of the code that's on the documentation:

    Roi = ds.sphere("center",radius=width_half)
    apec_model = TableApecModel("/home/barbara/yt-x86_64/atomdb_v2.0.2",0.5,10.0,100,thermal_broad=False,apec_vers="2.0.2")
    thermal_model = ThermalPhotonModel(apec_model, X_H=0.75,photons_per_chunk=1000000000, Zmet=0.3,method="invert_cdf")

    A = 6000.
    exp_time = 100.0e3
    redshift = 0.05
    cosmo = Cosmology()

    photons = PhotonList.from_scratch(Roi, redshift, A, exp_time,thermal_model,center="center",cosmology=cosmo)
    photons.write_h5_file("my_photons.h5")

My snapshot information:

length unit 0.999752515846 cm
time unit 1.0 s
mass unit 1.0 g
velocity unit 1.0 cm/s
Enter total Width of plot in Mpccm: 0.5
smallest cell: 14.6469091426 kpccm/h
minima and maxima 1.04339659244e-29 g/cm**3 1.5187912088e-24 g/cm**3
The simulation is [ 89.40546647  89.40546647  89.40546647] Mpccm
Centering region in:, [ 44.58268195  44.53902694  44.51719943] Mpccm
yt : [INFO     ] 2015-09-15 16:49:43,219 Cosmology: h = 0.71, omega_matter = 0.27, omega_lambda = 0.73


Am I just using wrong parameters to try to simulate the Xray emission of this simulated cluster?

Thanks beforehand for the help!

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