[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat Jul 9 14:51:58 PDT 2016
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/27e69b41c4e4/
Changeset: 27e69b41c4e4
Branch: yt
User: brittonsmith
Date: 2016-06-25 12:18:38+00:00
Summary: Adding max_box_fraction kwarg to allow light ray segments to extend further than one box length.
Affected #: 2 files
diff -r cc4cf45b51d65ea9588a01e12df7c4e0f7a476e6 -r 27e69b41c4e4101fe432c60085acad3e1af428d5 yt/analysis_modules/cosmological_observation/cosmology_splice.py
--- a/yt/analysis_modules/cosmological_observation/cosmology_splice.py
+++ b/yt/analysis_modules/cosmological_observation/cosmology_splice.py
@@ -40,7 +40,8 @@
omega_lambda=self.simulation.omega_lambda)
def create_cosmology_splice(self, near_redshift, far_redshift,
- minimal=True, deltaz_min=0.0,
+ minimal=True, max_box_fraction=1.0,
+ deltaz_min=0.0,
time_data=True, redshift_data=True):
r"""Create list of datasets capable of spanning a redshift
interval.
@@ -63,6 +64,11 @@
many entries as possible within the redshift
interval.
Default: True.
+ max_box_fraction : float
+ In terms of the size of the domain, the maximum length a light
+ ray segment can be in order to span the redshift interval from
+ one dataset to another.
+ Default: 1.0 (the size of the box)
deltaz_min : float
Specifies the minimum delta z between consecutive datasets
in the returned
@@ -133,36 +139,39 @@
z_Tolerance = 1e-3
z = far_redshift
+ # Sort data outputs by proximity to current redshift.
+ self.splice_outputs.sort(key=lambda obj:np.fabs(z - obj['redshift']))
+ cosmology_splice.append(self.splice_outputs[0])
+ z = cosmology_splice[-1]["redshift"]
+ z_target = z - max_box_fraction * cosmology_splice[-1]["dz_max"]
+
# fill redshift space with datasets
- while ((z > near_redshift) and
- (np.abs(z - near_redshift) > z_Tolerance)):
-
- # For first data dump, choose closest to desired redshift.
- if (len(cosmology_splice) == 0):
- # Sort data outputs by proximity to current redshift.
- self.splice_outputs.sort(key=lambda obj:np.fabs(z - \
- obj['redshift']))
- cosmology_splice.append(self.splice_outputs[0])
+ while ((z_target > near_redshift) and
+ (np.abs(z_target - near_redshift) > z_Tolerance)):
# Move forward from last slice in stack until z > z_max.
- else:
- current_slice = cosmology_splice[-1]
- while current_slice['next'] is not None and \
- (z < current_slice['next']['redshift'] or \
- np.abs(z - current_slice['next']['redshift']) <
- z_Tolerance):
- current_slice = current_slice['next']
+ current_slice = cosmology_splice[-1]
- if current_slice is cosmology_splice[-1]:
- near_redshift = cosmology_splice[-1]['redshift'] - \
- cosmology_splice[-1]['dz_max']
- mylog.error("Cosmology splice incomplete due to insufficient data outputs.")
+ while current_slice["next"] is not None:
+ current_slice = current_slice['next']
+ if current_slice["next"] is None:
break
- else:
- cosmology_splice.append(current_slice)
+ if current_slice["next"]["redshift"] < z_target:
+ break
- z = cosmology_splice[-1]['redshift'] - \
- cosmology_splice[-1]['dz_max']
+ if current_slice["redshift"] < z_target:
+ raise RuntimeError(
+ ("Cannot create cosmology splice: " +
+ "Getting from z = %f to %f requires " +
+ "max_box_fraction = %f, but max_box_fraction "
+ "is set to %f") %
+ (z, z_target, (z - current_slice["redshift"]) /
+ cosmology_splice[-1]["dz_max"],
+ max_box_fraction))
+
+ cosmology_splice.append(current_slice)
+ z = current_slice["redshift"]
+ z_target = z - max_box_fraction * current_slice["dz_max"]
# Make light ray using maximum number of datasets (minimum spacing).
else:
diff -r cc4cf45b51d65ea9588a01e12df7c4e0f7a476e6 -r 27e69b41c4e4101fe432c60085acad3e1af428d5 yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
--- a/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
+++ b/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
@@ -76,6 +76,11 @@
will contain as many entries as possible within the redshift
interval. Do not use for simple rays.
Default: True.
+ max_box_fraction : optional, float
+ In terms of the size of the domain, the maximum length a light
+ ray segment can be in order to span the redshift interval from
+ one dataset to another.
+ Default: 1.0 (the size of the box)
deltaz_min : optional, float
Specifies the minimum :math:`\Delta z` between consecutive
datasets in the returned list. Do not use for simple rays.
@@ -113,8 +118,8 @@
"""
def __init__(self, parameter_filename, simulation_type=None,
near_redshift=None, far_redshift=None,
- use_minimum_datasets=True, deltaz_min=0.0,
- minimum_coherent_box_fraction=0.0,
+ use_minimum_datasets=True, max_box_fraction=1.0,
+ deltaz_min=0.0, minimum_coherent_box_fraction=0.0,
time_data=True, redshift_data=True,
find_outputs=False, load_kwargs=None):
@@ -166,6 +171,7 @@
self.light_ray_solution = \
self.create_cosmology_splice(self.near_redshift, self.far_redshift,
minimal=self.use_minimum_datasets,
+ max_box_fraction=max_box_fraction,
deltaz_min=self.deltaz_min,
time_data=time_data,
redshift_data=redshift_data)
@@ -220,16 +226,6 @@
self.light_ray_solution[q]['redshift']).in_units("Mpccm / h") / \
self.simulation.box_size
- # Simple error check to make sure more than 100% of box depth
- # is never required.
- if (self.light_ray_solution[q]['traversal_box_fraction'] > 1.0):
- mylog.error("Warning: box fraction required to go from z = %f to %f is %f" %
- (self.light_ray_solution[q]['redshift'], z_next,
- self.light_ray_solution[q]['traversal_box_fraction']))
- mylog.error("Full box delta z is %f, but it is %f to the next data dump." %
- (self.light_ray_solution[q]['dz_max'],
- self.light_ray_solution[q]['redshift']-z_next))
-
# Get dataset axis and center.
# If using box coherence, only get start point and vector if
# enough of the box has been used,
https://bitbucket.org/yt_analysis/yt/commits/12998d89381b/
Changeset: 12998d89381b
Branch: yt
User: brittonsmith
Date: 2016-06-25 12:19:12+00:00
Summary: Fixing some ugly tabbing.
Affected #: 1 file
diff -r 27e69b41c4e4101fe432c60085acad3e1af428d5 -r 12998d89381b828ed561bc0973594a47cb6bbf9a yt/analysis_modules/cosmological_observation/cosmology_splice.py
--- a/yt/analysis_modules/cosmological_observation/cosmology_splice.py
+++ b/yt/analysis_modules/cosmological_observation/cosmology_splice.py
@@ -124,11 +124,12 @@
if near_redshift == far_redshift:
self.simulation.get_time_series(redshifts=[near_redshift])
- cosmology_splice.append({'time': self.simulation[0].current_time,
- 'redshift': self.simulation[0].current_redshift,
- 'filename': os.path.join(self.simulation[0].fullpath,
- self.simulation[0].basename),
- 'next': None})
+ cosmology_splice.append(
+ {'time': self.simulation[0].current_time,
+ 'redshift': self.simulation[0].current_redshift,
+ 'filename': os.path.join(self.simulation[0].fullpath,
+ self.simulation[0].basename),
+ 'next': None})
mylog.info("create_cosmology_splice: Using %s for z = %f ." %
(cosmology_splice[0]['filename'], near_redshift))
return cosmology_splice
https://bitbucket.org/yt_analysis/yt/commits/def3048e837a/
Changeset: def3048e837a
Branch: yt
User: ngoldbaum
Date: 2016-07-09 21:51:27+00:00
Summary: Merged in brittonsmith/yt (pull request #2252)
Allowing LightRay segments to extend further than one box length
Affected #: 2 files
diff -r 98f754270a409f2798b0abe8cd8db13021ac9743 -r def3048e837a3e747938bf8529273816f17c3a56 yt/analysis_modules/cosmological_observation/cosmology_splice.py
--- a/yt/analysis_modules/cosmological_observation/cosmology_splice.py
+++ b/yt/analysis_modules/cosmological_observation/cosmology_splice.py
@@ -40,7 +40,8 @@
omega_lambda=self.simulation.omega_lambda)
def create_cosmology_splice(self, near_redshift, far_redshift,
- minimal=True, deltaz_min=0.0,
+ minimal=True, max_box_fraction=1.0,
+ deltaz_min=0.0,
time_data=True, redshift_data=True):
r"""Create list of datasets capable of spanning a redshift
interval.
@@ -63,6 +64,11 @@
many entries as possible within the redshift
interval.
Default: True.
+ max_box_fraction : float
+ In terms of the size of the domain, the maximum length a light
+ ray segment can be in order to span the redshift interval from
+ one dataset to another.
+ Default: 1.0 (the size of the box)
deltaz_min : float
Specifies the minimum delta z between consecutive datasets
in the returned
@@ -118,11 +124,12 @@
if near_redshift == far_redshift:
self.simulation.get_time_series(redshifts=[near_redshift])
- cosmology_splice.append({'time': self.simulation[0].current_time,
- 'redshift': self.simulation[0].current_redshift,
- 'filename': os.path.join(self.simulation[0].fullpath,
- self.simulation[0].basename),
- 'next': None})
+ cosmology_splice.append(
+ {'time': self.simulation[0].current_time,
+ 'redshift': self.simulation[0].current_redshift,
+ 'filename': os.path.join(self.simulation[0].fullpath,
+ self.simulation[0].basename),
+ 'next': None})
mylog.info("create_cosmology_splice: Using %s for z = %f ." %
(cosmology_splice[0]['filename'], near_redshift))
return cosmology_splice
@@ -133,36 +140,39 @@
z_Tolerance = 1e-3
z = far_redshift
+ # Sort data outputs by proximity to current redshift.
+ self.splice_outputs.sort(key=lambda obj:np.fabs(z - obj['redshift']))
+ cosmology_splice.append(self.splice_outputs[0])
+ z = cosmology_splice[-1]["redshift"]
+ z_target = z - max_box_fraction * cosmology_splice[-1]["dz_max"]
+
# fill redshift space with datasets
- while ((z > near_redshift) and
- (np.abs(z - near_redshift) > z_Tolerance)):
-
- # For first data dump, choose closest to desired redshift.
- if (len(cosmology_splice) == 0):
- # Sort data outputs by proximity to current redshift.
- self.splice_outputs.sort(key=lambda obj:np.fabs(z - \
- obj['redshift']))
- cosmology_splice.append(self.splice_outputs[0])
+ while ((z_target > near_redshift) and
+ (np.abs(z_target - near_redshift) > z_Tolerance)):
# Move forward from last slice in stack until z > z_max.
- else:
- current_slice = cosmology_splice[-1]
- while current_slice['next'] is not None and \
- (z < current_slice['next']['redshift'] or \
- np.abs(z - current_slice['next']['redshift']) <
- z_Tolerance):
- current_slice = current_slice['next']
+ current_slice = cosmology_splice[-1]
- if current_slice is cosmology_splice[-1]:
- near_redshift = cosmology_splice[-1]['redshift'] - \
- cosmology_splice[-1]['dz_max']
- mylog.error("Cosmology splice incomplete due to insufficient data outputs.")
+ while current_slice["next"] is not None:
+ current_slice = current_slice['next']
+ if current_slice["next"] is None:
break
- else:
- cosmology_splice.append(current_slice)
+ if current_slice["next"]["redshift"] < z_target:
+ break
- z = cosmology_splice[-1]['redshift'] - \
- cosmology_splice[-1]['dz_max']
+ if current_slice["redshift"] < z_target:
+ raise RuntimeError(
+ ("Cannot create cosmology splice: " +
+ "Getting from z = %f to %f requires " +
+ "max_box_fraction = %f, but max_box_fraction "
+ "is set to %f") %
+ (z, z_target, (z - current_slice["redshift"]) /
+ cosmology_splice[-1]["dz_max"],
+ max_box_fraction))
+
+ cosmology_splice.append(current_slice)
+ z = current_slice["redshift"]
+ z_target = z - max_box_fraction * current_slice["dz_max"]
# Make light ray using maximum number of datasets (minimum spacing).
else:
diff -r 98f754270a409f2798b0abe8cd8db13021ac9743 -r def3048e837a3e747938bf8529273816f17c3a56 yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
--- a/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
+++ b/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
@@ -76,6 +76,11 @@
will contain as many entries as possible within the redshift
interval. Do not use for simple rays.
Default: True.
+ max_box_fraction : optional, float
+ In terms of the size of the domain, the maximum length a light
+ ray segment can be in order to span the redshift interval from
+ one dataset to another.
+ Default: 1.0 (the size of the box)
deltaz_min : optional, float
Specifies the minimum :math:`\Delta z` between consecutive
datasets in the returned list. Do not use for simple rays.
@@ -113,8 +118,8 @@
"""
def __init__(self, parameter_filename, simulation_type=None,
near_redshift=None, far_redshift=None,
- use_minimum_datasets=True, deltaz_min=0.0,
- minimum_coherent_box_fraction=0.0,
+ use_minimum_datasets=True, max_box_fraction=1.0,
+ deltaz_min=0.0, minimum_coherent_box_fraction=0.0,
time_data=True, redshift_data=True,
find_outputs=False, load_kwargs=None):
@@ -166,6 +171,7 @@
self.light_ray_solution = \
self.create_cosmology_splice(self.near_redshift, self.far_redshift,
minimal=self.use_minimum_datasets,
+ max_box_fraction=max_box_fraction,
deltaz_min=self.deltaz_min,
time_data=time_data,
redshift_data=redshift_data)
@@ -220,16 +226,6 @@
self.light_ray_solution[q]['redshift']).in_units("Mpccm / h") / \
self.simulation.box_size
- # Simple error check to make sure more than 100% of box depth
- # is never required.
- if (self.light_ray_solution[q]['traversal_box_fraction'] > 1.0):
- mylog.error("Warning: box fraction required to go from z = %f to %f is %f" %
- (self.light_ray_solution[q]['redshift'], z_next,
- self.light_ray_solution[q]['traversal_box_fraction']))
- mylog.error("Full box delta z is %f, but it is %f to the next data dump." %
- (self.light_ray_solution[q]['dz_max'],
- self.light_ray_solution[q]['redshift']-z_next))
-
# Get dataset axis and center.
# If using box coherence, only get start point and vector if
# enough of the box has been used,
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