def kws(self, offset, aZi, aXi): ''' Finds 2D source terms to approximate a band-limited point source, based on Hicks, Graham J. (2002) Arbitrary source and receiver positioning in finite-difference schemes using Kaiser windowed sinc functions. Geophysics (67) 1, 156-166. KaiserWindowedSinc(ireg, offset) --> 2D ndarray of size (2*ireg+1, 2*ireg+1) Input offset is the 2D offsets in fractional gridpoints between the source location and the nearest node on the modelling grid. Args: offset (tuple): Distance of the centre of the source region from the true source point (in 2D coordinates, in units of cells). Returns: np.ndarray: Interpolated source region of size (2*ireg+1, 2*ireg+1) ''' try: b = self.HC_KAISER.get(self.ireg) except KeyError: print('Kaiser windowed sinc function not implemented for half-width of %d!'%(self.ireg,)) raise freg = 2*self.ireg+1 xOffset, zOffset = offset # Grid from 0 to freg-1 Zi, Xi = np.mgrid[:freg,:freg] Zi, Xi = self.modifyGrid(Zi, Xi, aZi, aXi) # Distances from source point dZi = (zOffset + self.ireg - Zi) dXi = (xOffset + self.ireg - Xi) # Taper terms for decay function with warnings.catch_warnings(): warnings.simplefilter('ignore') tZi = np.nan_to_num(np.sqrt(1 - (dZi / self.ireg)**2)) tXi = np.nan_to_num(np.sqrt(1 - (dXi / self.ireg)**2)) tZi[tZi == np.inf] = 0 tXi[tXi == np.inf] = 0 # Actual tapers for Kaiser window taperZ = bessi0(b*tZi) / bessi0(b) taperX = bessi0(b*tXi) / bessi0(b) # Windowed sinc responses in Z and X responseZ = np.sinc(dZi) * taperZ responseX = np.sinc(dXi) * taperX # Combined 2D source response result = responseX * responseZ return result
def KaiserWindowedSinc(ireg, offset): ''' Finds 2D source terms to approximate a band-limited point source, based on Hicks, Graham J. (2002) Arbitrary source and receiver positioning in finite-difference schemes using Kaiser windowed sinc functions. Geophysics (67) 1, 156-166. KaiserWindowedSince(ireg, offset) --> 2D ndarray of size (2*ireg+1, 2*ireg+1) Input offset is the 2D offsets in fractional gridpoints between the source location and the nearest node on the modelling grid. ''' from scipy.special import i0 as bessi0 import warnings ireg = int(ireg) try: b = HC_KAISER.get(ireg) except KeyError: print( 'Kaiser windowed sinc function not implemented for half-width of %d!' % (ireg, )) raise freg = 2 * ireg + 1 xOffset, zOffset = offset # Grid from 0 to freg-1 Zi, Xi = numpy.mgrid[:freg, :freg] # Distances from source point dZi = (zOffset + ireg - Zi) dXi = (xOffset + ireg - Xi) # Taper terms for decay function with warnings.catch_warnings(): warnings.simplefilter('ignore') tZi = numpy.nan_to_num(numpy.sqrt(1 - (dZi / ireg)**2)) tXi = numpy.nan_to_num(numpy.sqrt(1 - (dXi / ireg)**2)) tZi[tZi == numpy.inf] = 0 tXi[tXi == numpy.inf] = 0 # Actual tapers for Kaiser window taperZ = bessi0(b * tZi) / bessi0(b) taperX = bessi0(b * tXi) / bessi0(b) # Windowed sinc responses in Z and X responseZ = numpy.sinc(dZi) * taperZ responseX = numpy.sinc(dXi) * taperX # Combined 2D source response result = responseX * responseZ return result
def KaiserWindowedSinc(ireg, offset): ''' Finds 2D source terms to approximate a band-limited point source, based on Hicks, Graham J. (2002) Arbitrary source and receiver positioning in finite-difference schemes using Kaiser windowed sinc functions. Geophysics (67) 1, 156-166. KaiserWindowedSinc(ireg, offset) --> 2D ndarray of size (2*ireg+1, 2*ireg+1) Input offset is the 2D offsets in fractional gridpoints between the source location and the nearest node on the modelling grid. ''' from scipy.special import i0 as bessi0 import warnings try: b = HC_KAISER.get(ireg) except KeyError: print('Kaiser windowed sinc function not implemented for half-width of %d!'%(ireg,)) raise freg = 2*ireg+1 xOffset, zOffset = offset # Grid from 0 to freg-1 Zi, Xi = numpy.mgrid[:freg,:freg] # Distances from source point dZi = (zOffset + ireg - Zi) dXi = (xOffset + ireg - Xi) # Taper terms for decay function with warnings.catch_warnings(): warnings.simplefilter('ignore') tZi = numpy.nan_to_num(numpy.sqrt(1 - (dZi / ireg)**2)) tXi = numpy.nan_to_num(numpy.sqrt(1 - (dXi / ireg)**2)) tZi[tZi == numpy.inf] = 0 tXi[tXi == numpy.inf] = 0 # Actual tapers for Kaiser window taperZ = bessi0(b*tZi) / bessi0(b) taperX = bessi0(b*tXi) / bessi0(b) # Windowed sinc responses in Z and X responseZ = numpy.sinc(dZi) * taperZ responseX = numpy.sinc(dXi) * taperX # Combined 2D source response result = responseX * responseZ return result
u=1/x Ae=e*(1+e/2)/(1+e) Be=1+e return 0.5-Ae*u+np.sqrt((0.5-Ae*u)**2+Be*u) GMsun_kpc = 4.300917248e-6 # G*M_sun/kpc (km/s)^2 GMsun_kpc2 = 1.3938e-19 # G*M_sun/kpc^2 m/s^2 Md = 1.e11 # mass of the disk in solar masses a0 = 1.2e-10 # MOND critical acceleration in m/s^2 Rd = 5. # disk scale length in kpc R = np.logspace(-2.,1.7,100) # radius in units of kpc M_R = Md*(1-np.exp(-R/Rd)*(1+R/Rd)) Vsphere = np.sqrt(GMsun_kpc*M_R/R) y = R/(2*Rd) bess = bessi0(y)*bessk0(y)-bessi1(y)*bessk1(y) Vd = np.sqrt(2*GMsun_kpc*(Md/Rd)*y**2*bess) Mb = 2.e10 R_H=1.5/(1.+np.sqrt(2.)) # Hernquist radius in kpc Vb=1.e-3*np.sqrt(Mb)*np.sqrt(4.3)*(R/(R+R_H)**2)**0.5 # rotation velocity due to the bulge (km/s) Vtot=np.sqrt(Vb**2+Vd**2) gtot=(1.e3*Vtot)**2/(R*3.086e+19) Vtot_mond = np.sqrt(fEFE([a0,0.],gtot/a0))*Vtot fig = plt.figure(figsize=(15,10)) gs = gridspec.GridSpec(10,10) plt.rc('xtick',labelsize=20) plt.rc('ytick',labelsize=20) plt.rc('axes',labelsize=25)