[yt-svn] commit/yt: 5 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Aug 27 09:22:28 PDT 2015


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/49552326b049/
Changeset:   49552326b049
Branch:      yt
User:        jzuhone
Date:        2015-08-26 21:49:17+00:00
Summary:     Minor nits to make example work in docs
Affected #:  1 file

diff -r 580e8d4ccc0ecd2f0d8198307cf0d074b0b735cb -r 49552326b049993a7da6cb9a7b7b56a3a2a959a0 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,7 +549,7 @@
                                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")
 


https://bitbucket.org/yt_analysis/yt/commits/c87b75646c76/
Changeset:   c87b75646c76
Branch:      yt
User:        jzuhone
Date:        2015-08-26 21:52:35+00:00
Summary:     Bug when the simulation's temperatures are so high they exceed the max allowed
Affected #:  1 file

diff -r 49552326b049993a7da6cb9a7b7b56a3a2a959a0 -r c87b75646c76902bf4328aff5fa8e4260b3e754e 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


https://bitbucket.org/yt_analysis/yt/commits/12a5a095606c/
Changeset:   12a5a095606c
Branch:      yt
User:        jzuhone
Date:        2015-08-26 21:54:46+00:00
Summary:     Sometimes "area" is a string, in which case we don't want to give it units of course
Affected #:  1 file

diff -r c87b75646c76902bf4328aff5fa8e4260b3e754e -r 12a5a095606c1001f1abe9e0b475198c75e8b1c5 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:


https://bitbucket.org/yt_analysis/yt/commits/4be612c56937/
Changeset:   4be612c56937
Branch:      yt
User:        jzuhone
Date:        2015-08-26 21:59:58+00:00
Summary:     Make sure the figure orientation is correct
Affected #:  1 file

diff -r 12a5a095606c1001f1abe9e0b475198c75e8b1c5 -r 4be612c5693787623b448e6976fee7a40eacbb82 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
@@ -556,7 +556,8 @@
 
    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)
 


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