[yt-users] error with derived field: operands could not be broadcast together with shapes

Britton Smith brittonsmith at gmail.com
Tue May 1 13:07:47 PDT 2012


Hi JC,

Are the hierarchies identical between pf1 and pf2?  If not, I think that
could be a problem.  It could be that with the slice you passed only
through root grids where the hierarchy is identical.  Doing a projection
that acts upon the entire domain would expose this issue.  If this is the
case, you may need to create a constant resolution data container for use
in the comparison.

Britton

On Tue, May 1, 2012 at 3:58 PM, Jean-Claude Passy <jcpassy at gmail.com> wrote:

>  Oops, I spoke too fast.
> I can make a slice but if I try a projection, the same kind of error
> occurs: http://paste.yt-project.org/show/7QiwjVoYXKYxCn3Iu2u9/
>
> This is the script I am using:
>
> ------------------------------------------------------------------------- def
> pf_compare(pf1, pf2):   def _NewField(field, data):        data2 =
> pf2.h.grids[data.id - data._id_offset]        return
> abs(data2["TotalEnergy"]-data["TotalEnergy"])/data["TotalEnergy"]
> pf1.field_info.add_field("CompareEnergy", function = _NewField, validators
> = [ValidateGridType()])
> pf1 = load('helix/DD0000/CE0000') pf2 = load('parallel/DD0000/CE0000')
> #
> Comparison
> pf_compare(pf1, pf2) region = pf1.h.region([0.5, 0.5, 0.5], [0.0, 0.0,
> 0.0], [1.0, 1.0, 1.0]) compare_energy = region["CompareEnergy"]
> pc = PlotCollection(pf1) pc.add_slice("CompareEnergy",2,center=[0.5, 0.5,
> 0.5]) pc.add_projection("CompareEnergy",2) pc.set_lim((0.4, 0.6, 0.4,
> 0.6)) pc.save()
> -------------------------------------------------------------------------
> Any idea?
> Cheers,
>
> JC
>
>
> On 5/1/12 3:35 PM, Jean-Claude Passy wrote:
>
> Thanks Britton, it works perfectly.
>
> Cheers,
>
> JC
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20120501/c6129168/attachment.htm>


More information about the yt-users mailing list