original_docstring: Add file info to the h5 file with all the results. 
  
      filename: string of file name, including directory and .dat extension 
      individual: tuple with parameters 
      gen: generation number, starting from 0
      
docstring: Add file info to the h5 file with all the results.
  filename: string of file name, including directory and .dat extension
  individual: tuple with parameters
  gen: generation number, starting from 0
docstring_tokens: Add file info to the h5 file with all the results . filename : string of file name including directory and . dat extension individual : tuple with parameters gen : generation number starting from 0
code: def add_to_matrix(h5, filename, individual, generation):
      '''Add file info to the h5 file with all the results. 
  
      filename: string of file name, including directory and .dat extension 
      individual: tuple with parameters 
      gen: generation number, starting from 0
      '''
      gen = "g"+str(generation)
      ind = make_string(individual,"_")
  
      try:# if ind not in h5[gen]:
          h5[gen].create_dataset(ind, data = [1])
  
          try: # if os.path.exists(filename):
          	content = np.loadtxt(filename,converters={0: fix_wrong_string})
          except IOError:
          	print "Error in AM3: File", filename[35:], "does not exist"
          	content = np.full(3+2*BIN_X+BIN_P+1,0.)
  
          sed_internal = content[3:3+BIN_X] # in-source density 
          nu = content[3+BIN_X:3+BIN_X+BIN_P]
          sed_observed = content[3+BIN_X+BIN_P:3+2*BIN_X+BIN_P]
  
          try: # if ind not in h5["seds"]:
              h5["seds"].create_dataset(ind, data=sed_observed)
              h5["photon_density"].create_dataset(ind, data=sed_internal)
              h5["neutrinos"].create_dataset(ind, data=nu)
          except RuntimeError:
          	pass
  
      except RuntimeError:
          val = np.array(h5[gen][ind])[0]
          del h5[gen][ind]
          print "Repeated parameter set:", val+1
          h5[gen].create_dataset(ind, data = [val + 1])
code_tokens: def add_to_matrix ( h5 , filename , individual , generation ) : gen = "g" + str ( generation ) ind = make_string ( individual , "_" ) try : h5 [ gen ] . create_dataset ( ind , data = [ 1 ] ) try : content = np . loadtxt ( filename , converters = { 0 : fix_wrong_string } ) except IOError : print "Error in AM3: File" , filename [ 35 : ] , "does not exist" content = np . full ( 3 + 2 * BIN_X + BIN_P + 1 , 0. ) sed_internal = content [ 3 : 3 + BIN_X ] nu = content [ 3 + BIN_X : 3 + BIN_X + BIN_P ] sed_observed = content [ 3 + BIN_X + BIN_P : 3 + 2 * BIN_X + BIN_P ] try : h5 [ "seds" ] . create_dataset ( ind , data = sed_observed ) h5 [ "photon_density" ] . create_dataset ( ind , data = sed_internal ) h5 [ "neutrinos" ] . create_dataset ( ind , data = nu ) except RuntimeError : pass except RuntimeError : val = np . array ( h5 [ gen ] [ ind ] ) [ 0 ] del h5 [ gen ] [ ind ] print "Repeated parameter set:" , val + 1 h5 [ gen ] . create_dataset ( ind , data = [ val + 1 ] )
short_docstring: Add file info to the h5 file with all the results.
short_docstring_tokens: Add file info to the h5 file with all the results .
comment: '''Add file info to the h5 file with all the results. 
  
      filename: string of file name, including directory and .dat extension 
      individual: tuple with parameters 
      gen: generation number, starting from 0
      '''$SEP$# if ind not in h5[gen]:$SEP$# if os.path.exists(filename):$SEP$# in-source density $SEP$# if ind not in h5["seds"]: