Ejemplo n.º 1
0
def analyse_v5(out_dir='TEMP_results',
               obs_length_h=0,
               num_times=1,
               eval_metrics=dict()):
    """Generate and analyse reference v5 layout."""
    # -------------- Options --------------------------------------------------
    name = 'v5_baseline'  # Name of the telescope model (prefix in file names)
    # outer_radius = 6400 + 90
    # -------------------------------------------------------------------------
    if not isdir(out_dir):
        makedirs(out_dir)

    # Current SKA1 V5 design.
    tel = SKA1_low_analysis(name)
    # tel.add_ska1_v5(r_max=outer_radius)
    tel.add_ska1_v5()
    tel.obs_length_h = obs_length_h
    tel.num_times = num_times
    tel.dec_deg = tel.lat_deg

    metrics = Metrics(out_dir)
    metrics.analyse_telescope(tel, 0.0, eval_metrics)
    # metrics.save_results(name)
    print(tel.name, tel.num_stations())
    return tel, metrics
Ejemplo n.º 2
0
    def model15(self, name='v6_15-core01_3rings_spiral_v5'):
        """altered version of RW 3 ring scheme in an attempt to improve
        uniform uv coverage. v5 after 1.7km
        """
        metrics = Metrics(self.out_dir)
        tel = SKA1_low_analysis(name)
        tel.station_diameter_m = 35
        tel.obs_length_h = self.obs_length_h
        tel.num_times = self.num_times
        tel.dec_deg = tel.lat_deg
        tel = self._add_core_01(tel)
        # tel.add_ska1_v5(r_max=500)
        # radii = [800, 1250, 1700]  # RW values
        radii = [750, 1200, 1700]
        number = [21, 27, 21]
        for rn in zip(radii, number):
            tel.add_ring(rn[1], rn[0], 0)
        tel.add_ska1_v5(r_min=6450)

        # ============= Spiral arms
        arm_r0, arm_r1 = 1900, 6400
        tel.add_log_spiral_3(25 + 6, self.start_inner, arm_r0, arm_r1, 0.515,
                             self.num_arms, self.theta0_deg)
        # assert(tel.num_stations() == 512)
        print(tel.name, tel.num_stations())
        metrics.analyse_telescope(tel, 0, self.eval_metrics)
        return tel, metrics
Ejemplo n.º 3
0
 def core(self, name='core'):
     metrics = Metrics(self.out_dir)
     tel = SKA1_low_analysis(name + '_r08')
     tel.station_diameter_m = 35
     tel.obs_length_h = self.obs_length_h
     tel.num_times = self.num_times
     tel.dec_deg = tel.lat_deg
     tel = self._add_core_01(tel)
     # tel.add_uniform_core(num_stations, core_radius_m)
     metrics.analyse_telescope(tel, 0, self.eval_metrics)
     return tel, metrics
Ejemplo n.º 4
0
    def model01(self, name='model01', add_core=True, r_values=None):
        """Model01 == replace clusters with spiral arms"""
        # Initialise metrics class
        metrics = Metrics(self.out_dir)

        # Loop over telescope models (replacing additional rings of clusters)
        for i in range(self.cluster_r.size):
            if r_values is not None and i not in r_values:
                continue
            # Create the telescope model (v5 core & clusters not being replaced)
            tel = self.__add_v5_core_clusters(name, i, add_core)

            # Add spiral sections for clusters we are replacing
            for j in range(i + 1):
                # Spiral offset from centre in theta space.
                delta_theta_deg = self.delta_theta_deg_inner if j <= 3 else \
                    self.delta_theta_deg_outer
                for k in range(self.num_arms):
                    idx = self.num_arms * j + k
                    tel.add_log_spiral_section(
                        self.stations_per_cluster, self.start_inner,
                        self.cluster_x[idx], self.cluster_y[idx], self.b,
                        delta_theta_deg,
                        self.theta0_deg + self.arm_index[idx] * self.d_theta)

            # Produce analysis metrics for the telescope
            metrics.analyse_telescope(tel, self.cluster_r[i],
                                      self.eval_metrics)

        # Save various comparision metrics.
        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
