def __call__(self): return (sps.jnyn_zeros(1, 1)[1] * spc.c / 2 / sp.pi / self.radius)[0]
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('--radius', type=float, default=33.774e-3, help='cylinder radius in meters') parser.add_argument('--height', type=float, default=122.36e-3, help='cylinder height in meters') args = parser.parse_args() ## Generate and save frequencies analytic_modes = {} from scipy.special import jnyn_zeros max_p, max_n, max_m = 4, 4, 4 with open('./annotate.txt', 'w') as f: for p in range(max_p + 1): for n in range(max_n): S = " " * p ## Spaces can be used to denote the vertical position of the label for m, B in enumerate(jnyn_zeros(n, max_m + 1)[0]): freq = c / (2 * pi) * np.sqrt((B / args.radius)**2 + (p * pi / args.height)**2) f.write("%s$TM_{%d%d%d}$%s\t%.6e\n" % (S, n, m + 1, p, S, freq)) for m, B in enumerate(jnyn_zeros(n, max_m + 1)[1]): if p > 0: ## TExx0 modes do not exist [Pozar] freq = c / (2 * pi) * np.sqrt((B / args.radius)**2 + (p * pi / args.height)**2) f.write(" %s$TE_{%d%d%d}$%s \t%.6e\n" % (S, n, m + 1, p, S, freq))
def get_frequency_circular(self): return (sps.jnyn_zeros(1, 1)[1] * spc.c / 2 / sp.pi / self.dimension)[0]
#!/usr/bin/env python #-*- coding: utf-8 -*- ## Import common moduli import matplotlib, sys, os, time import matplotlib.pyplot as plt import numpy as np from scipy.constants import c, hbar, pi ## User settings radius=33.774e-3 height=122.36e-3 analytic_modes = {} from scipy.special import jnyn_zeros max_p, max_n, max_m = 4,4,4 with open('./annotate.txt', 'w') as f: for p in range(max_p+1): for n in range(max_n): S = " "*p ## Spaces can be used to denote the vertical position of the label for m,B in enumerate(jnyn_zeros(n, max_m+1)[0]): freq = c/(2*pi) * np.sqrt((B/radius)**2 + (p*pi/height)**2) f.write("%s$TM_{%d%d%d}$%s\t%.6e\n" % (S,n,m+1,p,S, freq)) for m,B in enumerate(jnyn_zeros(n, max_m+1)[1]): if p>0: ## TExx0 modes do not exist [Pozar] freq = c/(2*pi) * np.sqrt((B/radius)**2 + (p*pi/height)**2) f.write(" %s$TE_{%d%d%d}$%s \t%.6e\n" % (S,n,m+1,p,S, freq))
"""Compute zeros of integer-order Bessel functions Jn and Jn'. Parameters ---------- nt : int Number (<=1200) of zeros to compute Returns ------- zo[l-1] : ndarray Value of the lth zero of Jn(x) and Jn'(x). Of length `nt`. n[l-1] : ndarray Order of the Jn(x) or Jn'(x) associated with lth zero. Of length `nt`. m[l-1] : ndarray Serial number of the zeros of Jn(x) or Jn'(x) associated with lth zero. Of length `nt`. t[l-1] : ndarray 0 if lth zero in zo is zero of Jn(x), 1 if it is a zero of Jn'(x). Of length `nt`. """ zo, n, m, t = jnjnp_zeros(5) print(*zo) print(*n) print(*m) print(*t) """Compute nt zeros of Bessel functions Jn(x), Jn'(x), Yn(x), and Yn'(x). """ print(jnyn_zeros(0, 5)) print(jnyn_zeros(1, 5))