1. Erik Tollerud
  2. IRATE-format

Commits

Shea Garrison-Kimmel  committed 6cf2509

fixed bugs in last commits (shouldn't have commited yet probably), and also fixed a typo in gadget.py that's been annoying me.

  • Participants
  • Parent commits 641cd45
  • Branches default

Comments (0)

Files changed (3)

File irate/enbid.py

View file
 #!/bin/python
 from __future__ import division
+import numpy as np
 
 def read_and_write_enbid_binary(fname,outname,snapnum,dset_name="EnBiDDensity",
     t0_name="Gas",t1_name="Dark_Halo",t2_name="Dark_Disk",
-    t3_name="Dark_Bulge",t4_name="Star",t5_name="Dark_Boundary",units_name,units_ar):
+    t3_name="Dark_Bulge",t4_name="Star",t5_name="Dark_Boundary",
+    units_name="1e10 M_sun per comoving Mpc^3 h^2",units_ar=np.array([6.767991e-31,2,-1])):
 
     """
     Reads an EnBiD binary file, as produced when run on a Gadget snapshot,
         snapnum = int(snapnum)
     except ValueError:
         raise ValueError("The number used for the snapshot is not an integer--please check and provide it by hand.")
-    print "\nOpening "+inname    
-    f = open(inname,'rb')
+    print "\nOpening "+fname    
+    f = open(fname,'rb')
 
     #Grab the cosmology to check that it's the same
     f.seek(4+24+48+8+8+4+4+24+4+4+8)   

File irate/gadget.py

View file
         print "Created new group for Snapshot{0:05}".format(snapnum)
     except ValueError:
         snap = irate["Snapshot{0:05}".format(snapnum)]
-        print "Adding data to exist group Snapshot{0:05}".format(snapnum)
+        print "Adding data to existing group Snapshot{0:05}".format(snapnum)
         
     #Now I want to know what particles I have, so I can only create groups for those that have particles
     #First read the header so I know how many particles of each type I have

File scripts/enbid2irate

View file
 #!/usr/bin/env python
 import sys
 from optparse import OptionParser,OptionGroup
-from irate.enbid import read_and_write_enbid
+from irate.enbid import read_and_write_enbid_binary
 from numpy import array
 
 usage = "usage:  %prog <EnBiD binary file> <IRATE file> <snapshot number> [options]"
 unitoptions.add_option("--afact",dest="afact",type="float",help="The exponent of the scale factor that is required to convert into physical units.  Default = %default (comoving)",default=-1)
 
 parser.add_option_group(unitoptions)
-parser.add_option_group(cosmooptions)
+#parser.add_option_group(cosmooptions)
 parser.add_option_group(outoptions)
 
 
         print "Sorry, names for groups must start with either 'Gas', 'Dark', or 'Star'."
 
 try:
-    read_and_write_enbid_binary(inname,outname,snapnum,,ops.gname,
+    read_and_write_enbid_binary(inname,outname,snapnum,ops.gname,
     ops.gasname,ops.haloname,ops.diskname,ops.bulgename,ops.starname,ops.bndryname,
     ops.uname,units)
 except Exception,e: