parameters: (build_dir="")
return_statement: return True
docstring: Grabs the EAF activation data files
      if not already present.
  
      Parameters
      ----------
      build_dir : str
          Major directory to place EAF data file(s) in. 'EAF/' will be appended.
docstring_summary: Grabs the EAF activation data files
      if not already present.
docstring_tokens: Grabs the EAF activation data files if not already present .
function: def grab_eaf_data(build_dir=""):
      """Grabs the EAF activation data files
      if not already present.
  
      Parameters
      ----------
      build_dir : str
          Major directory to place EAF data file(s) in. 'EAF/' will be appended.
      """
      # Add EAF to build_dir
      build_dir = os.path.join(build_dir, 'EAF')
      try:
          os.makedirs(build_dir)
          print("{0} created".format(build_dir))
      except OSError:
          pass
  
      # Grab ENSDF files and unzip them.
      # This link was taken from 'http://www-nds.iaea.org/fendl/fen-activation.htm'
      iaea_url = 'http://www-nds.iaea.org/fendl2/activation/processed/vitj_e/libout/fendlg-2.0_175-gz'
      cf_base_url = 'https://github.com/pyne/data/raw/master/'
      eaf_gzip = 'fendlg-2.0_175-gz'
  
      fpath = os.path.join(build_dir, eaf_gzip)
      if eaf_gzip not in os.listdir(build_dir):
          print("  grabbing {0} and placing it in {1}".format(eaf_gzip, fpath))
          try:
              urllib.urlretrieve(iaea_url, fpath)
          except (OSError, IOError):
              open(fpath, 'a').close()  # touch the file
  
          if os.path.getsize(fpath) < 3215713: 
              print("  could not get {0} from IAEA; trying S3 mirror".format(eaf_gzip))
              os.remove(fpath)
              try:
                  urllib.urlretrieve(cf_base_url + eaf_gzip, fpath)
              except (OSError, IOError):
                  open(fpath, 'a').close()  # touch the file
              if os.path.getsize(fpath) < 3215713: 
                  print("  could not get {0} from S3 mirror".format(eaf_gzip))
                  return False
  
      # Write contents of single-file gzip archive to a new file
      try:
          gf = GzipFile(fpath)
          ofile = os.path.join(build_dir, 'fendlg-2.0_175')
          with open(ofile, 'w') as fw:
              for line in gf:
                  fw.write(line.decode("us-ascii"))
      finally:
          gf.close()
          
      return True
function_tokens: def grab_eaf_data ( build_dir = "" ) : # Add EAF to build_dir build_dir = os . path . join ( build_dir , 'EAF' ) try : os . makedirs ( build_dir ) print ( "{0} created" . format ( build_dir ) ) except OSError : pass # Grab ENSDF files and unzip them. # This link was taken from 'http://www-nds.iaea.org/fendl/fen-activation.htm' iaea_url = 'http://www-nds.iaea.org/fendl2/activation/processed/vitj_e/libout/fendlg-2.0_175-gz' cf_base_url = 'https://github.com/pyne/data/raw/master/' eaf_gzip = 'fendlg-2.0_175-gz' fpath = os . path . join ( build_dir , eaf_gzip ) if eaf_gzip not in os . listdir ( build_dir ) : print ( "  grabbing {0} and placing it in {1}" . format ( eaf_gzip , fpath ) ) try : urllib . urlretrieve ( iaea_url , fpath ) except ( OSError , IOError ) : open ( fpath , 'a' ) . close ( ) # touch the file if os . path . getsize ( fpath ) < 3215713 : print ( "  could not get {0} from IAEA; trying S3 mirror" . format ( eaf_gzip ) ) os . remove ( fpath ) try : urllib . urlretrieve ( cf_base_url + eaf_gzip , fpath ) except ( OSError , IOError ) : open ( fpath , 'a' ) . close ( ) # touch the file if os . path . getsize ( fpath ) < 3215713 : print ( "  could not get {0} from S3 mirror" . format ( eaf_gzip ) ) return False # Write contents of single-file gzip archive to a new file try : gf = GzipFile ( fpath ) ofile = os . path . join ( build_dir , 'fendlg-2.0_175' ) with open ( ofile , 'w' ) as fw : for line in gf : fw . write ( line . decode ( "us-ascii" ) ) finally : gf . close ( ) return True