Left: | ||
Right: |
OLD | NEW |
---|---|
1 """ | 1 """ |
2 HOP-output data handling | 2 HOP-output data handling |
3 | 3 |
4 Author: Matthew Turk <matthewturk@gmail.com> | 4 Author: Matthew Turk <matthewturk@gmail.com> |
5 Affiliation: KIPAC/SLAC/Stanford | 5 Affiliation: KIPAC/SLAC/Stanford |
6 Author: Stephen Skory <stephenskory@yahoo.com> | 6 Author: Stephen Skory <stephenskory@yahoo.com> |
7 Affiliation: UCSD Physics/CASS | 7 Affiliation: UCSD Physics/CASS |
8 Homepage: http://yt.enzotools.org/ | 8 Homepage: http://yt.enzotools.org/ |
9 License: | 9 License: |
10 Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved. | 10 Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 return com | 165 return com |
166 | 166 |
167 def maximum_density(self): | 167 def maximum_density(self): |
168 return -1 | 168 return -1 |
169 | 169 |
170 def maximum_density_location(self): | 170 def maximum_density_location(self): |
171 return self.center_of_mass() | 171 return self.center_of_mass() |
172 | 172 |
173 class HaloList(object): | 173 class HaloList(object): |
174 | 174 |
175 _fields = ["particle_position_%s" % ax for ax in 'xyz'] | 175 _fields = ["particle_position_%s" % ax for ax in 'xyz',"particle_velocity_%s " % ax for ax in 'xyz'] |
matthewturk
2009/04/27 15:24:55
This line is too long, split it to the next one.
| |
176 | 176 |
177 def __init__(self, data_source, dm_only = True): | 177 def __init__(self, data_source, dm_only = True): |
178 """ | 178 """ |
179 Run hop on *data_source* with a given density *threshold*. If | 179 Run hop on *data_source* with a given density *threshold*. If |
180 *dm_only* is set, only run it on the dark matter particles, otherwise | 180 *dm_only* is set, only run it on the dark matter particles, otherwise |
181 on all particles. Returns an iterable collection of *HopGroup* items. | 181 on all particles. Returns an iterable collection of *HopGroup* items. |
182 """ | 182 """ |
183 self.data_source = data_source | 183 self.data_source = data_source |
184 self.dm_only = dm_only | 184 self.dm_only = dm_only |
185 self._groups = [] | 185 self._groups = [] |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
394 # This only does periodicity. We do NOT want to deal with anything | 394 # This only does periodicity. We do NOT want to deal with anything |
395 # else. The only reason we even do periodicity is the· | 395 # else. The only reason we even do periodicity is the· |
396 LE, RE = bounds | 396 LE, RE = bounds |
397 dw = self.pf["DomainRightEdge"] - self.pf["DomainLeftEdge"] | 397 dw = self.pf["DomainRightEdge"] - self.pf["DomainLeftEdge"] |
398 for i, ax in enumerate('xyz'): | 398 for i, ax in enumerate('xyz'): |
399 arr = self.data_source["particle_position_%s" % ax] | 399 arr = self.data_source["particle_position_%s" % ax] |
400 arr[arr < LE[i]-self.padding] += dw[i] | 400 arr[arr < LE[i]-self.padding] += dw[i] |
401 arr[arr > RE[i]+self.padding] -= dw[i] | 401 arr[arr > RE[i]+self.padding] -= dw[i] |
402 | 402 |
403 def write_out(self, filename): | 403 def write_out(self, filename): |
404 self.data_source.get_data(["particle_velocity_%s" % ax for ax in 'xyz']) | |
matthewturk
2009/04/27 15:24:55
This is redundant with the line above; additionall
| |
404 f = self._write_on_root(filename) | 405 f = self._write_on_root(filename) |
405 HaloList.write_out(self, f) | 406 HaloList.write_out(self, f) |
406 | 407 |
407 @parallel_blocking_call | 408 @parallel_blocking_call |
408 def write_particle_lists(self, prefix): | 409 def write_particle_lists(self, prefix): |
409 fn = "%s.h5" % self._get_filename(prefix) | 410 fn = "%s.h5" % self._get_filename(prefix) |
410 f = tables.openFile(fn, "w") | 411 f = tables.openFile(fn, "w") |
411 for halo in self._groups: | 412 for halo in self._groups: |
412 if not self._is_mine(halo): continue | 413 if not self._is_mine(halo): continue |
413 halo.write_particle_list(f) | 414 halo.write_particle_list(f) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 padded, LE, RE, self.data_source = self._partition_hierarchy_3d(padding= self.padding) | 453 padded, LE, RE, self.data_source = self._partition_hierarchy_3d(padding= self.padding) |
453 self.bounds = (LE, RE) | 454 self.bounds = (LE, RE) |
454 # reflect particles around the periodic boundary | 455 # reflect particles around the periodic boundary |
455 self._reposition_particles((LE, RE)) | 456 self._reposition_particles((LE, RE)) |
456 # here is where the FOF halo finder is run | 457 # here is where the FOF halo finder is run |
457 FOFHaloList.__init__(self, self.data_source, link * avg_spacing, dm_only ) | 458 FOFHaloList.__init__(self, self.data_source, link * avg_spacing, dm_only ) |
458 self._parse_halolist(1.) | 459 self._parse_halolist(1.) |
459 self._join_halolists() | 460 self._join_halolists() |
460 | 461 |
461 HaloFinder = HOPHaloFinder | 462 HaloFinder = HOPHaloFinder |
OLD | NEW |