[yt-users] Particle profiles
Elizabeth Tasker
taskere at mcmaster.ca
Tue Oct 26 16:13:52 PDT 2010
More, yet different hatred:
I now get:
KeyError Traceback (most recent call last)
/1/home/taskere/yt_hg/yt/src/yt-hg/scripts/iyt in <module>()
22
23 #pc.add_profile_object(data, ["Radius", "Dark_Matter_Density"])
---> 24 pc.add_profile_object(data, ["Radius", "particle_density"])
25
26 pc.save(fn) # save all plots
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/raven/plot_collection.py in
add_profile_object(self, data_source, fields, weight, accumulation,
x_bins, x_log, x_bounds, lazy_reader, id, figure, axes)
808 lazy_reader)
809 if len(fields) > 1:
--> 810 profile.add_fields(fields[1], weight=weight,
accumulation=accumulation)
811 if id is None: id = self._get_new_id()
812 p = self._add_plot(PlotTypes.Profile1DPlot(profile,
fields, id,
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/Profiles.py in
add_fields(self, fields, weight, accumulation, fractional)
136 fields = ensure_list(fields)
137 if self._lazy_reader:
--> 138 self._lazy_add_fields(fields, weight, accumulation)
139 else:
140 self._unlazy_add_fields(fields, weight, accumulation)
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/Profiles.py in
_lazy_add_fields(self, fields, weight, accumulation)
95 # We get back field values, weight values, used bins
96 f, w, u = self._bin_field(grid, field, weight,
accumulation,
---> 97 args=args, check_cut=True)
98 self.__data[field] += f # running total
99 self.__weight_data[field] += w # running total
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/Profiles.py in
save_state(*args, **kwargs)
45 old_params = source.field_parameters
46 source.field_parameters =
prof._data_source.field_parameters
---> 47 tr = func(*args, **kwargs)
48 source.field_parameters = old_params
49 else:
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/Profiles.py in
_bin_field(self, source, field, weight, accumulation, args, check_cut)
232 # check_cut is set if source != self._data_source
233 # (i.e., lazy_reader)
--> 234 source_data = self._get_field(source, field, check_cut)[mi]
235 if weight: weight_data = self._get_field(source, weight,
check_cut)[mi]
236 binned_field = self._get_empty_field()
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/Profiles.py in
_get_field(self, source, this_field, check_cut)
172 else:
173 pointI =
self._data_source._get_point_indices(source)
--> 174
data.append(source[field][pointI].ravel().astype('float64'))
175 return na.concatenate(data, axis=0)
176
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/BaseGridType.py in
__getitem__(self, key)
136 """
137 if not self.data.has_key(key):
--> 138 self.get_data(key)
139 return self.data[key]
140
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/BaseGridType.py in
get_data(self, field)
179 else: raise
180 else:
--> 181 self._generate_field(field)
182 return self.data[field]
183
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/BaseGridType.py in
_generate_field(self, field)
124 self[field] = temp_array[sl]
125 else:
--> 126 self[field] = self.pf.field_info[field](self)
127 else: # Can't find the field, try as it might
128 raise exceptions.KeyError, field
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/field_info_container.py in
__call__(self, data)
317 original_fields = data.keys() # Copy
318 dd = self._function(self, data)
--> 319 dd *= self._convert_function(data)
320 for field_name in data.keys():
321 if field_name not in original_fields:
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/UniversalFields.py in
_convertDensity(data)
780
781 def _convertDensity(data):
--> 782 return data.convert("Density")
783 def _pdensity_pyx(field, data):
784 blank = na.zeros(data.ActiveDimensions, dtype='float32')
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/BaseGridType.py in
convert(self, datatype)
101 It either returns the multiplicative factor or throws a
KeyError.
102 """
--> 103 return self.pf[datatype]
104
105 def __repr__(self):
/1/home/taskere/yt_hg/yt/src/yt-hg/yt/lagos/OutputTypes.py in
__getitem__(self, key)
108 self.conversion_factors]:
109 if key in d: return d[key]
--> 110 raise KeyError(key)
111
112 def keys(self):
KeyError: 'Density'
WARNING: Failure executing file: <slice.py>
WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline librar
:\
Elizabeth
Matthew Turk wrote:
> Hi Elizabeth,
>
> That's a bug; it actually was trying to call the Enzo CIC routines.
> I've fixed it in the stable branch now.
>
> -Matt
>
> On Tue, Oct 26, 2010 at 3:09 PM, Elizabeth Tasker <taskere at mcmaster.ca> wrote:
>
>> Sorry, this still isn't working for me.
>>
>> I don't have the field dark_matter_density and it hates cloud in cell too!
>>
>> NameError: global name 'cic_deposit' is not defined
>>
>> Elizabeth
>>
>>
>> Matthew Turk wrote:
>>
>>> Hi Elizabeth,
>>>
>>> Here's a script that does it; you can get this with "yt_lodgeit.py
>>> --download=1294".
>>>
>>> http://paste.enzotools.org/show/1294/
>>>
>>> Also, on re-reading your initial question, my initial suggestion of
>>> adding a profile using "ParticleRadius" and "ParticleMassMsun" *will*
>>> function, but it's not what you wanted.
>>>
>>> Best,
>>>
>>> Matt
>>>
>>> On Tue, Oct 26, 2010 at 8:08 AM, Elizabeth Tasker <taskere at mcmaster.ca>
>>> wrote:
>>>
>>>
>>>> Hi Christine and Matt,
>>>>
>>>> Unfortunately, I don't have a Dark_Matter_Density field, just the
>>>> position,
>>>> velocities, type, mass and index. (From looking directly at the contents
>>>> of
>>>> XXXX.cpu0000).
>>>>
>>>> I'm afraid I also need my hand held more to use Matt's suggestion! Would
>>>> it
>>>> be possible to give me an example of how to call those functions? I tried
>>>> to
>>>> guess and failed miserably.
>>>>
>>>> Thank you~
>>>>
>>>> Elizabeth
>>>>
>>>>
>>>>
>>>>
>>>> Matthew Turk wrote:
>>>>
>>>>
>>>>> Hi Elizabeth,
>>>>>
>>>>> It should be. You can either do the CIC deposited DM density using
>>>>> the field "particle_density_pyx" (
>>>>> http://yt.enzotools.org/doc/api/field_list.html#particle-density-pyx )
>>>>> if you're on the 'stable' branch of the field "particle_density" if
>>>>> you're on the current development trunk. That will convert the DM to
>>>>> be like a baryon quantity.
>>>>>
>>>>> If you'd rather do raw particle binning, there is also functionality
>>>>> for that by using the x field "ParticleRadius" (
>>>>> http://yt.enzotools.org/doc/api/field_list.html#particleradius ) or
>>>>> one of its derivatives, and the y field "ParticleMassMsun".
>>>>>
>>>>> -Matt
>>>>>
>>>>> On Mon, Oct 25, 2010 at 5:27 PM, Elizabeth Tasker <taskere at mcmaster.ca>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'd like to plot dark matter particle density as a function of radius
>>>>>> for
>>>>>> my
>>>>>> particle-only simulation. Can I use add_profile_sphere, but for
>>>>>> particles
>>>>>> rather than gas? I only have a single halo and I know the halo it's
>>>>>> centred
>>>>>> in the middle of my box (or it better be, since I put it there!).
>>>>>>
>>>>>> Is this possible?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Elizabeth
>>>>>> _______________________________________________
>>>>>> yt-users mailing list
>>>>>> yt-users at lists.spacepope.org
>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users at lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users at lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
More information about the yt-users
mailing list