[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Feb 15 11:34:59 PST 2013
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/5c9be6acb245/
changeset: 5c9be6acb245
branch: yt
user: brittonsmith
date: 2013-02-15 20:29:53
summary: Removing old spectral integrator that worked with the ascii Cloudy tables.
affected #: 3 files
diff -r 6ad7685b37719a895551010381a52b51b57e53c7 -r 5c9be6acb2459eea786784144f86e664bb7364b0 yt/analysis_modules/api.py
--- a/yt/analysis_modules/api.py
+++ b/yt/analysis_modules/api.py
@@ -106,8 +106,9 @@
RadialColumnDensity
from .spectral_integrator.api import \
- SpectralFrequencyIntegrator, \
- create_table_from_textfiles
+ add_xray_emissivity_field, \
+ add_xray_luminosity_field, \
+ add_xray_photon_emissivity_field
from .star_analysis.api import \
StarFormationRate, \
diff -r 6ad7685b37719a895551010381a52b51b57e53c7 -r 5c9be6acb2459eea786784144f86e664bb7364b0 yt/analysis_modules/spectral_integrator/api.py
--- a/yt/analysis_modules/spectral_integrator/api.py
+++ b/yt/analysis_modules/spectral_integrator/api.py
@@ -29,8 +29,6 @@
"""
from .spectral_frequency_integrator import \
- SpectralFrequencyIntegrator, \
- create_table_from_textfiles, \
EmissivityIntegrator, \
add_xray_emissivity_field, \
add_xray_luminosity_field, \
diff -r 6ad7685b37719a895551010381a52b51b57e53c7 -r 5c9be6acb2459eea786784144f86e664bb7364b0 yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py
--- a/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py
+++ b/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py
@@ -39,72 +39,6 @@
BilinearFieldInterpolator
xray_data_version = 1
-
-class SpectralFrequencyIntegrator(object):
- def __init__(self, table, field_names,
- bounds, ev_bounds):
- """
- From a table, interpolate over field_names to get resultant luminosity.
- Table must be of the style such that it is ordered by
- ``[field_names[0], field_names[1], ev]``
- """
- self.table = table
- self.field_names = field_names
-
- self.bounds = bounds
- self.ev_bounds = ev_bounds
- self.ev_vals = np.logspace(ev_bounds[0], ev_bounds[1], table.shape[-1])
-
- def _get_interpolator(self, ev_min, ev_max):
- """
- Integrates from ev_min to ev_max and returns an interpolator.
- """
- e_is, e_ie = np.digitize([ev_min, ev_max], self.ev_vals)
- bin_table = np.trapz(self.table[...,e_is-1:e_ie],
- 2.41799e17*
- (self.ev_vals[e_is:e_ie+1]-self.ev_vals[e_is-1:e_is]),
- axis=-1)
- bin_table = np.log10(bin_table.clip(1e-80,bin_table.max()))
- return BilinearFieldInterpolator(
- bin_table, self.bounds, self.field_names[:],
- truncate=True)
-
-
-
- def add_frequency_bin_field(self, ev_min, ev_max):
- """
- Add a new field to the FieldInfoContainer, which is an
- integrated bin from *ev_min* to *ev_max*.
-
- Returns the name of the new field.
- """
- interp = self._get_interpolator(ev_min, ev_max)
- name = "XRay_%s_%s" % (ev_min, ev_max)
- def frequency_bin_field(field, data):
- dd = {'H_NumberDensity' : np.log10(data["H_NumberDensity"]),
- 'Temperature' : np.log10(data["Temperature"])}
- return 10**interp(dd)
- add_field(name, function=frequency_bin_field,
- projection_conversion="cm",
- units=r"\rm{ergs}\ \rm{cm}^{-3}\ \rm{s}^{-1}",
- projected_units=r"\rm{ergs}\ \rm{cm}^{-2}\ \rm{s}^{-1}")
- return name
-
-def create_table_from_textfiles(pattern, rho_spec, e_spec, T_spec):
- """
- This accepts a CLOUDY text file of emissivities and constructs an
- interpolation table for spectral integration.
- """
- rho_n_bins, rho_min, rho_max = rho_spec
- e_n_bins, e_min, e_max = e_spec
- T_n_bins, T_min, T_max = T_spec
- # The second one is the fast-varying one
- rho_is, e_is = np.mgrid[0:rho_n_bins,0:e_n_bins]
- table = np.zeros((rho_n_bins, T_n_bins, e_n_bins), dtype='float64')
- mylog.info("Parsing Cloudy files")
- for i,ri,ei in zip(range(rho_n_bins*e_n_bins), rho_is.ravel(), e_is.ravel()):
- table[ri,:,ei] = [float(l.split()[-1]) for l in open(pattern%(i+1)) if l[0] != "#"]
- return table
class EnergyBoundsException(YTException):
def __init__(self, lower, upper):
https://bitbucket.org/yt_analysis/yt/commits/cdd1afefe429/
changeset: cdd1afefe429
branch: yt
user: MatthewTurk
date: 2013-02-15 20:34:55
summary: Merged in brittonsmith/yt (pull request #431)
Removing old spectral integrator that worked with the ascii Cloudy tables.
affected #: 3 files
diff -r 56d08189016fbf735ab41af8a5b8742dea6c72fc -r cdd1afefe4295f208dfa152020cf0044d6962ae5 yt/analysis_modules/api.py
--- a/yt/analysis_modules/api.py
+++ b/yt/analysis_modules/api.py
@@ -106,8 +106,9 @@
RadialColumnDensity
from .spectral_integrator.api import \
- SpectralFrequencyIntegrator, \
- create_table_from_textfiles
+ add_xray_emissivity_field, \
+ add_xray_luminosity_field, \
+ add_xray_photon_emissivity_field
from .star_analysis.api import \
StarFormationRate, \
diff -r 56d08189016fbf735ab41af8a5b8742dea6c72fc -r cdd1afefe4295f208dfa152020cf0044d6962ae5 yt/analysis_modules/spectral_integrator/api.py
--- a/yt/analysis_modules/spectral_integrator/api.py
+++ b/yt/analysis_modules/spectral_integrator/api.py
@@ -29,8 +29,6 @@
"""
from .spectral_frequency_integrator import \
- SpectralFrequencyIntegrator, \
- create_table_from_textfiles, \
EmissivityIntegrator, \
add_xray_emissivity_field, \
add_xray_luminosity_field, \
diff -r 56d08189016fbf735ab41af8a5b8742dea6c72fc -r cdd1afefe4295f208dfa152020cf0044d6962ae5 yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py
--- a/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py
+++ b/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py
@@ -39,72 +39,6 @@
BilinearFieldInterpolator
xray_data_version = 1
-
-class SpectralFrequencyIntegrator(object):
- def __init__(self, table, field_names,
- bounds, ev_bounds):
- """
- From a table, interpolate over field_names to get resultant luminosity.
- Table must be of the style such that it is ordered by
- ``[field_names[0], field_names[1], ev]``
- """
- self.table = table
- self.field_names = field_names
-
- self.bounds = bounds
- self.ev_bounds = ev_bounds
- self.ev_vals = np.logspace(ev_bounds[0], ev_bounds[1], table.shape[-1])
-
- def _get_interpolator(self, ev_min, ev_max):
- """
- Integrates from ev_min to ev_max and returns an interpolator.
- """
- e_is, e_ie = np.digitize([ev_min, ev_max], self.ev_vals)
- bin_table = np.trapz(self.table[...,e_is-1:e_ie],
- 2.41799e17*
- (self.ev_vals[e_is:e_ie+1]-self.ev_vals[e_is-1:e_is]),
- axis=-1)
- bin_table = np.log10(bin_table.clip(1e-80,bin_table.max()))
- return BilinearFieldInterpolator(
- bin_table, self.bounds, self.field_names[:],
- truncate=True)
-
-
-
- def add_frequency_bin_field(self, ev_min, ev_max):
- """
- Add a new field to the FieldInfoContainer, which is an
- integrated bin from *ev_min* to *ev_max*.
-
- Returns the name of the new field.
- """
- interp = self._get_interpolator(ev_min, ev_max)
- name = "XRay_%s_%s" % (ev_min, ev_max)
- def frequency_bin_field(field, data):
- dd = {'H_NumberDensity' : np.log10(data["H_NumberDensity"]),
- 'Temperature' : np.log10(data["Temperature"])}
- return 10**interp(dd)
- add_field(name, function=frequency_bin_field,
- projection_conversion="cm",
- units=r"\rm{ergs}\ \rm{cm}^{-3}\ \rm{s}^{-1}",
- projected_units=r"\rm{ergs}\ \rm{cm}^{-2}\ \rm{s}^{-1}")
- return name
-
-def create_table_from_textfiles(pattern, rho_spec, e_spec, T_spec):
- """
- This accepts a CLOUDY text file of emissivities and constructs an
- interpolation table for spectral integration.
- """
- rho_n_bins, rho_min, rho_max = rho_spec
- e_n_bins, e_min, e_max = e_spec
- T_n_bins, T_min, T_max = T_spec
- # The second one is the fast-varying one
- rho_is, e_is = np.mgrid[0:rho_n_bins,0:e_n_bins]
- table = np.zeros((rho_n_bins, T_n_bins, e_n_bins), dtype='float64')
- mylog.info("Parsing Cloudy files")
- for i,ri,ei in zip(range(rho_n_bins*e_n_bins), rho_is.ravel(), e_is.ravel()):
- table[ri,:,ei] = [float(l.split()[-1]) for l in open(pattern%(i+1)) if l[0] != "#"]
- return table
class EnergyBoundsException(YTException):
def __init__(self, lower, upper):
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