Ejemplo n.º 5
0
    def model02(self, name='model02', add_core=True, r_values=None):
        """Model02 == replace clusters with radial arcs"""
        # Initialise metrics class
        metrics = Metrics(self.out_dir)

        # Loop over cluster radii
        for i in range(self.cluster_r.size):
            if r_values is not None and i not in r_values:
                continue
            # Create the telescope model (v5 core & clusters not being replaced)
            tel = self.__add_v5_core_clusters(name, i, add_core)

            # Add circular sections for clusters we are replacing
            for j in range(i + 1):
                for k in range(self.num_arms):
                    idx = self.num_arms * j + k
                    tel.add_circular_arc(self.stations_per_cluster,
                                         self.cluster_x[idx],
                                         self.cluster_y[idx], self.d_theta)
            metrics.analyse_telescope(tel, self.cluster_r[i],
                                      self.eval_metrics)

        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
Ejemplo n.º 6
0
    def model05(self, name='model05', add_core=True, r_values=None):
        """Model05 == random radial profile"""
        # Initialise metrics class
        metrics = Metrics(self.out_dir)

        # Loop over cluster radii
        for i in range(self.cluster_r.size):
            if r_values is not None and i not in r_values:
                continue
            # Create the telescope model (v5 core & clusters not being replaced)
            tel = self.__add_v5_core_clusters(name, i, add_core)

            # Add random radial profile.
            c_x = self.cluster_x[0:self.num_arms * (i + 1)]
            c_y = self.cluster_y[0:self.num_arms * (i + 1)]
            tel.add_random_profile(self.num_arms * self.cluster_r.size * 6,
                                   c_x, c_y, self.core_radius,
                                   self.outer_radius,
                                   self.num_arms * (i + 1) * 6)
            metrics.analyse_telescope(tel, self.cluster_r[i],
                                      self.eval_metrics)

        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
Ejemplo n.º 7
0
 def model10(self, name='v6_10-core01_2rings_v5'):
     """2 ring scheme v5 after 1.7km"""
     metrics = Metrics(self.out_dir)
     tel = SKA1_low_analysis(name)
     tel.station_diameter_m = 35
     tel.obs_length_h = self.obs_length_h
     tel.num_times = self.num_times
     tel.dec_deg = tel.lat_deg
     tel = self._add_core_01(tel)
     radii = [900, 1700]
     number = [27, 45]
     for rn in zip(radii, number):
         tel.add_ring(rn[1], rn[0], 0)
     tel.add_ska1_v5(r_min=1750)
     metrics.analyse_telescope(tel, 0, self.eval_metrics)
     return tel, metrics
Ejemplo n.º 8
0
 def model09b(self, name='v6_09b-core01_rw_rings_v5'):
     """new core + RandallW 3 ring scheme + v5 arms"""
     metrics = Metrics(self.out_dir)
     tel = SKA1_low_analysis(name)
     tel.station_diameter_m = 35
     tel.obs_length_h = self.obs_length_h
     tel.num_times = self.num_times
     tel.dec_deg = tel.lat_deg
     tel = self._add_core_01(tel)
     radii = [800, 1250, 1700]
     number = [12, 24, 36]
     for rn in zip(radii, number):
         tel.add_ring(rn[1], rn[0], 0)
     tel.add_ska1_v5(r_min=1750)
     metrics.analyse_telescope(tel, 0, self.eval_metrics)
     return tel, metrics
