[yt-users] halos

Molly Peeples molly at astro.ucla.edu
Thu Mar 3 16:37:37 PST 2011


Hi all,

I have a few questions/errors regarding halo analysis.

First, I'm able to find halos and print information about them out to
an, e.g., HopAnalysis.out file.  Is there a way to read this kind of
information back in?  So far I have to re-run the halo finder every
time I want to get new information, which is rather inefficient.  (The
kludge of only looking for halos in a subvolume where I know there is
one kind of works but isn't ideal.)

Second, virial information.  When I try to get the virial mass or
radius I get errors like the following:
In [12]: m_vir = halo.virial_mass()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/molly-ucla/<ipython console> in <module>()

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in virial_mass(self, virial_overdensity, bins)
    297         >>> vm = halos[0].virial_mass()
    298         """
--> 299         self.virial_info(bins=bins)
    300         vir_bin =
self.virial_bin(virial_overdensity=virial_overdensity, bins=bins)
    301         if vir_bin != -1:

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in virial_info(self, bins)
    378         # can't see a way to eliminate a loop like this,
either here or in

    379         # yt.math.

--> 380         for pos in izip(self["particle_position_x"],
self["particle_position_y"],
    381                 self["particle_position_z"]):
    382             dist[mark] = periodic_dist(cen, pos, period)

NameError: global name 'izip' is not defined

In [13]: r_vir = halo.virial_radius()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/molly-ucla/<ipython console> in <module>()

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in virial_radius(self, virial_overdensity, bins)
    331         >>> vr = halos[0].virial_radius()
    332         """
--> 333         self.virial_info(bins=bins)
    334         vir_bin =
self.virial_bin(virial_overdensity=virial_overdensity, bins=bins)
    335         if vir_bin != -1:

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in virial_info(self, bins)
    378         # can't see a way to eliminate a loop like this,
either here or in

    379         # yt.math.

--> 380         for pos in izip(self["particle_position_x"],
self["particle_position_y"],
    381                 self["particle_position_z"]):
    382             dist[mark] = periodic_dist(cen, pos, period)

NameError: global name 'izip' is not defined


But other derived quantities like, e.g., halo.rms_velocity(), work
fine.  (I'm running everything on SDSC's triton, fwiw.)  Any ideas?




Finally, I've been unable to get the halo profiler to work.  I get
errors such as:
In [14]: import yt.analysis_modules.halo_profiler.api as HP

In [15]: hp = HP.HaloProfiler(fn)
yt : [INFO     ] 2011-03-03 16:21:35,715 Parameters: current_time
        = 9.61651661575
yt : [INFO     ] 2011-03-03 16:21:35,715 Parameters: domain_dimensions
        = [512, 512, 512]
yt : [INFO     ] 2011-03-03 16:21:35,715 Parameters: domain_left_edge
        = [ 0.  0.  0.]
yt : [INFO     ] 2011-03-03 16:21:35,716 Parameters: domain_right_edge
        = [ 1.  1.  1.]
yt : [INFO     ] 2011-03-03 16:21:35,716 Parameters:
cosmological_simulation   = 1
yt : [INFO     ] 2011-03-03 16:21:35,716 Parameters: current_redshift
        = 18.3172950912
yt : [INFO     ] 2011-03-03 16:21:35,716 Parameters: omega_lambda
        = 0.721
yt : [INFO     ] 2011-03-03 16:21:35,716 Parameters: omega_matter
        = 0.279
yt : [INFO     ] 2011-03-03 16:21:35,716 Parameters: hubble_constant
        = 0.701
yt : [INFO     ] 2011-03-03 16:21:35,717 Hop file not found, running
hop to get halos.
yt : [INFO     ] 2011-03-03 16:21:35,719 Getting particle_type using ParticleIO
['particle_type']
yt : [INFO     ] 2011-03-03 16:22:43,486 Getting field particle_type from 1507
yt : [INFO     ] 2011-03-03 16:23:16,501 Getting ParticleMassMsun
using ParticleIO
['particle_type', 'particle_mass']
yt : [INFO     ] 2011-03-03 16:24:03,160 Getting field
ParticleMassMsun from 1507
yt : [INFO     ] 2011-03-03 16:24:25,125 Initializing HOP
yt : [INFO     ] 2011-03-03 16:24:25,443 Getting particle_position_x
using ParticleIO
['particle_type', 'particle_position_x', 'ParticleMassMsun', 'particle_mass']
yt : [INFO     ] 2011-03-03 16:25:06,827 Getting field
particle_position_x from 1507
yt : [INFO     ] 2011-03-03 16:25:26,591 Getting particle_position_y
using ParticleIO
['particle_type', 'particle_position_x', 'ParticleMassMsun',
'particle_mass', 'particle_position_y']
yt : [INFO     ] 2011-03-03 16:26:14,612 Getting field
particle_position_y from 1507
yt : [INFO     ] 2011-03-03 16:26:25,516 Getting particle_position_z
using ParticleIO
['particle_type', 'particle_position_z', 'particle_position_x',
'particle_position_y', 'ParticleMassMsun', 'particle_mass']
yt : [INFO     ] 2011-03-03 16:27:17,495 Getting field
particle_position_z from 1507
failed allocating particles.
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)

