def mult(map_a, map_b):

    res_a = 1 / map_a.data.pixsize()
    res_b = 1 / map_b.data.pixsize()

    if res_a == res_b:
        prod = map_a.copy()
        prod.data *= map_b.data
    elif res_a < res_b:
        print("resample map a")
        prod = map_b.copy()
        map_a_proj = so_map.car2car(map_a, map_b)
        prod.data *= map_a_proj.data
    elif res_b < res_a:
        print("resample map b")
        prod = map_a.copy()
        map_b_proj = so_map.car2car(map_b, map_a)
        prod.data *= map_b_proj.data

    return prod
Пример #2
0
def create_crosslink_mask(xlink_map, cross_link_threshold):
    # remove pixels with very little amount of cross linking
    xlink = so_map.read_map(xlink_map)
    xlink_lowres = xlink.downgrade(32)
    with np.errstate(invalid="ignore"):
        x_mask = (np.sqrt(xlink_lowres.data[1]**2 + xlink_lowres.data[2]**2) /
                  xlink_lowres.data[0])
    x_mask[np.isnan(x_mask)] = 1
    x_mask[x_mask >= cross_link_threshold] = 1
    x_mask[x_mask < cross_link_threshold] = 0
    x_mask = 1 - x_mask
    xlink_lowres.data[0] = x_mask
    xlink = so_map.car2car(xlink_lowres, xlink)
    x_mask = xlink.data[0].copy()
    id = np.where(x_mask > 0.9)
    x_mask[:] = 0
    x_mask[id] = 1
    return x_mask