Hi Stephen, I'm a bit confused. You're making a derived field called ColumnDensity, which is actually the Column Density of a ray of material between each field element in the volume and some sort of "center" position? If this is the case, I think to name this simply ColumnDensity may confuse some users (it would confuse me), as a ColumnDensity is already calculated for a plane by the use of projections and off-axis projections. I would rather this be called ColumnDensityToAPoint or RadialColumnDensity or something like that to avoid the confusion, and maybe including a line telling explicitly what you're doing (i.e. calculating the CD with respect to a point) in the comments section in the class docstrings. Is this right, or am I totally misunderstanding what you're doing here? The video looks nice! Cameron On 10/24/2011 04:37 PM, Stephen Skory 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!
-- Cameron Hummels PhD Candidate, Astronomy Department of Columbia University Public Outreach Director, Astronomy Department of Columbia University NASA IYA New York State Student Ambassador http://outreach.astro.columbia.edu PGP: 0x06F886E3