예제 #1
0
	tabdata = Table.read('TaipanCatalogues/wholehemisphere/'
		'Taipan.2MASS_selected.fits')
	print 'Generating targets...'
	all_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8)) for r in tabdata ]
		# if r[1] > 40 and r[1] < 53 and r[2] > -34 and r[2] < -26]
	no_targets = len(all_targets)
	end = datetime.datetime.now()
	delta = end - start
	print 'Imported & generated %d targets in %d:%02.1f' % (
		no_targets, delta.total_seconds()/60, 
		delta.total_seconds() % 60.)

	print 'Computing target difficulties...'
	start = datetime.datetime.now()
	tp.compute_target_difficulties(all_targets, verbose=True,
		leafsize=100000)
	end = datetime.datetime.now()
	delta = end - start
	print 'Time to compute %d difficulties: %d:%02.1f' % (
			no_targets, delta.total_seconds()/60, 
			delta.total_seconds() % 60.)
	sys.exit()

# Test single-distance computations
# print 'Computing tile candidates via comprehension...'
# start = datetime.datetime.now()
# candidates = [t for t in all_targets if t.dist_point((40., -32.))
# 	< tp.TILE_RADIUS]
# end = datetime.datetime.now()
# delta = end - start
# print 'Time to compute candidates via comprehension: %d:%02.1f' % (
예제 #2
0
    # if r[1] > 30 and r[1] < 50 and r[2] > -34 and r[2] < -26]
    end = datetime.datetime.now()
    delta = end - start
    print(
        'Imported & generated %d targets, %d guides and %d standards'
        ' in %d:%02.1f') % (len(all_targets), len(guide_targets),
                            len(standard_targets), delta.total_seconds() / 60,
                            delta.total_seconds() % 60.)

    print 'Calculating target US positions...'
    burn = [t.compute_usposn() for t in all_targets]

print 'Computing target difficulties...'
start = datetime.datetime.now()
no_targets = len(all_targets)
tp.compute_target_difficulties(all_targets)
end = datetime.datetime.now()
delta = end - start
print 'Computed %d target US posns. and difficulties in %d:%02.1f' % (
    len(all_targets), delta.total_seconds() / 60, delta.total_seconds() % 60.)

# tp.compute_target_difficulties(all_targets, ncpu=4)
# sys.exit()

# sys.exit()

# Ensure the objects are re type-cast as new instances of TaipanTarget
for t in all_targets:
    t.__class__ = tp.TaipanTarget
for t in guide_targets:
    t.__class__ = tp.TaipanTarget
예제 #3
0
    all_targets = [
        tp.TaipanTarget(str(r['mainid']),
                        r['raj2000'],
                        r['dej2000'],
                        priority=1,
                        mag=r['imag']) for r in tabdata
    ]
    # if r[1] > 20 and r[1] < 43 and r[2] > -34 and r[2] < -26]
    no_targets = len(all_targets)
    print "Targets: %d" % no_targets
    start = datetime.datetime.now()

    # KDTree calculation
    print 'Computing target difficulties...'
    start = datetime.datetime.now()
    tp.compute_target_difficulties(all_targets, verbose=True)
    end = datetime.datetime.now()
    delta = end - start
    print 'Mixed time: %d:%2.1f' % (delta.total_seconds() / 60,
                                    delta.total_seconds() % 60)

# del all_targets
# sys.exit()

# Ensure the objects are re type-cast as new instances of TaipanTarget
for t in all_targets:
    t.__class__ = tp.TaipanTarget

# Make a copy of all_targets list for use in assigning fibres
candidate_targets = all_targets[:]
random.shuffle(candidate_targets)
	standdata = Table.read('TaipanCatalogues/southernstrip/'
		'SCOSxAllWISE.photometry.KiDS.standards.fits')
	print 'Generating targets...'
	all_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8)) for r in tabdata #]
		if r[1] > 30 and r[1] < 50 and r[2] > -34 and r[2] < -26]
	guide_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8), guide=True) for r in guidedata #]
		if r[1] > 30 and r[1] < 50 and r[2] > -34 and r[2] < -26]
	standard_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8), standard=True) for r in
	standdata #]
		if r[1] > 30 and r[1] < 50 and r[2] > -34 and r[2] < -26]
	print 'Computing target difficulties...'
	no_targets = len(all_targets)
	tp.compute_target_difficulties(all_targets)

# tp.compute_target_difficulties(all_targets, ncpu=4)
# sys.exit()

# sys.exit()

# Ensure the objects are re type-cast as new instances of TaipanTarget
for t in all_targets:
	t.__class__ = tp.TaipanTarget
for t in guide_targets:
	t.__class__ = tp.TaipanTarget
for t in standard_targets:
	t.__class__ = tp.TaipanTarget

예제 #5
0
		# if r[1] > 40 and r[1] < 53 and r[2] > -34 and r[2] < -26]
	print 'Computing UC position for all targets...'
	for target in all_targets:
		target.compute_ucposn()
	no_targets = len(all_targets)
	end = datetime.datetime.now()
	delta = end - start
	print 'Imported & generated %d targets in %d:%02.1f' % (
		no_targets, delta.total_seconds()/60, 
		delta.total_seconds() % 60.)

# sys.exit()

print 'Computing target difficulties...'
start = datetime.datetime.now()
tp.compute_target_difficulties(all_targets, verbose=True)
end = datetime.datetime.now()
delta = end - start
print 'Time to compute %d difficulties: %d:%02.1f' % (
		no_targets, delta.total_seconds()/60, 
		delta.total_seconds() % 60.)
sys.exit()

# Test single-distance computations
# print 'Computing tile candidates via comprehension...'
# start = datetime.datetime.now()
# candidates = [t for t in all_targets if t.dist_point((40., -32.))
# 	< tp.TILE_RADIUS]
# end = datetime.datetime.now()
# delta = end - start
# print 'Time to compute candidates via comprehension: %d:%02.1f' % (
	all_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8)) for r in tabdata
		if r[1] > 40 and r[1] < 50 and r[2] > -34 and r[2] < -26]
	guide_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8), guide=True) for r in guidedata
		if r[1] > 40 and r[1] < 50 and r[2] > -34 and r[2] < -26]
	standard_targets = [tp.TaipanTarget(str(r[0]), r[1], r[2], 
		priority=random.randint(1,8), standard=True) for r in standdata
		if r[1] > 40 and r[1] < 50 and r[2] > -34 and r[2] < -26]
	print 'Computing target difficulties...'
	no_targets = len(all_targets)
	# for i in range(no_targets):
	# 	all_targets[i].compute_difficulty(all_targets)
	# 	if i % 100 == 99:
	# 		print 'Completed %d / %d' % (i+1, no_targets, )
	tp.compute_target_difficulties(all_targets, ncpu=4)

# sys.exit()

# Ensure the objects are re type-cast as new instances of TaipanTarget
for t in all_targets:
	t.__class__ = tp.TaipanTarget
for t in guide_targets:
	t.__class__ = tp.TaipanTarget
for t in standard_targets:
	t.__class__ = tp.TaipanTarget


# Make a copy of all_targets list for use in assigning fibres
candidate_targets = all_targets[:]
random.shuffle(candidate_targets)