Exemple #1
0
from agpy import cubes
import numpy as np
import time

parallel_times = []
nonparallel_times = []
sizes = np.array([25,50,100,125,150,200,250,300])

for size in sizes:
    zz,yy,xx = np.indices([size,size,size])
    rr = np.sqrt((size/2)-((zz-(size/2))**2+(yy-(size/2))**2+(xx-(size/2))**2))

    t0 = time.time()

    smcube = cubes.smooth_cube(rr,interpolate_nan=True)
    
    t1=time.time()
    print "parallel smooth took %0.2f seconds for size = %i" % (t1-t0,size)
    parallel_times.append(t1-t0)

    smcube = cubes.smooth_cube(rr,interpolate_nan=True,parallel=False)

    t2=time.time()
    print "non-parallel smooth took %0.2f seconds for size = %i" % (t2-t1,size)
    nonparallel_times.append(t2-t1)

print parallel_times
print nonparallel_times

proctime = np.zeros(16)
size = 200
    os.system('./%s_starlink.sh' % cubename)
    makecube.make_flats(cubename,vrange=[-20,60],noisevrange=[250,300])


#import FITS_tools
import FITS_tools.cube_regrid
from astropy.io import fits
from agpy.cubes import smooth_cube

for cubename in ('LimaBean_H2CO22_cube', 'LimaBean_H213CO22_cube', 'LimaBean_H2C18O22_cube'):

    cube = fits.open(cubename+"_sub.fits")
    # kernel = ((2.5*60)**2 -  50.**2)**0.5 / sqrt(8*log(2)) = 60 arcsec
    # 60 arcsec / 15 "/pixel = 4
    cubesm2 = FITS_tools.cube_regrid.gsmooth_cube(cube[0].data, [5,4,4], use_fft=True, psf_pad=False, fft_pad=False)
    cubesm = smooth_cube(cube[0].data, kernelwidth=4, interpolate_nan=True)
    cube[0].data = cubesm
    cube.writeto(cubename+"_sub_smoothtoCband.fits",clobber=True)
    cube[0].data = cubesm2
    cube.writeto(cubename+"_sub_smoothtoCband_vsmooth.fits",clobber=True)

    #makecube.make_taucube(cubename,cubename+"_continuum.fits",etamb=0.886)
    #makecube.make_taucube(cubename,cubename+"_continuum.fits",etamb=0.886, suffix="_sub_smoothtoCband.fits")
    # -0.4 is the most negative point in the continuum map...
    makecube.make_taucube(cubename,
                          cubename+"_continuum.fits",
                          etamb=0.886,
                          suffix="_sub_smoothtoCband_vsmooth.fits",
                          outsuffix="_smoothtoCband_vsmooth.fits",
                          TCMB=2.7315+0.4)
Exemple #3
0
from agpy import cubes
import numpy as np
import time

parallel_times = []
nonparallel_times = []
sizes = np.array([25, 50, 100, 125, 150, 200, 250, 300])

for size in sizes:
    zz, yy, xx = np.indices([size, size, size])
    rr = np.sqrt((size / 2) - ((zz - (size / 2))**2 + (yy - (size / 2))**2 +
                               (xx - (size / 2))**2))

    t0 = time.time()

    smcube = cubes.smooth_cube(rr, interpolate_nan=True)

    t1 = time.time()
    print "parallel smooth took %0.2f seconds for size = %i" % (t1 - t0, size)
    parallel_times.append(t1 - t0)

    smcube = cubes.smooth_cube(rr, interpolate_nan=True, parallel=False)

    t2 = time.time()
    print "non-parallel smooth took %0.2f seconds for size = %i" % (t2 - t1,
                                                                    size)
    nonparallel_times.append(t2 - t1)

print parallel_times
print nonparallel_times