[yt-svn] commit/yt: chummels: Merged in jzuhone/yt (pull request #1726)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 27 09:22:32 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/3d8318a8dda3/
Changeset: 3d8318a8dda3
Branch: yt
User: chummels
Date: 2015-08-27 16:22:19+00:00
Summary: Merged in jzuhone/yt (pull request #1726)
[bugfix] Photon Simulator bug fixes
Affected #: 3 files
diff -r f2d09d1f84ca96b7de321deda2df951b265ed6f4 -r 3d8318a8dda350f558140ac6247ccd2c5114c597 doc/source/analyzing/analysis_modules/photon_simulator.rst
--- a/doc/source/analyzing/analysis_modules/photon_simulator.rst
+++ b/doc/source/analyzing/analysis_modules/photon_simulator.rst
@@ -476,6 +476,7 @@
.. code:: python
import yt
+ import numpy as np
from yt.utilities.physical_constants import cm_per_kpc, K_per_keV, mp
from yt.utilities.cosmology import Cosmology
from yt.analysis_modules.photon_simulator.api import *
@@ -548,14 +549,15 @@
0.01, 20.0, 20000)
abs_model = TableAbsorbModel("tbabs_table.h5", 0.1)
- thermal_model = ThermalPhotonModel(apec_model)
+ thermal_model = ThermalPhotonModel(apec_model, photons_per_chunk=40000000)
photons = PhotonList.from_scratch(sphere, redshift, A,
exp_time, thermal_model, center="c")
events = photons.project_photons([0.0,0.0,1.0],
responses=["sim_arf.fits","sim_rmf.fits"],
- absorb_model=abs_model)
+ absorb_model=abs_model,
+ north_vector=[0.0,1.0,0.0])
events.write_fits_image("img.fits", clobber=True)
diff -r f2d09d1f84ca96b7de321deda2df951b265ed6f4 -r 3d8318a8dda350f558140ac6247ccd2c5114c597 yt/analysis_modules/photon_simulator/photon_models.py
--- a/yt/analysis_modules/photon_simulator/photon_models.py
+++ b/yt/analysis_modules/photon_simulator/photon_models.py
@@ -138,7 +138,7 @@
idxs = np.argsort(kT)
- kT_bins = np.linspace(kT_min, max(my_kT_max, kT_max), num=n_kT+1)
+ kT_bins = np.linspace(kT_min, max(my_kT_max.v, kT_max), num=n_kT+1)
dkT = kT_bins[1]-kT_bins[0]
kT_idxs = np.digitize(kT[idxs], kT_bins)
kT_idxs = np.minimum(np.maximum(1, kT_idxs), n_kT) - 1
diff -r f2d09d1f84ca96b7de321deda2df951b265ed6f4 -r 3d8318a8dda350f558140ac6247ccd2c5114c597 yt/analysis_modules/photon_simulator/photon_simulator.py
--- a/yt/analysis_modules/photon_simulator/photon_simulator.py
+++ b/yt/analysis_modules/photon_simulator/photon_simulator.py
@@ -26,8 +26,7 @@
#-----------------------------------------------------------------------------
from yt.extern.six import string_types
import numpy as np
-from yt.funcs import \
- mylog, get_pbar, iterable, ensure_list
+from yt.funcs import mylog, get_pbar, iterable, ensure_list
from yt.utilities.physical_constants import clight
from yt.utilities.cosmology import Cosmology
from yt.utilities.orientation import Orientation
@@ -880,21 +879,24 @@
f = h5py.File(h5file, "r")
parameters["ExposureTime"] = YTQuantity(f["/exp_time"].value, "s")
- parameters["Area"] = YTQuantity(f["/area"].value, "cm**2")
+ if isinstance(f["/area"].value, (string_types, bytes)):
+ parameters["Area"] = f["/area"].value.decode("utf8")
+ else:
+ parameters["Area"] = YTQuantity(f["/area"].value, "cm**2")
parameters["Redshift"] = f["/redshift"].value
parameters["AngularDiameterDistance"] = YTQuantity(f["/d_a"].value, "Mpc")
if "rmf" in f:
- parameters["RMF"] = f["/rmf"].value
+ parameters["RMF"] = f["/rmf"].value.decode("utf8")
if "arf" in f:
- parameters["ARF"] = f["/arf"].value
+ parameters["ARF"] = f["/arf"].value.decode("utf8")
if "channel_type" in f:
- parameters["ChannelType"] = f["/channel_type"].value
+ parameters["ChannelType"] = f["/channel_type"].value.decode("utf8")
if "mission" in f:
- parameters["Mission"] = f["/mission"].value
+ parameters["Mission"] = f["/mission"].value.decode("utf8")
if "telescope" in f:
- parameters["Telescope"] = f["/telescope"].value
+ parameters["Telescope"] = f["/telescope"].value.decode("utf8")
if "instrument" in f:
- parameters["Instrument"] = f["/instrument"].value
+ parameters["Instrument"] = f["/instrument"].value.decode("utf8")
events["xpix"] = f["/xpix"][:]
events["ypix"] = f["/ypix"][:]
@@ -924,7 +926,10 @@
parameters = {}
parameters["ExposureTime"] = YTQuantity(tblhdu.header["EXPOSURE"], "s")
- parameters["Area"] = YTQuantity(tblhdu.header["AREA"], "cm**2")
+ if isinstance(tblhdu.header["AREA"], (string_types, bytes)):
+ parameters["Area"] = tblhdu.header["AREA"]
+ else:
+ parameters["Area"] = YTQuantity(tblhdu.header["AREA"], "cm**2")
parameters["Redshift"] = tblhdu.header["REDSHIFT"]
parameters["AngularDiameterDistance"] = YTQuantity(tblhdu.header["D_A"], "Mpc")
if "RMF" in tblhdu.header:
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list