/home/molly-ucla/<ipython console> in <module>()

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_profiler/multi_halo_profiler.pyc
in __init__(self, dataset, halos, halo_list_file, halo_list_format,
halo_finder_function, halo_finder_args, halo_finder_kwargs,
use_density_center, density_center_exponent, use_field_max_center,
halo_radius, radius_units, n_profile_bins, profile_output_dir,
projection_output_dir, projection_width, projection_width_units,
project_at_level, velocity_center, filter_quantities)
    229         elif self.halos is 'multiple':
    230             # Get hop data.

--> 231             self._load_halo_data()
    232             if len(self.all_halos) == 0:
    233                 mylog.error("No halos loaded, there will be
nothing to do.")

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_profiler/multi_halo_profiler.pyc
in _load_halo_data(self, filename)
    578         if not(os.path.exists(hopFile)):
    579             mylog.info("Hop file not found, running hop to get halos.")
--> 580             self._run_hop(hopFile)
    581
    582         self.all_halos = self._read_halo_list(hopFile)

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_profiler/multi_halo_profiler.pyc
in _run_hop(self, hopFile)
    689         "Run hop to get halos."
    690
--> 691         hop_results = self.halo_finder_function(self.pf,
*self.halo_finder_args, **self.halo_finder_kwargs)
    692         hop_results.write_out(hopFile)
    693

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in __init__(self, pf, subvolume, threshold, dm_only, padding)
   1841             sub_mass =
self._data_source["ParticleMassMsun"].sum(dtype='float64')
   1842         HOPHaloList.__init__(self, self._data_source,
-> 1843             threshold*total_mass/sub_mass, dm_only)
   1844         self._parse_halolist(total_mass/sub_mass)
   1845         self._join_halolists()

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in __init__(self, data_source, threshold, dm_only)
   1048         self.threshold = threshold
   1049         mylog.info("Initializing HOP")
-> 1050         HaloList.__init__(self, data_source, dm_only)
   1051
   1052     def _run_finder(self):

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in __init__(self, data_source, dm_only)
    801         self._max_dens = {}
    802         self.__obtain_particles()
--> 803         self._run_finder()
    804         mylog.info("Parsing outputs")
    805         self._parse_output()

/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.1dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_finding/halo_objects.pyc
in _run_finder(self)
   1056                 self.particle_fields["particle_position_z"] /
self.period[2],
   1057                 self.particle_fields["ParticleMassMsun"],
-> 1058                 self.threshold)
   1059         self.particle_fields["densities"] = self.densities
   1060         self.particle_fields["tags"] = self.tags

SystemError: error return without exception set


(FWIW, I was using halos = HaloFinder(pf) previously to find halos.)

The errors with both the virial information and halo profiler are
reproducible, but I just re-ran everything with the latest release of
yt so those are the errors you see.

Any help/pointers would be appreciated.

Thanks!
--Molly



More information about the yt-users mailing list