Exemplo n.º 1
0
ax.set_ylim(test_tile_y - 4., test_tile_y + 4.)

candidate_targets = [t for t in candidate_targets 
	if t.dist_point((test_tile.ra, test_tile.dec)) < tp.TILE_RADIUS]
ax.plot([t.ra for t in candidate_targets], [t.dec for t in candidate_targets],
	marker='o', ms=1, mec='gray', mfc='gray', lw=0)
if alloc_method in ['combined_weighted', 'priority', 'sequential']:
	high_pris = [t for t in candidate_targets 
		if t.priority == tp.TARGET_PRIORITY_MAX]
	ax.plot([t.ra for t in high_pris], [t.dec for t in high_pris],
		marker='x', ms=7, mec='gray', mfc='gray', lw=0)

ax.plot([test_tile.ra], [test_tile.dec], 'kx', ms=12)
# tile_circ = mpatches.Circle((test_tile.ra, test_tile.dec),
# 	radius=tp.TILE_RADIUS / 3600., edgecolor='k', facecolor='none', lw=3)
tile_verts = np.asarray([tp.compute_offset_posn(test_tile.ra, test_tile.dec, tp.TILE_RADIUS, float(p)) for p in range(361)])
tile_circ = mpatches.Polygon(tile_verts, closed=False,
	edgecolor='k', facecolor='none', lw=3)
ax.add_patch(tile_circ)

for fibre in tp.BUGPOS_OFFSET:
	fibre_posn = test_tile.compute_fibre_posn(fibre)
	ax.plot(fibre_posn[0], fibre_posn[1], 'g+', ms=8)
	# ax.plot(test_tile.ra + tp.BUGPOS_ARCSEC[fibre][0]/3600.,
	# 	test_tile.dec + tp.BUGPOS_ARCSEC[fibre][1]/3600.,
	# 	'bx', ms=8)
	# fibre_circ = mpatches.Circle(fibre_posn, radius=tp.PATROL_RADIUS / 3600.,
	# 	edgecolor='b', facecolor='none', ls='dashed', lw=0.5)

	# fibre_targets = [t for t in candidate_targets 
	# 	if t.dist_point(fibre_posn) < tp.PATROL_RADIUS]
	for j in np.arange(180.):
		points_list[i].append((i, j - 90.))

# Compute displacements of FIBRE_EXCLUSION_RADIUS
no_disp = 8
delta_disp = 360. / float(no_disp)
points_disps = np.zeros((len(points_list), len(points_list[0]), no_disp))
points_disps = points_disps.tolist()

for i in range(len(points_list)):
	for j in range(len(points_list[0])):
		for k in range(no_disp):
			# Compute the positions
			points_disps[i][j][k] = tp.compute_offset_posn(
				points_list[i][j][0],
				points_list[i][j][1],
				tp.FIBRE_EXCLUSION_RADIUS,
				k * delta_disp)

clf()
fig = gcf()
fig.set_size_inches(12,12)

ax1 = fig.add_subplot(221)
ax1.set_title('Average of all offsets')

dists_full = np.zeros((len(points_list), len(points_list[0])))
dists_approx = np.zeros((len(points_list), len(points_list[0])))

for i in range(len(points_list)):
	for j in range(len(points_list[0])):
Exemplo n.º 3
0
if alloc_method in ['combined_weighted', 'priority', 'sequential']:
    high_pris = [
        t for t in candidate_targets if t.priority == tp.TARGET_PRIORITY_MAX
    ]
    ax.plot([t.ra for t in high_pris], [t.dec for t in high_pris],
            marker='x',
            ms=7,
            mec='gray',
            mfc='gray',
            lw=0)

ax.plot([test_tile.ra], [test_tile.dec], 'kx', ms=12)
# tile_circ = mpatches.Circle((test_tile.ra, test_tile.dec),
# 	radius=tp.TILE_RADIUS / 3600., edgecolor='k', facecolor='none', lw=3)
tile_verts = np.asarray([
    tp.compute_offset_posn(test_tile.ra, test_tile.dec, tp.TILE_RADIUS,
                           float(p)) for p in range(361)
])
tile_circ = mpatches.Polygon(tile_verts,
                             closed=False,
                             edgecolor='k',
                             facecolor='none',
                             lw=3)
ax.add_patch(tile_circ)

for fibre in tp.BUGPOS_OFFSET:
    fibre_posn = test_tile.compute_fibre_posn(fibre)
    ax.plot(fibre_posn[0], fibre_posn[1], 'g+', ms=8)
    # ax.plot(test_tile.ra + tp.BUGPOS_ARCSEC[fibre][0]/3600.,
    # 	test_tile.dec + tp.BUGPOS_ARCSEC[fibre][1]/3600.,
    # 	'bx', ms=8)
    # fibre_circ = mpatches.Circle(fibre_posn, radius=tp.PATROL_RADIUS / 3600.,
ax.set_xlim(test_tile_x - 4., test_tile_x + 4.)
ax.set_ylim(test_tile_y - 4., test_tile_y + 4.)
candidate_targets = [t for t in candidate_targets 
	if t.dist_point((test_tile.ra, test_tile.dec)) < tp.TILE_RADIUS]
ax.plot([t.ra for t in candidate_targets], [t.dec for t in candidate_targets],
	marker='o', ms=1, mec='gray', mfc='gray', lw=0)
