[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Dec 4 12:56:40 PST 2013
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/bd42fd2de550/
Changeset: bd42fd2de550
Branch: yt-3.0
User: MatthewTurk
Date: 2013-12-01 02:58:26
Summary: Adding a very simple particle average creator.
Affected #: 1 file
diff -r d0546b0492408854ce4e133c0c2aed4a5a15ce75 -r bd42fd2de5507603b2f79e47c0d43d6c6b65b805 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -459,3 +459,21 @@
validators=[ValidateParameter("normal"),
ValidateParameter("center")])
+
+def add_particle_average(registry, ptype, field_name,
+ weight = "particle_mass",
+ density = True):
+ def _pfunc_avg(field, data):
+ pos = data[ptype, "Coordinates"]
+ f = data[ptype, field_name]
+ wf = data[ptype, weight]
+ v = data.deposit(pos, [f], method = "sum")
+ w = data.deposit(pos, [wf], method = "sum")
+ v /= w
+ if density: v /= data["CellVolume"]
+ return v
+ fn = ("deposit", "%s_avg_%s" % (ptype, field_name))
+ registry.add_field(fn, function=_pfunc_avg,
+ validators = [ValidateSpatial(0)],
+ particle_type = False)
+ return fn
https://bitbucket.org/yt_analysis/yt/commits/5e1fbeae7ae0/
Changeset: 5e1fbeae7ae0
Branch: yt-3.0
User: MatthewTurk
Date: 2013-12-02 03:26:50
Summary: Minor change to the particle average function.
Affected #: 1 file
diff -r bd42fd2de5507603b2f79e47c0d43d6c6b65b805 -r 5e1fbeae7ae069f02d2c079acb5f60f0485b2284 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -467,10 +467,12 @@
pos = data[ptype, "Coordinates"]
f = data[ptype, field_name]
wf = data[ptype, weight]
+ f *= wf
v = data.deposit(pos, [f], method = "sum")
w = data.deposit(pos, [wf], method = "sum")
v /= w
if density: v /= data["CellVolume"]
+ v[np.isnan(v)] = 0.0
return v
fn = ("deposit", "%s_avg_%s" % (ptype, field_name))
registry.add_field(fn, function=_pfunc_avg,
https://bitbucket.org/yt_analysis/yt/commits/a784b9d4f4fd/
Changeset: a784b9d4f4fd
Branch: yt-3.0
User: MatthewTurk
Date: 2013-12-04 16:07:47
Summary: Allow Stream to have edge particles.
Affected #: 1 file
diff -r 5e1fbeae7ae069f02d2c079acb5f60f0485b2284 -r a784b9d4f4fd058577c2908902eb7340f6e96c77 yt/frontends/stream/io.py
--- a/yt/frontends/stream/io.py
+++ b/yt/frontends/stream/io.py
@@ -181,8 +181,8 @@
# self.fields[g.id][fname] is the pattern here
pos = np.column_stack(self.fields[data_file.filename][
"particle_position_%s" % ax] for ax in 'xyz')
- if np.any(pos.min(axis=0) <= data_file.pf.domain_left_edge) or \
- np.any(pos.max(axis=0) >= data_file.pf.domain_right_edge):
+ if np.any(pos.min(axis=0) < data_file.pf.domain_left_edge) or \
+ np.any(pos.max(axis=0) > data_file.pf.domain_right_edge):
raise YTDomainOverflow(pos.min(axis=0), pos.max(axis=0),
data_file.pf.domain_left_edge,
data_file.pf.domain_right_edge)
https://bitbucket.org/yt_analysis/yt/commits/184f8241a86a/
Changeset: 184f8241a86a
Branch: yt-3.0
User: MatthewTurk
Date: 2013-12-04 21:56:35
Summary: Merged in MatthewTurk/yt/yt-3.0 (pull request #666)
Particle averaging
Affected #: 2 files
diff -r 69c14f7397bab48edf255be9b9ef07e2a7b143f3 -r 184f8241a86a70fede034a9484e83eca05d0e9e3 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -459,3 +459,23 @@
validators=[ValidateParameter("normal"),
ValidateParameter("center")])
+
+def add_particle_average(registry, ptype, field_name,
+ weight = "particle_mass",
+ density = True):
+ def _pfunc_avg(field, data):
+ pos = data[ptype, "Coordinates"]
+ f = data[ptype, field_name]
+ wf = data[ptype, weight]
+ f *= wf
+ v = data.deposit(pos, [f], method = "sum")
+ w = data.deposit(pos, [wf], method = "sum")
+ v /= w
+ if density: v /= data["CellVolume"]
+ v[np.isnan(v)] = 0.0
+ return v
+ fn = ("deposit", "%s_avg_%s" % (ptype, field_name))
+ registry.add_field(fn, function=_pfunc_avg,
+ validators = [ValidateSpatial(0)],
+ particle_type = False)
+ return fn
diff -r 69c14f7397bab48edf255be9b9ef07e2a7b143f3 -r 184f8241a86a70fede034a9484e83eca05d0e9e3 yt/frontends/stream/io.py
--- a/yt/frontends/stream/io.py
+++ b/yt/frontends/stream/io.py
@@ -181,8 +181,8 @@
# self.fields[g.id][fname] is the pattern here
pos = np.column_stack(self.fields[data_file.filename][
"particle_position_%s" % ax] for ax in 'xyz')
- if np.any(pos.min(axis=0) <= data_file.pf.domain_left_edge) or \
- np.any(pos.max(axis=0) >= data_file.pf.domain_right_edge):
+ if np.any(pos.min(axis=0) < data_file.pf.domain_left_edge) or \
+ np.any(pos.max(axis=0) > data_file.pf.domain_right_edge):
raise YTDomainOverflow(pos.min(axis=0), pos.max(axis=0),
data_file.pf.domain_left_edge,
data_file.pf.domain_right_edge)
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