Ejemplo n.º 1
0
from scatterbrane import Brane, Target, utilities

# set up logger
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()

# import our source image and covert it to gray scale
src_file = 'source_images/640px-Bethmaennchen2.square.jpg'
rgb = imread(src_file)[::-1]
I = 255 - (np.array([0.2989, 0.5870, 0.1140])[np.newaxis, np.newaxis, :] *
           rgb).sum(axis=-1)
I *= np.pi / I.sum()

# and smooth image
I = utilities.smoothImage(I, 1., 8.)

# make up some scale for our image. Let's have it span 120 uas.
write_figs = False
wavelength = 1e-3
FOV = 120.
dx = FOV / I.shape[0]

# initialize the scattering screen @ 1mm
b = Brane(I, dx, wavelength=1.e-3, nphi=2**13)

# initialize Target object for calculating visibilities and uv samples
sgra = Target(wavelength=1.e-3)

# calculate uv samples for our closure phase triangle and on the source image
site_triangle = ["SMT", "ALMA", "LMT"]
Ejemplo n.º 2
0
def updatefig(*args):
    global i
    i = (i + 1) % num_samples
    im.set_array(utilities.smoothImage(frames[i],b.dx,2*b.dx))
    return im
Ejemplo n.º 3
0
from scatterbrane import Brane,Target,utilities

# set up logger
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()

# import our source image and covert it to gray scale
src_file = 'source_images/640px-Bethmaennchen2.square.jpg'
rgb = imread(src_file)[::-1]
I = 255 - (np.array([0.2989,0.5870,0.1140])[np.newaxis,np.newaxis,:]*rgb).sum(axis=-1)
I *= np.pi/I.sum()

# and smooth image
I = utilities.smoothImage(I,1.,8.)

# make up some scale for our image. Let's have it span 120 uas.
write_figs = False
wavelength=1e-3
FOV = 120.
dx = FOV/I.shape[0]

# initialize the scattering screen @ 1mm
b = Brane(I,dx,wavelength=1.e-3,nphi=2**13)

# initialize Target object for calculating visibilities and uv samples
sgra = Target(wavelength=1.e-3)

# calculate uv samples for our closure phase triangle and on the source image
site_triangle = ["SMT","ALMA","LMT"]
Ejemplo n.º 4
0
for i in range(num_samples):
    # update source image to include a sinusoidal flux modulation 
    b.setModel(I*(1. - 0.4*np.sin(2*np.pi*i/(2*num_samples))), dx) # comment out to speedup 
    b.scatter(move_pix=i*b.ips)
    fluxes.append(b.iss.sum())
    frames.append(b.iss)
logger.info('took {0:g}s'.format(time.time()-tic))
# 1962.92s

# make figures
fig_file = '../_static/time_variability/'
extent=b.dx*b.nx//2*np.array([1,-1,-1,1])

plt.figure()
plt.subplot(121)
isrc_smooth = utilities.smoothImage(b.isrc,b.dx,2.*b.dx)
plt.imshow(isrc_smooth,extent=extent,cmap=cmap)
plt.xlabel('$\Delta\\alpha$ [$\mu$as]'); plt.ylabel('$\Delta\delta$ [$\mu$as]')
plt.subplot(122)
iss_smooth = utilities.smoothImage(b.iss,b.dx,2.*b.dx)
plt.imshow(iss_smooth,extent=extent,cmap=cmap)
plt.gca().set_yticklabels(10*['']); plt.gca().set_xticklabels(10*[''])
if write_figs: plt.savefig(fig_file+'/iss.png',bbox_inches='tight')

plt.figure()
t = 1./fs*np.arange(len(fluxes))/3600.
plt.plot(t,fluxes,color='#377EB8')
plt.xlabel('time [hr]')
plt.ylabel('flux [Jy]')
plt.xlim([0,t.max()])
plt.grid()