if alloc_method in ['combined_weighted', 'priority', 'sequential']:
	high_pris = [t for t in candidate_targets 
		if t.priority == tp.TARGET_PRIORITY_MAX]
	ax.plot([t.ra for t in high_pris], [t.dec for t in high_pris],
		marker='x', ms=7, mec='gray', mfc='gray', lw=0)

ax.plot([test_tile.ra], [test_tile.dec], 'kx', ms=12)
# tile_circ = mpatches.Circle((test_tile.ra, test_tile.dec),
# 	radius=tp.TILE_RADIUS / 3600., edgecolor='k', facecolor='none', lw=3)
tile_verts = np.asarray([tp.compute_offset_posn(test_tile.ra, test_tile.dec, tp.TILE_RADIUS, float(p)) for p in range(361)])
tile_circ = mpatches.Polygon(tile_verts, closed=False,
	edgecolor='k', facecolor='none', lw=3)
ax.add_patch(tile_circ)

for fibre in tp.BUGPOS_OFFSET:
	fibre_posn = test_tile.compute_fibre_posn(fibre)
	ax.plot(fibre_posn[0], fibre_posn[1], 'g+', ms=8)
	# ax.plot(test_tile.ra + tp.BUGPOS_ARCSEC[fibre][0]/3600.,
	# 	test_tile.dec + tp.BUGPOS_ARCSEC[fibre][1]/3600.,
	# 	'bx', ms=8)
	# fibre_circ = mpatches.Circle(fibre_posn, radius=tp.PATROL_RADIUS / 3600.,
	# 	edgecolor='b', facecolor='none', ls='dashed', lw=0.5)

	# fibre_targets = [t for t in candidate_targets 
	# 	if t.dist_point(fibre_posn) < tp.PATROL_RADIUS]
print 'Done!'

tile_list = [tile for tile in tile_list if tile.ra < 53.]
tile_list = [tile for tile in tile_list if tile.dec > -36. and tile.dec < -26.]
print len(tile_list)
# sys.exit()

clf()
fig = gcf()
ax = fig.add_subplot(111, projection='aitoff')
ax.grid(True)

print 'Commencing plotting...'
i = 1
for tile in tile_list:
	tile_verts = np.asarray([tp.compute_offset_posn(tile.ra, 
		tile.dec, tp.TILE_RADIUS, float(p)) for p in range(361)])
	tile_verts = np.asarray([tp.aitoff_plottable(xy, ra_offset=180.) for xy
		in tile_verts])
	ec = 'k'
	if i == 1:
		ec = 'r'
	tile_circ = mpatches.Polygon(tile_verts, closed=False,
		edgecolor=ec, facecolor='none', lw=.7)
	ax.add_patch(tile_circ)
	# ax.plot([np.radians(t.ra - 180.) for t in tile_list], [np.radians(t.dec) for t in tile_list],
	# 	'ko', lw=0, ms=1)
	i += 1

show()
draw()
# fig.savefig('tiling.png', fmt='png')
    points_list.append([])
    for j in np.arange(180.):
        points_list[i].append((i, j - 90.))

# Compute displacements of FIBRE_EXCLUSION_RADIUS
no_disp = 8
delta_disp = 360. / float(no_disp)
points_disps = np.zeros((len(points_list), len(points_list[0]), no_disp))
points_disps = points_disps.tolist()

for i in range(len(points_list)):
    for j in range(len(points_list[0])):
        for k in range(no_disp):
            # Compute the positions
            points_disps[i][j][k] = tp.compute_offset_posn(
                points_list[i][j][0], points_list[i][j][1],
                tp.FIBRE_EXCLUSION_RADIUS, k * delta_disp)

clf()
fig = gcf()
fig.set_size_inches(12, 12)

ax1 = fig.add_subplot(221)
ax1.set_title('Average of all offsets')

dists_full = np.zeros((len(points_list), len(points_list[0])))
dists_approx = np.zeros((len(points_list), len(points_list[0])))

for i in range(len(points_list)):
    for j in range(len(points_list[0])):
        dists_full[i, j] = np.average([
tile_list = tl.generate_SH_tiling("ipack.3.8192.txt", randomise_seed=True, randomise_pa=True)
print "Done!"

tile_list = [tile for tile in tile_list if tile.ra < 53.0]
tile_list = [tile for tile in tile_list if tile.dec > -36.0 and tile.dec < -26.0]
print len(tile_list)
# sys.exit()

clf()
fig = gcf()
ax = fig.add_subplot(111, projection="aitoff")
ax.grid(True)

print "Commencing plotting..."
i = 1
for tile in tile_list:
    tile_verts = np.asarray([tp.compute_offset_posn(tile.ra, tile.dec, tp.TILE_RADIUS, float(p)) for p in range(361)])
    tile_verts = np.asarray([tp.aitoff_plottable(xy, ra_offset=180.0) for xy in tile_verts])
    ec = "k"
    if i == 1:
        ec = "r"
    tile_circ = mpatches.Polygon(tile_verts, closed=False, edgecolor=ec, facecolor="none", lw=0.7)
    ax.add_patch(tile_circ)
    # ax.plot([np.radians(t.ra - 180.) for t in tile_list], [np.radians(t.dec) for t in tile_list],
    # 	'ko', lw=0, ms=1)
    i += 1

show()
draw()
# fig.savefig('tiling.png', fmt='png')