Пример #1
0
def plot_isophotes(axA, axB, dataset, contour_color, label, edge_in_pixel, contour_base, new_grid_size, 
                   title=False, legend=False): 
    if dataset == evn38:
        hdr, raw = read.fits_data(dataset.filename)
        A = make_subimage(raw, dataset.pos_pix, "A_core", edge_in_pixel, edge_in_pixel)
        B = make_subimage(raw, dataset.pos_pix, "B_core", edge_in_pixel, edge_in_pixel)
        levs_A = measure.contour_levels(dataset.rms, A.max(), base = contour_base, step=math.sqrt(2))
        levs_B = measure.contour_levels(dataset.rms, B.max(), base = contour_base, step=math.sqrt(2))
    if dataset == vlba or dataset == gvlbi:
        hdr, A_raw = read.fits_data(dataset.filenameA)
        hdr, B_raw = read.fits_data(dataset.filenameB)
        A = make_subimage(A_raw, dataset.pos_A_pix, "A_core", edge_in_pixel, edge_in_pixel)
        B = make_subimage(B_raw, dataset.pos_B_pix, "B_core", edge_in_pixel, edge_in_pixel)
        levs_A = measure.contour_levels(dataset.rms_A, A.max(), base = contour_base, step=math.sqrt(2))
        levs_B = measure.contour_levels(dataset.rms_B, B.max(), base = contour_base, step=math.sqrt(2))
    A =  rebin(A, new_grid_size)
    B =  rebin(B, new_grid_size)
    A_X, A_Y, A = recenter_data(A, (100, 100))
    B_X, B_Y, B = recenter_data(B, (100, 100))
    mu_A = dataset.mu_A
    mu_B = dataset.mu_B
    mu = mu_A.mean() / mu_B.mean()
    cntrs = axA.contour(A_X, A_Y, A, levels = levs_A, colors = contour_color, lw=1)
    axB.contour(B_X, B_Y, B, levels = levs_B, colors = contour_color, lw=1)
    if title:
        axA.set_title("%s (image A)"%label)
        axB.set_title("%s (image B)"%label)
    if legend:
        axB.legend([cntrs.collections[0]], ["%s"%label])
    return cntrs, axA, axB
Пример #2
0
    top = - center[1] * scale
    right = left + pixels.shape[1] * scale
    bottom = top + pixels.shape[0] * scale
    datas.append({
        "scale": scale,
        "top": top,
        "left": left,
        "right": right,
        "bottom": bottom,
        "data": pixels,
        "rms": dataset.rms_A,
        "base": dataset.base_A
    })

for i, data in enumerate(datas):
    levels = measure.contour_levels(data["rms"], data["data"].max(), base = data["base"], step=math.sqrt(2))
    cnt = axA.contourf(
        np.arange(data["left"], data["right"], data["scale"]),
        np.arange(data["top"], data["bottom"], data["scale"]),
        data["data"],
        levels = levels, colors=colors[i],
        alpha = 0.5
    )
    lines.append(cnt.collections[0])

## Image B
datas = []
for dataset in datasets:
    if not hasattr(dataset, "filenameB"):
        dataset.filenameB = dataset.filename
    if not hasattr(dataset, "rms_B"):