示例#1
0
if __name__ == '__main__':
    t_init_prog = time.clock()

    L = Lines()

    rbinini = 0.
    rbinfin = 3.
    rbinstep = 0.2
    R_bin__r = np.arange(rbinini, rbinfin + rbinstep, rbinstep)
    R_bin_center__r = (R_bin__r[:-1] + R_bin__r[1:]) / 2.0
    N_R_bins = len(R_bin_center__r)

    califaID = sys.argv[1]

    K = read_one_cube(califaID, EL=True, GP=True, config=-1)

    print '# califaID:', califaID, ' N_zones:', K.N_zone, ' lines:', K.EL.lines

    pa, ba = K.getEllipseParams()
    K.setGeometry(pa, ba)

    lines = K.EL.lines
    f_obs__lz = {}
    for i, l in enumerate(lines):
        mask = np.bitwise_or(~np.isfinite(K.EL.flux[i]),
                             np.less(K.EL.flux[i], 1e-40))
        f_obs__lz[l] = np.ma.masked_array(K.EL.flux[i], mask=mask)
        print l, f_obs__lz[l].max(), f_obs__lz[l].min(), f_obs__lz[l].mean()

    x_Y__z, integrated_x_Y = calc_xY(K, 3.2e7)
示例#2
0
        'figure.subplot.left': 0.04,
        'figure.subplot.bottom': 0.04,
        'figure.subplot.right': 0.97,
        'figure.subplot.top': 0.95,
        'figure.subplot.wspace': 0.1,
        'figure.subplot.hspace': 0.25,
        'image.cmap': cmap,
    }
    plt.rcParams.update(plotpars)
    # plt.ioff()
    figsize = (width, width * aspect)
    return plt.figure(fignum, figsize, dpi=dpi)

if __name__ == '__main__':
    g = sys.argv[1]
    Kpix = read_one_cube(g, debug=True, EL=True, config=-1, elliptical=True)
    Kv20 = read_one_cube(g, debug=True, EL=True, config=-2, elliptical=True)
    iHa_pix = Kpix.EL.lines.index('6563')
    iHa_v20 = Kv20.EL.lines.index('6563')
    fHapixsum__z = np.zeros((Kv20.N_zone))
    f6563__zpix_aux = Kpix.EL.flux[iHa_pix]
    mask = np.bitwise_or(~np.isfinite(f6563__zpix_aux), np.less(f6563__zpix_aux, 1e-40))
    f6563__zpix = np.ma.masked_array(f6563__zpix_aux, mask=mask).filled(0.)
    for i in xrange(Kv20.N_y):
        for j in xrange(Kv20.N_x):
            if Kv20.qZones[i, j] >= 0:
                z_i = Kv20.qZones[i, j]
                z_i_pix = Kpix.qZones[i, j]
                fHapixsum__z[z_i] += f6563__zpix[z_i_pix]

    # f = plot_setup(latex_column_width, 1.)
示例#3
0
if __name__ == '__main__':
    t_init_prog = time.clock()

    L = Lines()

    rbinini = 0.
    rbinfin = 3.
    rbinstep = 0.2
    R_bin__r = np.arange(rbinini, rbinfin + rbinstep, rbinstep)
    R_bin_center__r = (R_bin__r[:-1] + R_bin__r[1:]) / 2.0
    N_R_bins = len(R_bin_center__r)

    califaID = sys.argv[1]

    K = read_one_cube(califaID, EL=True, GP=True)

    print '# califaID:', califaID, ' N_zones:', K.N_zone, ' lines:', K.EL.lines

    pa, ba = K.getEllipseParams()
    K.setGeometry(pa, ba)

    lines = K.EL.lines
    f_obs__lz = {}
    for i, l in enumerate(lines):
        mask = np.bitwise_or(~np.isfinite(K.EL.flux[i]),
                             np.less(K.EL.flux[i], 1e-40))
        f_obs__lz[l] = np.ma.masked_array(K.EL.flux[i], mask=mask)
        print l, f_obs__lz[l].max(), f_obs__lz[l].min(), f_obs__lz[l].mean()

    x_Y__z, integrated_x_Y = calc_xY(K, 3.2e7)
