from yt.mods import *
from yt.analysis_modules.halo_profiler.api import *
from yt.analysis_modules.halo_finding.api import *

output = 108
hp = HaloProfiler('output_%04i'%output,output_dir="Halos",
     halo_list_file='DD0108.out',halos='single',n_profile_bins=100
     ,velocity_center=['bulk','sphere'],projection_width=1e-2 )

#hp.add_profile('CellVolume', weight_field=None, accumulation=True)
#hp.add_profile('TotalMassMsun', weight_field=None, accumulation=True)
#hp.add_profile('Density', weight_field=None, accumulation=False)
#hp.add_profile('Dark_Matter_Density', weight_field=None, accumulation=False)
#hp.add_profile('StarMassMsun', weight_field=None, accumulation=True)
#hp.add_profile('Temperature', weight_field='CellMassMsun', accumulation=False)

#hp.add_halo_filter(HP.VirialFilter, must_be_virialized=True,
#                   overdensity_field='ActualOverdensity',
#                   virial_overdensity=200,
#                   virial_filters=[['TotalMassMsun','>=','1e7']],
#                   virial_quantities=['TotalMassMsun','RadiusMpc'],
#                   use_log=True)

#hp.make_profiles(njobs=-1, prefilters=["halo['mass'] > 1e7"],
#                 filename='VirialQuantities.h5')
hp.add_projection('Density', weight_field=None)
#hp.add_projection('Temperature', weight_field='Density')
#hp.add_projection('Metallicity', weight_field='Density')
hp.make_projections(axes=[0, 1, 2], save_cube=False, save_images=True,
                    halo_list="all", njobs=64)

