[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jan 15 14:57:14 PST 2015
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/fba92cb70945/
Changeset: fba92cb70945
Branch: yt
User: ngoldbaum
Date: 2015-01-15 20:23:38+00:00
Summary: Updating the docstrings for the cut_region convenience function
Affected #: 1 file
diff -r e29ff6c5259c8ecae04e30bac953325df5b58645 -r fba92cb70945678b80c056db85b973c494d51cff yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -940,25 +940,37 @@
self._grids = None
self.quantities = DerivedQuantityCollection(self)
- def cut_region(self, field_cuts, field_parameters = None):
+ def cut_region(self, field_cuts, field_parameters=None):
"""
- Return an InLineExtractedRegion, where the object cells are cut on the
- fly with a set of field_cuts. It is very useful for applying
- conditions to the fields in your data object. Note that in previous
- versions of yt, this accepted 'grid' as a variable, but presently it
- requires 'obj'.
-
+ Return an YTCutRegionBase, where the a cell is identified as being inside
+ the cut region based on the value of one or more fields. Note that in
+ previous versions of yt the name 'grid' was used to represent the data
+ object used to construct the field cut, as of yt 3.0, this has been
+ changed to 'obj'.
+
+ Parameters
+ ----------
+ field_cuts : list of strings
+ A list of conditionals that will be evaluated. In the namespace
+ available, these conditionals will have access to 'obj' which is a
+ data object of unknown shape, and they must generate a boolean array.
+ For instance, conditionals = ["obj['temperature'] < 1e3"]
+ field_parameters : dictionary
+ A dictionary of field parameters to be used when applying the field
+ cuts.
+
Examples
--------
- To find the total mass of gas above 10^6 K in your volume:
+ To find the total mass of hot gas with temperature greater than 10^6 K
+ in your volume:
- >>> ds = load("RedshiftOutput0005")
+ >>> ds = yt.load("RedshiftOutput0005")
>>> ad = ds.all_data()
- >>> cr = ad.cut_region(["obj['Temperature'] > 1e6"])
- >>> print cr.quantities["TotalQuantity"]("CellMassMsun")
+ >>> cr = ad.cut_region(["obj['temperature'] > 1e6"])
+ >>> print cr.quantities.total_quantity("cell_mass").in_units('Msun')
"""
cr = self.ds.cut_region(self, field_cuts,
- field_parameters = field_parameters)
+ field_parameters=field_parameters)
return cr
def extract_isocontours(self, field, value, filename = None,
https://bitbucket.org/yt_analysis/yt/commits/ec8644a41a0e/
Changeset: ec8644a41a0e
Branch: yt
User: ngoldbaum
Date: 2015-01-15 22:57:06+00:00
Summary: Merged in ngoldbaum/yt (pull request #1411)
Updating the docstrings for the cut_region convenience function
Affected #: 1 file
diff -r d8422e8e79c7100aabf71f7a0f7cfc9367eee177 -r ec8644a41a0e2bc389e63fe2559bc665473ef939 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -940,25 +940,37 @@
self._grids = None
self.quantities = DerivedQuantityCollection(self)
- def cut_region(self, field_cuts, field_parameters = None):
+ def cut_region(self, field_cuts, field_parameters=None):
"""
- Return an InLineExtractedRegion, where the object cells are cut on the
- fly with a set of field_cuts. It is very useful for applying
- conditions to the fields in your data object. Note that in previous
- versions of yt, this accepted 'grid' as a variable, but presently it
- requires 'obj'.
-
+ Return an YTCutRegionBase, where the a cell is identified as being inside
+ the cut region based on the value of one or more fields. Note that in
+ previous versions of yt the name 'grid' was used to represent the data
+ object used to construct the field cut, as of yt 3.0, this has been
+ changed to 'obj'.
+
+ Parameters
+ ----------
+ field_cuts : list of strings
+ A list of conditionals that will be evaluated. In the namespace
+ available, these conditionals will have access to 'obj' which is a
+ data object of unknown shape, and they must generate a boolean array.
+ For instance, conditionals = ["obj['temperature'] < 1e3"]
+ field_parameters : dictionary
+ A dictionary of field parameters to be used when applying the field
+ cuts.
+
Examples
--------
- To find the total mass of gas above 10^6 K in your volume:
+ To find the total mass of hot gas with temperature greater than 10^6 K
+ in your volume:
- >>> ds = load("RedshiftOutput0005")
+ >>> ds = yt.load("RedshiftOutput0005")
>>> ad = ds.all_data()
- >>> cr = ad.cut_region(["obj['Temperature'] > 1e6"])
- >>> print cr.quantities["TotalQuantity"]("CellMassMsun")
+ >>> cr = ad.cut_region(["obj['temperature'] > 1e6"])
+ >>> print cr.quantities.total_quantity("cell_mass").in_units('Msun')
"""
cr = self.ds.cut_region(self, field_cuts,
- field_parameters = field_parameters)
+ field_parameters=field_parameters)
return cr
def extract_isocontours(self, field, value, filename = None,
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