Ejemplo n.º 9
0
 def model09a(self, name='v6_09a-v5_rw_rings'):
     """v5 with RandallW 3 ring scheme"""
     metrics = Metrics(self.out_dir)
     tel = SKA1_low_analysis(name)
     tel.station_diameter_m = 35
     tel.obs_length_h = self.obs_length_h
     tel.num_times = self.num_times
     tel.dec_deg = tel.lat_deg
     radii = [800, 1250, 1700]
     number = [12, 24, 36]
     for rn in zip(radii, number):
         tel.add_ring(rn[1], rn[0], 0)
     tel.add_ska1_v5(r_min=1750)
     tel.add_ska1_v5(r_max=500)
     metrics.analyse_telescope(tel, 0, self.eval_metrics)
     return tel, metrics
Ejemplo n.º 10
0
def analyse_v5(out_dir='TEMP_results',
               obs_length_h=0,
               num_times=1,
               eval_metrics=dict()):
    """V5 baseline layout.
    TODO(BM) move this into analyse v5
    """
    name = 'v5'  # Name of the telescope model (prefix in file names)
    if not isdir(out_dir):
        makedirs(out_dir)
    tel = SKA1_low_analysis(name)
    tel.add_ska1_v5()
    tel.obs_length_h = obs_length_h
    tel.num_times = num_times
    tel.dec_deg = tel.lat_deg
    metrics = Metrics(out_dir)
    metrics.analyse_telescope(tel, 0.0, eval_metrics)
    return tel, metrics
Ejemplo n.º 11
0
 def model11(self, name='v6_11-core01_3rings_v5'):
     """altered version of RW 3 ring scheme in an attempt to improve
     uniform uv coverage. v5 after 1.7km
     """
     metrics = Metrics(self.out_dir)
     tel = SKA1_low_analysis(name)
     tel.station_diameter_m = 35
     tel.obs_length_h = self.obs_length_h
     tel.num_times = self.num_times
     tel.dec_deg = tel.lat_deg
     tel = self._add_core_01(tel)
     # radii = [800, 1250, 1700]  # RW values
     radii = [900, 1200, 1700]
     number = [12 + 5, 24 + 1, 36 - 6]
     assert (int(np.sum(number)) == 72)
     for rn in zip(radii, number):
         tel.add_ring(rn[1], rn[0], 0)
     tel.add_ska1_v5(r_min=1750)
     metrics.analyse_telescope(tel, 0, self.eval_metrics)
     return tel, metrics
Ejemplo n.º 12
0
 def model09d(self, name='v6_09d-v5_core_rw_rings_spiral_v5'):
     """v5 core + RandallW 3 ring scheme + our spiral"""
     metrics = Metrics(self.out_dir)
     tel = SKA1_low_analysis(name)
     tel.station_diameter_m = 35
     tel.obs_length_h = self.obs_length_h
     tel.num_times = self.num_times
     tel.dec_deg = tel.lat_deg
     tel.add_ska1_v5(r_max=500)
     radii = [800, 1250, 1700]
     number = [12, 24, 36]
     for rn in zip(radii, number):
         tel.add_ring(rn[1], rn[0], 0)
     arm_r0, arm_r1 = 1900, 6400
     tel.add_log_spiral_3(25 + 5, self.start_inner, arm_r0, arm_r1, 0.515,
                          self.num_arms, self.theta0_deg)
     tel.add_ska1_v5(r_min=6450)
     # tel.add_ska1_v5(r_min=10e3)
     print(name, tel.num_stations())
     metrics.analyse_telescope(tel, 0, self.eval_metrics)
     return tel, metrics
Ejemplo n.º 13
0
    def model03(self, name='model03', add_core=True, r_values=None):
        """Model03 == replace clusters with radial arcs and log spirals"""
        # Initialise metrics class
        metrics = Metrics(self.out_dir)
        print(self.cluster_r)
        print(self.core_radius)

        # Loop over cluster radii
        for i in range(self.cluster_r.size):
            if r_values is not None and i not in r_values:
                continue
            # Create the telescope model (v5 core & clusters not being replaced)
            tel = self._add_v5_core_clusters(name, i, add_core)
            tel.add_ska1_v5(r_min=6450)

            # Loop over cluster radii we are replacing
            for j in range(i + 1):
                delta_theta_deg = self.delta_theta_deg_inner if j <= 3 else \
                    self.delta_theta_deg_outer
                for k in range(self.num_arms):
                    idx = self.num_arms * j + k
                    if j >= 5:
                        tel.add_log_spiral_section(
                            self.stations_per_cluster, self.start_inner,
                            self.cluster_x[idx], self.cluster_y[idx], self.b,
                            delta_theta_deg, self.theta0_deg +
                            self.arm_index[idx] * self.d_theta)
                    else:
                        tel.add_circular_arc(self.stations_per_cluster,
                                             self.cluster_x[idx],
                                             self.cluster_y[idx], self.d_theta)
            metrics.analyse_telescope(tel, self.cluster_r[i],
                                      self.eval_metrics)

        metrics.save_results(name)
        metrics.plot_comparisons()
        return tel, metrics
Ejemplo n.º 14
0
    def model04(self, name='model04', add_core=True, r_values=None):
        """Model04 == replace clusters with circles then perturbed circles"""
        # Initialise metrics class
        metrics = Metrics(self.out_dir)
        r0 = 500
        r1 = 6400
        perturb_r0 = 300
        perturb_r1 = 0.8 * (self.cluster_r[-1] - self.cluster_r[-2])
        # print('perturb_r1', perturb_r1)
        # Loop over cluster radii
        for i in range(self.cluster_r.size):
            if r_values is not None and i not in r_values:
                continue
            np.random.seed(5)
            # Create the telescope model (v5 core & clusters not being replaced)
            tel = self.__add_v5_core_clusters(name, i, add_core)

            # Loop over cluster radii we are replacing
            for j in range(i + 1):
                for k in range(self.num_arms):
                    idx = self.num_arms * j + k
                    if j >= 5:
                        tel.add_circular_arc_perturbed(
                            self.stations_per_cluster, self.cluster_x[idx],
                            self.cluster_y[idx], self.d_theta, r0, r1,
                            perturb_r0, perturb_r1)
                    else:
                        tel.add_circular_arc(self.stations_per_cluster,
                                             self.cluster_x[idx],
                                             self.cluster_y[idx], self.d_theta)
            metrics.analyse_telescope(tel, self.cluster_r[i],
                                      self.eval_metrics)

        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
Ejemplo n.º 15
0
    def model08(self, name='model08', add_core=True):
        """Proposed SKA v6 configuration option 1

        4 rings of 21 stations (84 total)
            r0 = 500m, r5 = 1700m with no ring at r0
        72 station arms from r0 = 1700m with no point at 1700 to r21 at 6.4 km
         (ie 6 stations symmmetric about 6.4km)
           Note(BM) might have to shrink this a bit to match 1km LV reticulation
        core of 224 + 6 stations (uniform or tapered up to 500m)
        """
        metrics = Metrics(self.out_dir)

        # TODO(BM) hybrid of model1 with a custom generated core
        # and avoiding cable lengths > 1km in arm clusters.
        # For the log spiral arms also generate from a single arm and rotate
        # with stride 3 to generate arms.  (put 162 - 18? in arms) and
        # (224 + 18 in the core) to recover some short baselines.
        from math import log, exp
        import matplotlib.pyplot as plt

        tel = SKA1_low_analysis(name + '_r08')
        tel.station_diameter_m = 35
        tel.obs_length_h = self.obs_length_h
        tel.num_times = self.num_times
        tel.dec_deg = tel.lat_deg

        # Core
        core_radius_m = 480
        sll = -24
        n_taylor = 10000
        tel.num_trials = 2
        tel.trial_timeout_s = 30.0

        # Inner rings
        num_rings = 5
        num_per_ring = 17
        ring_r0 = 580
        ring_r5 = 1700
        ring_radii = np.logspace(np.log10(ring_r0), np.log10(ring_r5),
                                 num_rings)
        print('ring radii   =', ring_radii)
        print('ring spacing = ', np.diff(ring_radii))

        # Arms
        # arm_r0 = 1805
        arm_r0 = ring_r5 + core_radius_m / 2
        # arm_r1 = 7135
        arm_r1 = 6400

        # ============== Core
        tel.seed = 74383209

        args = dict(amps=taylor_win(n_taylor, sll), taper_r_min=0.30)
        # 510m worked ok
        tel.add_tapered_core(224 + 2, 480, AnalyseUnwrapV5.__taper_r_profile,
                             **args)
        print('final seed =',
              tel.layouts['tapered_core']['info']['final_seed'])
        # tel.add_ska1_v5(r_max=500)

        # ============== Rings
        # TODO(BM) rotate every other ring so radii don't align
        np.random.seed(1)
        for i, r in enumerate(ring_radii[0:2]):
            print('xxx', i, r)
            # tel.add_ring(num_per_ring, r,
            #              delta_theta=(360/(num_per_ring * 2)) * (i%2))
            tel.add_ring(num_per_ring,
                         r,
                         delta_theta=np.random.randint(low=0, high=360))
            # tel.add_ring(num_per_ring, r, delta_theta=0)

        # tel.layouts['test_st'] = dict(x=np.array([2e3]), y=np.array([0e3]))
        tel.grid_cell_size_m = tel.station_diameter_m
        metrics.analyse_telescope(tel, 0, self.eval_metrics)
        return tel

        # ============= Spiral arms
        # tel.add_log_spiral_2(25, arm_r0, arm_r1, 0.515, 3, 'inner_arms', 0)
        tel.add_log_spiral_3(25, self.start_inner, arm_r0, arm_r1, 0.515,
                             self.num_arms, self.theta0_deg)

        # tel.add_symmetric_log_spiral(25, arm_r0, arm_r1, 0.515, 3,
        #                              'inner_arms', self.delta_theta_deg_inner)

        x, _, _ = tel.get_coords_enu()
        print('total stations =', x.size)

        # Plotting layout
        metrics.analyse_telescope(tel, 0, self.eval_metrics)

        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
        return tel
Ejemplo n.º 16
0
    def model07(self, name='model07', add_core=True):
        """Proposed SKA v6 configuration option 1

        4 rings of 21 stations (84 total)
            r0 = 500m, r5 = 1700m with no ring at r0
        72 station arms from r0 = 1700m with no point at 1700 to r21 at 6.4 km
         (ie 6 stations symmmetric about 6.4km)
           Note(BM) might have to shrink this a bit to match 1km LV reticulation
        core of 224 + 6 stations (uniform or tapered up to 500m)
        """
        metrics = Metrics(self.out_dir)

        # TODO(BM) hybrid of model1 with a custom generated core
        # and avoiding cable lengths > 1km in arm clusters.
        # For the log spiral arms also generate from a single arm and rotate
        # with stride 3 to generate arms.  (put 162 - 18? in arms) and
        # (224 + 18 in the core) to recover some short baselines.
        from math import log, exp
        import matplotlib.pyplot as plt

        def taper_r_profile(r, amps, taper_r_min=0):
            """Nearest neighbour matching. FIXME(BM) double check this"""
            r = np.asarray(r)
            idx = np.round(
                ((r - taper_r_min) / (1 - taper_r_min)) * (amps.size - 1))
            values = np.asarray(amps[idx.astype(np.int)])
            values[r < taper_r_min] = 1.0
            # return values
            return 1.0

        tel = SKA1_low_analysis(name + '_r08')
        tel.station_diameter_m = 40
        tel.obs_length_h = self.obs_length_h
        tel.num_times = self.num_times
        tel.dec_deg = tel.lat_deg

        # Core
        core_radius_m = 480
        sll = -26
        n_taylor = 10000
        tel.num_trials = 10
        tel.trial_timeout_s = 30.0

        # Inner rings
        num_rings = 5
        num_per_ring = 17
        ring_r0 = 580
        ring_r5 = 1700
        ring_radii = np.logspace(np.log10(ring_r0), np.log10(ring_r5),
                                 num_rings)
        print('ring radii   =', ring_radii)
        print('ring spacing = ', np.diff(ring_radii))

        # Arms
        # arm_r0 = 1805
        arm_r0 = ring_r5 + core_radius_m / 2
        # arm_r1 = 7135
        arm_r1 = 6400

        # ============== Core
        # tel.seed = 74383209
        # args = dict(amps=taylor_win(n_taylor, sll), taper_r_min=0.5)
        # tel.add_tapered_core(224 + 2, 460,
        #                      taper_r_profile, **args)
        # print('final seed =', tel.layouts['tapered_core']['info']['final_seed'])
        tel.add_ska1_v5(r_max=500)
        tel.layouts['ska1_v5']['x'] *= 40 / 35
        tel.layouts['ska1_v5']['y'] *= 40 / 35

        # ============== Rings
        # TODO(BM) rotate every other ring so radii don't align
        np.random.seed(1)
        for i, r in enumerate(ring_radii[0:2]):
            # tel.add_ring(num_per_ring, r, delta_theta=(360/(num_per_ring * 2)) * (i%2))
            tel.add_ring(num_per_ring,
                         r,
                         delta_theta=np.random.randint(low=0, high=360))
            # tel.add_ring(num_per_ring, r, delta_theta=0)
        metrics.analyse_telescope(tel, 0, self.eval_metrics)
        return tel

        # ============= Spiral arms
        # tel.add_log_spiral_2(25, arm_r0, arm_r1, 0.515, 3, 'inner_arms', 0)
        tel.add_log_spiral_3(25, self.start_inner, arm_r0, arm_r1, 0.515,
                             self.num_arms, self.theta0_deg)

        # # ============= Add outer arms
        # coords = np.loadtxt(join('utilities', 'data', 'v5_enu.txt'))
        # x, y, z = coords[:, 0], coords[:, 1], coords[:, 2]
        # r = (x**2 + y**2)**0.5
        # idx = np.where(r >= 6.5e3)
        # x, y, z = x[idx], y[idx], z[idx]
        # tel.layouts['outer_arms'] = dict(x=x, y=y, z=z)
        # # tel.add_ska1_v5(6400, 9e50)
        # # =============

        # tel.add_symmetric_log_spiral(25, arm_r0, arm_r1, 0.515, 3,
        #                              'inner_arms', self.delta_theta_deg_inner)

        x, _, _ = tel.get_coords_enu()
        print('total stations =', x.size)

        # Plotting layout
        metrics.analyse_telescope(tel, 0, self.eval_metrics)
        # tel.plot_layout()

        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
        return tel
Ejemplo n.º 17
0
    def model06(self, name='model06', add_core=True, r_values=None):
        """Model06 == no cables > 1km, an improved core"""
        # Initialise metrics class
        metrics = Metrics(self.out_dir)

        # TODO(BM) hybrid of model1 with a custom generated core
        # and avoiding cable lengths > 1km in arm clusters.
        # For the log spiral arms also generate from a single arm and rotate
        # with stride 3 to generate arms.  (put 162 - 18? in arms) and
        # (224 + 18 in the core) to recover some short baselines.
        from math import log, exp
        import matplotlib.pyplot as plt

        def taper_func_1(r):
            return 1 - (r / 2)**1.5

        def taper_func_2(r, hwhm=1.5, taper_r_min=0):
            r = np.asarray(r)
            c = hwhm / (2 * log(2))**0.5
            values = np.exp(-((r - taper_r_min) / (1 - taper_r_min))**2 / 2 *
                            c**2)
            values[r < taper_r_min] = 1.0
            return values

        def taper_r_profile(r, amps, taper_r_min=0):
            """Nearest neighbour matching. FIXME(BM) double check this"""
            r = np.asarray(r)
            idx = np.round(
                ((r - taper_r_min) / (1 - taper_r_min)) * (amps.size - 1))
            values = np.asarray(amps[idx.astype(np.int)])
            values[r < taper_r_min] = 1.0
            return values

        def get_taper_profile(taper_func, r, **kwargs):
            if kwargs is not None:
                t = taper_func(r, **kwargs)
            else:
                t = taper_func(r)
            return t

        tel = SKA1_low_analysis(name)
        sll = -28
        n_taylor = 10000
        r = np.linspace(0, 1, 100)
        t1 = get_taper_profile(taper_func_1, r)
        t2 = get_taper_profile(taper_func_2, r, hwhm=1.0)
        t2a = get_taper_profile(taper_func_2, r, hwhm=1.0, taper_r_min=0.25)
        t3 = get_taper_profile(taper_r_profile,
                               r,
                               amps=taylor_win(n_taylor, sll))
        t4 = get_taper_profile(taper_r_profile,
                               r,
                               amps=taylor_win(n_taylor, sll),
                               taper_r_min=0.25)

        fig, ax = plt.subplots()
        ax.plot(r, tel.station_diameter_m / t1, 'k-', label='Power law')
        ax.plot(r, tel.station_diameter_m / t2, 'b-', label='Gaussian')
        ax.plot(r, tel.station_diameter_m / t2a, 'b--', label='Gaussian rmin')
        ax.plot(r, tel.station_diameter_m / t3, 'r-', label='Taylor %i' % sll)
        ax.plot(r,
                tel.station_diameter_m / t4,
                'r--',
                label='Taylor rmin %i' % sll)
        ax.set_xlabel('Fractional radius')
        ax.set_ylabel('Minimum station separation (m)')
        ax.grid()
        ax.set_ylim(34)
        ax.legend(loc='best')
        fig.savefig('station_min_dist.png')
        # plt.show()
        plt.close(fig)

        core_radius_m = 480

        tel.num_trials = 10
        tel.trial_timeout_s = 30.0
        tel.seed = 24183655
        args = dict(amps=taylor_win(n_taylor, sll), taper_r_min=0.25)
        tel.add_tapered_core(224 + 18, core_radius_m, taper_r_profile, **args)
        tel.plot_layout(filename=name + '.png',
                        show_decorations=False,
                        plot_radii=[500])
        print('final seed =',
              tel.layouts['tapered_core']['info']['final_seed'])
        print(tel.seed)

        tel.add_log_spiral_2(20, 480, 6000, 0.515, 3, 'inner_arms', 0)
        x1, y1, _ = tel.get_coords_enu()

        tel_v5 = SKA1_low_analysis('ska1_v5')
        tel_v5.add_ska1_v5(r_max=6400)
        x2, y2, _ = tel_v5.get_coords_enu()

        # Side by side comparison to ska v5 core
        fig, axes = plt.subplots(figsize=(16, 8), ncols=2)
        for xy in zip(x1, y1):
            axes[0].add_artist(
                plt.Circle(xy,
                           tel.station_diameter_m / 2,
                           fill=True,
                           color='k',
                           alpha=0.5))
        for xy in zip(x2, y2):
            axes[1].add_artist(
                plt.Circle(xy,
                           tel.station_diameter_m / 2,
                           fill=True,
                           color='k',
                           alpha=0.5))
        for ax in axes:
            ax.add_artist(plt.Circle((0, 0), 500, fill=False, color='r'))
            ax.set_aspect('equal')
            ax.set_xlim(-600, 600)
            ax.set_ylim(-600, 600)
        plt.show()
        plt.close(fig)

        # Side by side comparison to ska v5 core
        fig, axes = plt.subplots(figsize=(16, 8), ncols=2)
        for xy in zip(x1, y1):
            axes[0].add_artist(
                plt.Circle(xy,
                           tel.station_diameter_m / 2,
                           fill=True,
                           color='k',
                           alpha=0.5))
        for xy in zip(x2, y2):
            axes[1].add_artist(
                plt.Circle(xy,
                           tel.station_diameter_m / 2,
                           fill=True,
                           color='k',
                           alpha=0.5))
        for ax in axes:
            ax.add_artist(plt.Circle((0, 0), 500, fill=False, color='r'))
            ax.set_aspect('equal')
            ax.set_xlim(-7e3, 7e3)
            ax.set_ylim(-7e3, 7e3)
        plt.show()
        plt.close(fig)

        # TODO(BM) add cluster centres into the spiral arms...

        tel.plot_layout(show_decorations=True,
                        xy_lim=2.5e3,
                        plot_radii=[500, 6400])
        tel.plot_layout(show_decorations=True,
                        xy_lim=7e3,
                        plot_radii=[500, 6400])
