def test1(): tel = Telescope() tel.add_uniform_core(200, 1000) fig = tel.plot_layout() ax = fig.gca() ax.add_artist(plt.Circle((0, 0), radius=1000, fill=False, color='r')) plt.show() plt.close(fig)
def main(): # -------------- Options out_dir = 'results_01' # -------------- if not isdir(out_dir): makedirs(out_dir) # Current SKA1 V5 design. tel = SKA1_low_analysis() tel.add_ska1_v5(None, 6400) tel.plot_layout(plot_radii=[500, 6400], color='k', filename=join(out_dir, 'layout_v5.png')) # Generate new telescopes by expanding each station cluster. b = 0.515 theta0_deg = -48 start_inner = 417.82 num_arms = 3 d_theta = 360 / num_arms # Get cluster radii. cluster_x, cluster_y, arm_index = Telescope.cluster_centres_ska_v5(0, 6400) cluster_r = (cluster_x**2 + cluster_y**2)**0.5 cluster_r = cluster_r[::3] # Get every 3rd radius. delta_theta_deg = Telescope.delta_theta( cluster_x[0], cluster_y[0], cluster_x[3], cluster_y[3], start_inner, b) # Loop over cluster radii. for i in range(len(cluster_r)): if i != 3: continue print('-' * 80) # Create the telescope and add the core. tel1 = SKA1_low_analysis() tel1.add_ska1_v5(None, 500) # Add SKA1 V5 clusters from this radius outwards. if i < len(cluster_r) - 1: r = cluster_r[i + 1] tel1.add_ska1_v5(r - 90, 6400) # Add spiral sections up to this radius. for j in range(i + 1): for k in range(num_arms): idx = num_arms * j + k tel1.add_log_spiral_section( 6, start_inner, cluster_x[idx], cluster_y[idx], b, delta_theta_deg / 2.0, theta0_deg + arm_index[idx] * d_theta) # tel1.plot_layout(plot_radii=[500, 6400], color='k', # show_decorations=True, # filename=join(out_dir, 'layout_%02i.png' % i)) # tel1.plot_grid(filename=join(out_dir, 'uv_grid_%02i.png' % i)) # tel1.plot_network() tel1.cable_cost()
def __init__(self, out_dir='TEMP_results', remove_existing_results=True, obs_length_h=0, num_times=1, eval_metrics=dict()): self.out_dir = out_dir if remove_existing_results and os.path.isdir(out_dir): shutil.rmtree(out_dir) self.obs_length_h = obs_length_h self.num_times = num_times self.eval_metrics = eval_metrics # Generate new telescopes based on v5 by expanding each station cluster self.core_radius = 500 self.cluster_radius = 90 self.outer_radius = 6400 self.stations_per_cluster = 6 # Parameters for the log spiral cluster replacement. self.b = 0.515 self.theta0_deg = -48 self.start_inner = 417.8 self.num_arms = 3 self.d_theta = 360 / self.num_arms # Get v5 cluster positions self.cluster_x, self.cluster_y, self.arm_index = \ Telescope.cluster_centres_ska_v5(0, self.outer_radius) # Get cluster radii (every 3rd index as 3 arms have common radii) self.cluster_r = (self.cluster_x[::3]**2 + self.cluster_y[::3]**2)**0.5 # Get theta separation between cluster rings for the inner and outer # log spirals of ska v5 (clusters 0 to 1 and 4 to 5 along the first arm) self.delta_theta_deg_inner = Telescope.delta_theta( self.cluster_x[0], self.cluster_y[0], self.cluster_x[3], self.cluster_y[3], self.start_inner, self.b) self.delta_theta_deg_outer = Telescope.delta_theta( self.cluster_x[12], self.cluster_y[12], self.cluster_x[15], self.cluster_y[15], self.start_inner, self.b) # Convert to theta offset about the cluster centre for the log spiral # unpacking. self.delta_theta_deg_inner *= (5 / 12) self.delta_theta_deg_outer *= (5 / 12)
def test3(): tel = Telescope() tel.add_uniform_core(368, 5000) tel.add_ska1_v5(r_min=5000) x, y, z = tel.coords() fig, ax = plt.subplots() for xy in zip(x, y): ax.add_artist(plt.Circle(xy, radius=(tel.station_diameter_m / 2), fill=False)) ax.set_aspect('equal') ax.set_xlim(-8000, 8000) ax.set_ylim(-8000, 8000) plt.show() plt.close(fig)
import matplotlib.pyplot as plt if __name__ == '__main__': # # Uniform core with hole in the middle # tel = Telescope('test') # tel.add_uniform_core(300, 500, 100) # tel.plot(plot_radii=[100, 500]) # # # Uniform core # tel = Telescope('test') # tel.add_uniform_core(250, 400) # tel.plot(plot_radii=[400]) # # # Hexagonal core + Uniform halo tel = Telescope('test') tel.add_hex_core(200, 0.0) tel.add_uniform_core(180, 400, 200) # tel.plot_layout(plot_radii=[200, 400]) tel.save('HEX_layout.txt') # # Spiral arms # tel = Telescope('test') # tel.add_log_spiral(n=3*10, r0=100, r1=400, b=0.5, num_arms=3, theta0_deg=0) # tel.plot_layout(plot_radii=[100, 400]) # # # Symmetric spiral arms # tel = Telescope('test') # tel.add_symmetric_log_spiral(n=10, r0=100, r1=400, b=0.5, num_arms=3, # name='foo', theta0_deg=0) # tel.plot_layout(plot_radii=[100, (400, 'b')], color='g')
def test3(): # Current SKA1 V5 design. tel = Telescope() tel.add_ska1_v5(None, 6400) tel.plot_layout(plot_radii=[500, 6400], color='k') # Generate new telescopes by expanding each station cluster. b = 0.515 theta0_deg = -48 start_inner = 417.82 num_arms = 3 d_theta = 360 / num_arms # Get cluster radii. cluster_x, cluster_y, arm_index = Telescope.cluster_centres_ska_v5(0, 6400) cluster_r = (cluster_x**2 + cluster_y**2)**0.5 cluster_r = cluster_r[::3] # Get every 3rd radius. delta_theta_deg = Telescope.delta_theta( cluster_x[0], cluster_y[0], cluster_x[3], cluster_y[3], start_inner, b) # Loop over cluster radii. for i in range(len(cluster_r)): # Create the telescope and add the core. tel1 = Telescope() tel1.add_ska1_v5(None, 500) # Add SKA1 V5 clusters from this radius outwards. if i < len(cluster_r) - 1: r = cluster_r[i + 1] tel1.add_ska1_v5(r - 90, 6400) # Add spiral sections up to this radius. for j in range(i + 1): for k in range(num_arms): idx = num_arms * j + k tel1.add_log_spiral_section( 6, start_inner, cluster_x[idx], cluster_y[idx], b, delta_theta_deg / 2.0, theta0_deg + arm_index[idx] * d_theta) tel1.add_circular_arc( 6, cluster_x[idx], cluster_y[idx], d_theta) # NOTE(BM) Telescope exists here ... add metrics tel1.plot_layout(plot_radii=[500, 6400], color='k', show_decorations=True)
def test1(): tel = Telescope() # Spiral parameters for inner and outer regions. start_inner = 417.82 end_inner = 1572.13 b_inner = 0.513 start_outer = 2146.78 end_outer = 6370.13 b_outer = 0.52 # Add all stations out to 6500 m. tel.add_ska1_v5(r_min=500, r_max=6500) # Add the cluster centres. tel.add_symmetric_log_spiral(5, start_inner, end_inner, b_inner, 3, 'cluster_centres_inner', -48) tel.add_symmetric_log_spiral(5, start_outer, end_outer, b_outer, 3, 'cluster_centres_outer', 135) # Fill in the gaps with spirals. b = 0.515 tel.add_symmetric_log_spiral(60, start_inner, end_outer, b, 3, 'spiral_arms', -48) tel.plot_layout(plot_radii=[start_inner, end_inner, start_outer, end_outer], show_decorations=False)
def test2(): # Spiral parameters for inner and outer regions. start_inner = 417.82 end_outer = 6370.13 b = 0.515 theta0 = -40 num_arms = 1 tel1 = Telescope() tel1.add_symmetric_log_spiral(10, start_inner, end_outer, b, num_arms, 'spiral_arms', theta0) cx1 = tel1.layouts['spiral_arms0']['x'][3] cy1 = tel1.layouts['spiral_arms0']['y'][3] cx2 = tel1.layouts['spiral_arms0']['x'][4] cy2 = tel1.layouts['spiral_arms0']['y'][4] delta_t = Telescope.delta_theta(cx1, cy1, cx2, cy2, start_inner, b) tel2 = Telescope() tel2.add_log_spiral_section(6, start_inner, cx1, cy1, b, delta_t / 2, theta0) tel3 = Telescope() tel3.add_log_spiral_section(6, start_inner, cx2, cy2, b, delta_t / 2, theta0) fig, ax = plt.subplots(figsize=(8, 8)) tel2.plot_layout(mpl_ax=ax, color='g') tel3.plot_layout(mpl_ax=ax, color='y') tel1.station_diameter_m = 50 tel1.plot_layout(plot_radii=[start_inner, end_outer], mpl_ax=ax, color='r') ax.plot([cx1], [cy1], '+', ms=10) plt.show()