Exemplo n.º 1
0
 def create_from_code(self):
     F0 = 933e6
     K_RADAR = -2 * F0 * 2 * np.pi / const.c
     self.legend_txt = [
         "Maxwellian",
         r"$\kappa = 20$",
         r"$\kappa = 8$",
         r"$\kappa = 3$",
     ]
     kappa = [20, 8, 3]
     sys_set = {
         "K_RADAR": K_RADAR,
         "B": 50000e-9,
         "MI": 16,
         "NE": 2e11,
         "NU_E": 0,
         "NU_I": 0,
         "T_E": 5000,
         "T_I": 2000,
         "T_ES": 90000,
         "THETA": 0 * np.pi / 180,
         "Z": 599,
         "mat_file": "fe_zmuE-07.mat",
     }
     params = {"kappa": 20, "vdf": "real_data", "area": False}
     self.f, s, meta_data = isr.isr_spectrum("maxwell", sys_set, **params)
     self.data.append(s)
     for k in kappa:
         params["kappa"] = k
         self.f, s, meta_data = isr.isr_spectrum("kappa", sys_set, **params)
         self.data.append(s)
     meta_data["version"] = "both"
     self.meta_data.append(meta_data)
Exemplo n.º 2
0
 def create_from_code(self):
     F0 = 430e6
     K_RADAR = -2 * F0 * 2 * np.pi / const.c  # Radar wavenumber
     self.legend_txt = [
         r"$\lambda_{\mathrm{D}} = \lambda_{\mathrm{D},\kappa}$",
         r"$\lambda_{\mathrm{D}} = \lambda_{\mathrm{D,M}}$",
     ]
     sys_set = {
         "K_RADAR": K_RADAR,
         "B": 35000e-9,
         "MI": 29,
         "NE": 2e10,
         "NU_E": 0,
         "NU_I": 0,
         "T_E": 200,
         "T_I": 200,
         "T_ES": 90000,
         "THETA": 45 * np.pi / 180,
         "Z": 599,
         "mat_file": "fe_zmuE-07.mat",
     }
     params = {"kappa": 3, "vdf": "real_data", "area": False}
     self.f, s, meta_data = isr.isr_spectrum("kappa", sys_set, **params)
     self.data.append(s)
     self.meta_data.append(meta_data)
     params["debye"] = "maxwell"
     self.f, s, meta_data = isr.isr_spectrum("kappa", sys_set, **params)
     self.data.append(s)
     self.meta_data.append(meta_data)
Exemplo n.º 3
0
    def create_from_code(self):
        F0 = 430e6
        K_RADAR = -2 * F0 * 2 * np.pi / const.c  # Radar wavenumber
        sys_set = {
            "K_RADAR": K_RADAR,
            "B": 35000e-9,
            "MI": 16,
            "NE": 1e11,
            "NU_E": 100,
            "NU_I": 100,
            "T_E": 2000,
            "T_I": 1500,
            "T_ES": 90000,
            "THETA": 30 * np.pi / 180,
            "Z": 599,
            "mat_file": "fe_zmuE-07.mat",
            "pitch_angle": list(range(10)),
        }
        params = {"kappa": 8, "vdf": "real_data", "area": False}
        # Ridge 1
        ridge = []
        # Line 1
        self.f, s, meta_data = isr.isr_spectrum("a_vdf", sys_set, **params)
        ridge.append(s)
        self.meta_data.append(meta_data)
        # Line 2
        sys_set["NE"] = 1e12
        self.f, s, meta_data = isr.isr_spectrum("a_vdf", sys_set, **params)
        ridge.append(s)
        self.data.append(ridge)
        self.meta_data.append(meta_data)

        # Ridge 2
        ridge = []
        # Line 1
        sys_set["THETA"] = 60 * np.pi / 180
        sys_set["NE"] = 1e11
        self.f, s, meta_data = isr.isr_spectrum("a_vdf", sys_set, **params)
        ridge.append(s)
        self.meta_data.append(meta_data)
        # Line 2
        sys_set["NE"] = 1e12
        self.f, s, meta_data = isr.isr_spectrum("a_vdf", sys_set, **params)
        ridge.append(s)
        self.data.append(ridge)
        self.meta_data.append(meta_data)

        self.legend_txt = ["1e11", "1e12"]
        self.ridge_txt = ["30", "60"]
Exemplo n.º 4
0
 def test_isr_long_calc_gauss(self):
     self.a, self.b, meta_data = isr.isr_spectrum("a_vdf", self.sys_set,
                                                  **self.params)
     self.assertEqual(meta_data["kappa"], None)
     self.assertEqual(meta_data["vdf"], "gauss_shell")
     self.assertEqual(meta_data["T_ES"], 90000)
     self.assertEqual(meta_data["Z"], None)
     self.assertEqual(meta_data["mat_file"], None)
Exemplo n.º 5
0
 def test_isr_kappa(self):
     self.a, self.b, meta_data = isr.isr_spectrum("kappa", self.sys_set,
                                                  **self.params)
     self.assertEqual(meta_data["kappa"], 3)
     self.assertEqual(meta_data["vdf"], None)
     self.assertEqual(meta_data["T_ES"], None)
     self.assertEqual(meta_data["Z"], None)
     self.assertEqual(meta_data["mat_file"], None)
Exemplo n.º 6
0
 def test_isr_long_calc_real(self):
     self.params["vdf"] = "real_data"
     self.a, self.b, meta_data = isr.isr_spectrum("a_vdf", self.sys_set,
                                                  **self.params)
     self.assertEqual(meta_data["kappa"], None)
     self.assertEqual(meta_data["vdf"], "real_data")
     self.assertEqual(meta_data["T_ES"], None)
     self.assertEqual(meta_data["Z"], 599)
     self.assertEqual(meta_data["mat_file"], "fe_zmuE-07.mat")
Exemplo n.º 7
0
    def create_from_code(self):
        F0 = 933e6
        K_RADAR = -2 * F0 * 2 * np.pi / const.c
        T = [2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]
        self.ridge_txt = [r"$T_{\mathrm{e}} = %d \mathrm{K}$" % j for j in T]
        self.legend_txt = ["Maxwellian", r"$\kappa = 20$", r"$\kappa = 3$"]
        sys_set = {
            "K_RADAR": K_RADAR,
            "B": 50000e-9,
            "MI": 16,
            "NE": 2e11,
            "NU_E": 0,
            "NU_I": 0,
            "T_E": 2000,
            "T_I": 2000,
            "T_ES": 90000,
            "THETA": 0 * np.pi / 180,
            "Z": 599,
            "mat_file": "fe_zmuE-07.mat",
        }
        params = {"kappa": 8, "vdf": "real_data", "area": False}
        kappa = [20, 3]
        for t in T:
            ridge = []
            sys_set["T_E"] = t
            self.f, s, meta_data = isr.isr_spectrum("maxwell", sys_set, **params)
            ridge.append(s)
            for k in kappa:
                params["kappa"] = k
                self.f, s, meta_data = isr.isr_spectrum("kappa", sys_set, **params)
                ridge.append(s)
            self.data.append(ridge)
        self.meta_data.append(meta_data)

        for r in self.data:
            peak = int(np.argwhere(r[0] == np.max(r[0])))
            self.f_list[0].append(self.f[peak])
            peak = int(np.argwhere(r[1] == np.max(r[1])))
            self.f_list[1].append(self.f[peak])
            peak = int(np.argwhere(r[2] == np.max(r[2])))
            self.f_list[2].append(self.f[peak])
Exemplo n.º 8
0
 def create_from_code(self):
     F0 = 430e6
     K_RADAR = -2 * F0 * 2 * np.pi / const.c  # Radar wavenumber
     self.legend_txt = [
         "Maxwellian",
         r"$\kappa = 20$",
         r"$\kappa = 8$",
         r"$\kappa = 3$",
     ]
     kappa = [20, 8, 3]
     sys_set = {
         "K_RADAR": K_RADAR,
         "B": 35000e-9,
         "MI": 29,
         "NE": 2e10,
         "NU_E": 0,
         "NU_I": 0,
         "T_E": 200,
         "T_I": 200,
         "T_ES": 90000,
         "THETA": 45 * np.pi / 180,
         "Z": 599,
         "mat_file": "fe_zmuE-07.mat",
     }
     params = {"kappa": 20, "vdf": "real_data", "area": False}
     t0 = time.perf_counter()
     self.f, s, meta_data = isr.isr_spectrum("maxwell", sys_set, **params)
     t1 = time.perf_counter()
     print(f"Took {t1-t0:.2f} seconds.")
     self.data.append(s)
     for k in kappa:
         params["kappa"] = k
         t0 = time.perf_counter()
         self.f, s, meta_data = isr.isr_spectrum("kappa", sys_set, **params)
         t1 = time.perf_counter()
         print(f"Took {t1-t0:.2f} seconds.")
         self.data.append(s)
     meta_data["version"] = "both"
     self.meta_data.append(meta_data)