Ejemplo n.º 18
0
    def model07(self, name='model07', add_core=True):
        """Proposed SKA v6 configuration option 1

        4 rings of 21 stations (84 total)
            r0 = 500m, r5 = 1700m with no ring at r0
        72 station arms from r0 = 1700m with no point at 1700 to r21 at 6.4 km
         (ie 6 stations symmetric about 6.4km)
           Note(BM) might have to shrink this a bit to match 1km LV reticulation
        core of 224 + 6 stations (uniform or tapered up to 500m)
        """
        metrics = Metrics(self.out_dir)

        tel = SKA1_low_analysis(name + '_r08')
        tel.station_diameter_m = 40
        tel.obs_length_h = self.obs_length_h
        tel.num_times = self.num_times
        tel.dec_deg = tel.lat_deg

        # Core
        core_radius_m = 480

        # Inner rings
        num_rings = 5
        num_per_ring = 17
        ring_r0 = 580
        ring_r5 = 1700
        ring_radii = np.logspace(np.log10(ring_r0), np.log10(ring_r5),
                                 num_rings)
        print('ring radii   =', ring_radii)
        print('ring spacing = ', np.diff(ring_radii))

        # Arms
        arm_r0 = ring_r5 + core_radius_m / 2
        arm_r1 = 6400

        # ============== Core
        tel.add_ska1_v5(r_max=500)
        tel.layouts['ska1_v5']['x'] *= 40 / 35
        tel.layouts['ska1_v5']['y'] *= 40 / 35

        # ============== Rings
        np.random.seed(1)
        for i, r in enumerate(ring_radii[0:2]):
            tel.add_ring(num_per_ring, r, delta_theta=randint(0, 360))

        # metrics.analyse_telescope(tel, 0, self.eval_metrics)
        # return tel

        # ============= Spiral arms
        # tel.add_log_spiral_2(25, arm_r0, arm_r1, 0.515, 3, 'inner_arms', 0)
        tel.add_log_spiral_3(25, self.start_inner, arm_r0, arm_r1, 0.515,
                             self.num_arms, self.theta0_deg)

        # # ============= Add outer arms
        # coords = np.loadtxt(join('utilities', 'data', 'v5_enu.txt'))
        # x, y, z = coords[:, 0], coords[:, 1], coords[:, 2]
        # r = (x**2 + y**2)**0.5
        # idx = np.where(r >= 6.5e3)
        # x, y, z = x[idx], y[idx], z[idx]
        # tel.layouts['outer_arms'] = dict(x=x, y=y, z=z)
        # # tel.add_ska1_v5(6400, 9e50)
        # # =============

        # tel.add_symmetric_log_spiral(25, arm_r0, arm_r1, 0.515, 3,
        #                              'inner_arms', self.delta_theta_deg_inner)

        x, _, _ = tel.get_coords_enu()
        print('total stations =', x.size)

        # Plotting layout
        metrics.analyse_telescope(tel, 0, self.eval_metrics)
        # tel.plot_layout()

        metrics.save_results(name)
        # metrics.plot_cable_length_compare()
        metrics.plot_comparisons()
        return tel