1. Erik Tollerud
  2. IRATE-format


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
 from __future__ import division
+import numpy as np
 def read_and_write_enbid_binary(fname,outname,snapnum,dset_name="EnBiDDensity",
-    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

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)
         print "Sorry, names for groups must start with either 'Gas', 'Dark', or 'Star'."
-    read_and_write_enbid_binary(inname,outname,snapnum,,ops.gname,
+    read_and_write_enbid_binary(inname,outname,snapnum,ops.gname,
 except Exception,e: