Ejemplo n.º 1
0
options.multiple_input(parser)
options.single_output(parser)
options.merge(parser)
(opts, args) = parser.parse_args()

if not opts.input_files and not opts.input_file_list:
    parser.error('Input filename(s) not provided.')
if not opts.output_file:
    parser.error('Output filename not provided.')
if not opts.bg_expect:
    parser.error('Expected background density not provided.')

# Read List of Files:

if opts.input_file_list:
    errors.file_name_error(opts.input_file_list)
    file_list = np.genfromtxt(opts.input_file_list, dtype="S", unpack=True)
elif opts.input_files:
    file_list = opts.input_files

# Read Files and Store Elements in Clusters:

clusters = []
cluster_count = 0

for file in file_list:
    errors.file_name_error(file)
    print 'Reading: ', file
    c_id, g_num, g_id, g_ra, g_dec, g_z = read_file(file)
    cluster_list = np.unique(c_id)
    for clt in cluster_list:
Ejemplo n.º 2
0
                  default=range(0, 6),
                  help=c_col_help)

(opts, args) = parser.parse_args()

if not opts.cluster_file:
    parser.error('Cluster file name not provided.')
if not opts.mock_file:
    parser.error('Mock file name not provided.')

#############
# READ DATA #
#############

#make sure files exit
errors.file_name_error(opts.mock_file)
errors.file_name_error(opts.cluster_file)

print '================================================================='

#read mock catalogue
print 'Reading file:', opts.mock_file,
mock = np.genfromtxt(opts.mock_file, dtype="S", unpack=True)[opts.m_cols]
dtypes = [('id', 'S22'), ('cen', 'i4'), ('ra', 'f8'), ('dec', 'f8'),
          ('z', 'f8'), ('rich', 'f8'), ('mass', 'f8'), ('r200', 'f8'),
          ('minra', 'f8'), ('maxra', 'f8'), ('mindec', 'f8'), ('maxdec', 'f8')]
mock = np.core.records.fromarrays(mock, dtype=dtypes)
mock.rich = np.log10(mock.rich)
print '\tComplete:', len(mock)

#read cluster catalogue
Ejemplo n.º 3
0
options.multiple_input(parser)
options.single_output(parser)
options.merge(parser)
(opts, args) = parser.parse_args()
 
if not opts.input_files and not opts.input_file_list:
    parser.error('Input filename(s) not provided.')
if not opts.output_file:
    parser.error('Output filename not provided.')
if not opts.bg_expect:
    parser.error('Expected background density not provided.')

# Read List of Files:

if opts.input_file_list:
    errors.file_name_error(opts.input_file_list)             
    file_list = np.genfromtxt(opts.input_file_list, dtype="S", unpack = True)
elif opts.input_files:
    file_list = opts.input_files
    
# Read Files and Store Elements in Clusters:

clusters = []
cluster_count = 0

for file in file_list:
    errors.file_name_error(file)
    print 'Reading: ', file             
    c_id, g_num, g_id, g_ra, g_dec, g_z = read_file(file)
    cluster_list = np.unique(c_id)
    for clt in cluster_list:
Ejemplo n.º 4
0
         mass_bin_size = float(arg)
      elif opt in ("-i", "--min_z_bin"):                                                   #set minimum for binning in redshift
         min_z_bin = float(arg)
      elif opt in ("-j", "--max_z_bin"):                                                   #set maximum for binning in redshift
         max_z_bin = float(arg)
      elif opt in ("-k", "--z_bin_size"):                                                  #set size of bins in redshift
         z_bin_size = float(arg)
      else:
         print 'Something is wrong!'
         sys.exit(2)

   #############
   # READ DATA #
   #############
         
   errors.file_name_error(mock_file)                                                       #make sure files exit
   errors.file_name_error(cluster_file)

   print '================================================================='
   
   print 'Reading file:', mock_file,        
   mock_data = np.genfromtxt(mock_file, dtype="S", unpack = True)                          #mock haloes
   print '\tComplete'
   print 'Reading file:', cluster_file,        
   cluster_data = np.genfromtxt(cluster_file, dtype="S", unpack = True)                    #clusters
   print '\tComplete'

   ####################
   # DEFINE VARIABLES #
   ####################
Ejemplo n.º 5
0
parser = optparse.OptionParser()
parser.add_option("-c", "--cluster_file", dest = "cluster_file", help = "Input cluster file name.")
parser.add_option("-m", "--mock_file", dest = "mock_file", help = "Input mock file name.")
parser.add_option("-z", "--delta_z", dest = "delta_z", type = "float", help = "Delta_z value. [Default 0.03]")
(opts, args) = parser.parse_args()
    
if not opts.cluster_file:
    parser.error('Cluster file name not provided.')
if not opts.mock_file:
    parser.error('Mock file name not provided.')
  
#############
# READ DATA #
#############
         
errors.file_name_error(opts.mock_file)                                                       #make sure files exit
errors.file_name_error(opts.cluster_file)

print '================================================================='
   
print 'Reading file:', opts.mock_file,        
mock_data = np.genfromtxt(opts.mock_file, dtype="S", unpack = True)                          #mock haloes
print '\tComplete'
print 'Reading file:', opts.cluster_file,        
cluster_data = np.genfromtxt(opts.cluster_file, dtype="S", unpack = True)                    #clusters
print '\tComplete'

####################
# DEFINE VARIABLES #
####################