示例#4
0
if __name__ == '__main__':
    args = parser_args()
    print_args()

    imgDir = califa_work_dir + 'images/'
    Zsun = 0.019
    
    H = H5SFRData(args.hdf5)
    tSF__T = H.tSF__T
    ageMyr = tSF__T[args.itSF] / 1e6
    
    if (len(np.where(H.califaIDs == args.califaID)[0]) == 0):
        exit('<<< plot: %s: no data.' % args.califaID)
    
    K = read_one_cube(args.califaID, EL = True)
    pa, ba = K.getEllipseParams()
    K.setGeometry(pa, ba)

    f, axArr = plt.subplots(4, 4)
    f.set_size_inches(24, 20)
    
    for ax in f.axes:
        ax.set_axis_off()
    
    ax = axArr[0, 0]
    ax.set_axis_on()
    galaxyImgFile = imgDir + args.califaID + '.jpg'
    galimg = plt.imread(galaxyImgFile)
    plt.setp(ax.get_xticklabels(), visible = False)
    plt.setp(ax.get_yticklabels(), visible = False)
示例#5
0
import numpy as np
from scipy.optimize import minimize
from CALIFAUtils.scripts import read_one_cube
from matplotlib import pyplot as plt


def gauss(p, x):
    A1, mu1, sigma1, A2, mu2, sigma2, A3, mu3, sigma3 = p
    g1 = A1 * np.exp(-(x - mu1)**2 / (2. * sigma1**2))
    g2 = A2 * np.exp(-(x - mu2)**2 / (2. * sigma2**2))
    g3 = A3 * np.exp(-(x - mu3)**2 / (2. * sigma3**2))
    return g1 + g2 + g3


K = read_one_cube('K0010', debug=True, config=-2)
N_zone = K.N_zone
l_obs = np.copy(K.l_obs)
f_obs__lz = np.copy(K.f_obs)
f_syn__lz = np.copy(K.f_syn)
v_0__z = np.copy(K.v_0)
v_d__z = np.copy(K.v_d)
K.close()
del K
zone = 0
f_obs__l = f_obs__lz[:, zone]
f_syn__l = f_syn__lz[:, zone]
f_res__l = f_obs__l - f_syn__l
f_res__l *= 1e16
Hb_window = np.bitwise_and(np.greater(l_obs, 6563 - 70),
                           np.less(l_obs, 6563 + 70))
to_min = lambda p: np.square(f_res__l[Hb_window] - gauss(p, l_obs[Hb_window])
示例#6
0
if __name__ == '__main__':
    t_init_prog = time.clock()

    L = Lines()

    rbinini = 0.
    rbinfin = 3.
    rbinstep = 0.2
    R_bin__r = np.arange(rbinini, rbinfin + rbinstep, rbinstep)
    R_bin_center__r = (R_bin__r[:-1] + R_bin__r[1:]) / 2.0
    N_R_bins = len(R_bin_center__r)

    califaID = sys.argv[1]

    K = read_one_cube(califaID, EL=True, GP=True, elliptical=True, config=-2)

    print '# califaID:', califaID, ' N_zones:', K.N_zone, ' lines:', K.EL.lines

    lines = K.EL.lines
    print lines

    EWHa__yx = K.zoneToYX(K.EL.EW[K.EL.lines.index('6563')], extensive=False)
    distance_HLR__yx = K.pixelDistance__yx / K.pixelsPerHLR
    distance_HLR__r = R_bin_center__r

    # fluxes, SBs and cumulative SB
    f_obs__lz = {}
    f_obs__lyx = {}
    SB_obs__lyx = {}
    SB_obs_2__lyx = {}
示例#7
0
def cmap_discrete(colors=[(1, 0, 0), (0, 1, 0), (0, 0, 1)],
                  n_bins=3,
                  cmap_name='myMap'):
    cm = mpl.colors.LinearSegmentedColormap.from_list(cmap_name,
                                                      colors,
                                                      N=n_bins)
    return cm


if __name__ == '__main__':
    P = CALIFAPaths()
    califaID = sys.argv[1]

    kw_cube = dict(EL=EL, config=config, elliptical=elliptical)
    K = read_one_cube(califaID, **kw_cube)
    if K is None:
        print 'califaID:', califaID, ' trying another qVersion...'
        K = try_q055_instead_q054(califaID, **kw_cube)
        if K is None or K.EL is None:
            print
            sys.exit('califaID:%s missing fits files...' % califaID)

    lines = K.EL.lines
    maskSNR = K.EL._setMaskLineSNR('4861', minsnr=minSNR)
    maskSNR = np.bitwise_or(maskSNR, K.EL._setMaskLineSNR('6563',
                                                          minsnr=minSNR))

    f_obs__lz = {}
    f_obs__lyx = {}
    SB_obs__lyx = {}