[Yt-dev] Column Density derived field

Matthew Turk matthewturk at gmail.com
Tue Oct 25 03:44:35 PDT 2011


Hi Stephen,

Cameron's points about naming aside, thank you very much for
contributing this.  I think it would go well in a new analysis_modules
subdir, but utilities would work fine as well.

The issue about field detector is an interesting one.  I guess I don't
understand why asking for 'x' is a problem.  Your solution sounds good
to me.

How fast is the code?  It looks to me like it probably does quite a
few expensive operations ... would you be willing at some point in the
future to explore replacing it with an actual adaptive healpix
operation?

-Matt

On Mon, Oct 24, 2011 at 4:37 PM, Stephen Skory <s at skory.us> wrote:
> Hi all,
>
> I think I have the column density thingy working. I've got slices,
> projections and volume renders working (http://vimeo.com/31035296). I
> have a few questions.
>
> - Where in yt should I put this? Keeping the file in my work directory
> I use it like this, below. yt/utilities? Better ideas?
>
> from ColumnDensity import *
>
> cdnumdens = ColumnDensity(pf, 'NumberDensity', [0.5, 0.5, 0.5])
>
> def _CDNumberDensity(field, data, cd = cdnumdens):
>    return cd._build_derived_field(data)
> add_field('CDNumberDensity', _CDNumberDensity)
>
> - The function _build_derived_field, used directly above, is slightly
> odd. What happens in it is I get the cell positions from data
> (data['x'], etc..) and put those into the stuff that interpolates the
> column density. I get a field based on these positions, and that's
> what gets returned. However, and this shows what I don't understand,
> for projections (as in not slices) one of the times this function gets
> called as part of the add_field machinations data is a FieldDetector,
> and calling data['x'] on them is not what I want. So I've added an
> "if" that basically returns na.ones when data is a FieldDetector. What
> would be a better option than that? The source as it stands is pasted
> below.
>
> http://paste.enzotools.org/show/1892/
>
> Thanks for your thoughts!
>
> --
> Stephen Skory
> s at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> Yt-dev mailing list
> Yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>



More information about the yt-dev mailing list