Exemplo n.º 9
0
    def create_from_code(self):
        F0 = 430e6
        K_RADAR = -2 * F0 * 2 * np.pi / const.c  # Radar wavenumber
        sys_set = {
            "K_RADAR": K_RADAR,
            "B": 35000e-9,
            "MI": 16,
            "NE": 1e12,
            "NU_E": 100,
            "NU_I": 100,
            "T_E": 2000,
            "T_I": 1500,
            "T_ES": 90000,
            "THETA": 30 * np.pi / 180,
            "Z": 300,
            "mat_file": "fe_zmuE-07.mat",
            "pitch_angle": "all",
        }
        params = {"kappa": 3, "vdf": "maxwell", "area": False}

        ridge = []
        self.f, s1, meta_data = isr.isr_spectrum("maxwell", sys_set, **params)
        ridge.append(s1)
        self.meta_data.append(meta_data)
        _, s2, _ = isr.isr_spectrum("a_vdf", sys_set, **params)
        ridge.append(s2)
        self.data.append(ridge)

        ridge = []
        params["vdf"] = "kappa"
        self.f, s1, meta_data = isr.isr_spectrum("kappa", sys_set, **params)
        ridge.append(s1)
        self.meta_data.append(meta_data)
        _, s2, _ = isr.isr_spectrum("a_vdf", sys_set, **params)
        ridge.append(s2)
        self.data.append(ridge)
Exemplo n.º 10
0
 def create_data(self):
     if self.vol == 1:
         sys_set = {
             "K_RADAR": self.K_RADAR,
             "B": 35000e-9,
             "MI": 16,
             "NE": 2e10,
             "NU_E": 100,
             "NU_I": 100,
             "T_E": 2000,
             "T_I": 1500,
             "T_ES": 90000,
             "THETA": 60 * np.pi / 180,
             "Z": 599,
             "mat_file": "fe_zmuE-07.mat",
             "pitch_angle": list(range(10)),
         }
     else:
         sys_set = {
             "K_RADAR": self.K_RADAR,
             "B": 35000e-9,
             "MI": 16,
             "NE": 2e10,
             "NU_E": 100,
             "NU_I": 100,
             "T_E": 2000,
             "T_I": 1500,
             "T_ES": 90000,
             "THETA": 60 * np.pi / 180,
             "Z": 300,
             "mat_file": "fe_zmuE-07.mat",
             "pitch_angle": "all",
         }
     params = {"kappa": 8, "vdf": "real_data", "area": False}
     with tqdm(total=len(self.Z) * len(self.A)) as pbar:
         for i, z in enumerate(self.Z):
             sys_set["NE"] = z
             plasma_freq = (sys_set["NE"] * const.elementary_charge**2 /
                            (const.m_e * const.epsilon_0))**0.5 / (2 *
                                                                   np.pi)
             cf.I_P["F_MIN"] = plasma_freq
             cf.I_P["F_MAX"] = plasma_freq + 4e5
             cf.f = np.linspace(cf.I_P["F_MIN"], cf.I_P["F_MAX"],
                                int(cf.F_N_POINTS))
             cf.w = 2 * np.pi * cf.f  # Angular frequency
             for j, a in enumerate(self.A):
                 sys_set["THETA"] = a * np.pi / 180
                 old_stdout = sys.stdout
                 f = open(os.devnull, "w")
                 sys.stdout = f
                 f, s, meta_data = isr.isr_spectrum("a_vdf", sys_set,
                                                    **params)
                 sys.stdout = old_stdout
                 plasma_power, energy_interval, fr = self.check_energy(
                     f, s, a)
                 if energy_interval != 0:
                     self.dots[0].append(energy_interval)
                     self.dots[1].append(j)
                     self.dots[2].append(z)
                 self.fr[i, j] = fr
                 self.g[i, j] = plasma_power
                 pbar.update(1)
     self.meta.append(meta_data)