Commits

Shea Garrison-Kimmel committed 71f3c33

Fix to AHF to deal with three new columns being added to the halos file.

Comments (0)

Files changed (1)

     #if not gas, then I only have to worry about the Center, Velocity, angular momentum, and the inertia tensor (Eax, etc.)
     #if gas, then I have to worry about Center, Velocity, L, Inertia tensor, plus L_gas, inertia tensor_gas, L_star, and inertial tensor_star
     if nogas:
-        toseparate = ['Xc','Yc','Zc','VXc','VYc','VZc','Lx','Ly','Lz','Eax','Eay','Eaz','Ebx','Eby','Ebz','Ecx','Ecy','Ecz']        #The column heads that I do need to combine
+        toseparate = ['Xc','Yc','Zc','VXc','VYc','VZc','Lx','Ly','Lz','Eax','Eay','Eaz','Ebx','Eby','Ebz','Ecx','Ecy','Ecz','mbp_Vx','mbp_Vy','mbp_Vz']        #The column heads that I do need to combine
         mycoldata = [coldata[i] for i in range(len(coldata)) if not comments[i] in toseparate]   #All the data that I don't need to combine    
         mycolheads = [comments[i] for i in range(len(coldata)) if not comments[i] in toseparate]
         
         mycoldata.append(array(zip(coldata[where(comments=='Ecx')[0][0]],coldata[where(comments=='Ecy')[0][0]],coldata[where(comments=='Ecz')[0][0]])))  
         unitnames.append(None)
         unitcgs.append(None)
+        if "mbp_Vx" in comments:        
+            mycolheads.append('mbp_V')
+            mycoldata.append(array(zip(coldata[where(comments=="mbp_Vx")[0][0]],coldata[where(comments=="mbp_Vy")[0][0]],coldata[where(comments=="mbp_Vz")[0][0]])))
+            unitnames.append(velname)
+            unitcgs.append(velunit)
     
     else:    
         toseparate = ['Xc','Yc','Zc','VXc','VYc','VZc','Lx','Ly','Lz','Eax','Eay','Eaz','Ebx','Eby','Ebz','Ecx','Ecy','Ecz',
             'Lx_gas','Ly_gas','Lz_gas','Eax_gas','Eay_gas','Eaz_gas','Ebx_gas','Eby_gas','Ebz_gas','Ecx_gas','Ecy_gas','Ecz_gas',
-            'Lx_star','Ly_star','Lz_star','Eax_star','Eay_star','Eaz_star','Ebx_star','Eby_star','Ebz_star','Ecx_star','Ecy_star','Ecz_star']        
+            'Lx_star','Ly_star','Lz_star','Eax_star','Eay_star','Eaz_star','Ebx_star','Eby_star','Ebz_star','Ecx_star','Ecy_star','Ecz_star','mbp_Vx','mbp_Vy','mbp_Vz']        
         mycoldata = [coldata[i] for i in range(len(coldata)) if not comments[i] in toseparate]   #All the data that I don't need to combine    
         mycolheads = [comments[i] for i in range(len(coldata)) if not comments[i] in toseparate]
         
         mycoldata.append(array(zip(coldata[where(comments=='Ecx_star')[0][0]],coldata[where(comments=='Ecy_star')[0][0]],coldata[where(comments=='Ecz_star')[0][0]])))     
         unitnames.append(None)
         unitcgs.append(None)
-    
+        if "mbp_Vx" in comments:
+            mycolheads.append('mbp_V')
+            mycoldata.append(array(zip(coldata[where(comments=="mbp_Vx")[0][0]],coldata[where(comments=="mbp_Vy")[0][0]],coldata[where(comments=="mbp_Vz")[0][0]])))
+            unitnames.append(velname)
+            unitcgs.append(velunit)
     """
     coldata = empty([len(data[0]),len(data)])   #So it's an array with N_attributes columns and N_halos rows
     for j in range(len(data)):
     #Check again that I haven't messed up anywhere.  If this runs successfully, remove this bit:
     assert len(unitnames) == len(unitcgs)
     assert len(unitnames) == len(mycolheads)
-    assert len(mycolheads) == len(mycoldata)  
+    assert len(mycolheads) == len(mycoldata)
     
     #Now to write the data to a file
     if os.path.isfile(outname):