Exemplo n.º 1
0
def srt(data, cube, **kwargs):
    """
    Define Solar Rotational Tomography model with optional masking of
    data and map areas. Can also define priors.
    
    Parameters
    ----------
    data: InfoArray
        data cube
    cube: FitsArray
        map cube
    obj_rmin: float
        Object minimal radius. Areas below obj_rmin are masked out.
    obj_rmax: float
        Object maximal radius. Areas above obj_rmax are masked out.
    data_rmin: float
        Data minimal radius. Areas below data_rmin are masked out.
    data_rmax: float
        Data maximal radius. Areas above data_rmax are masked out.
    mask_negative: boolean
        If true, negative values in the data are masked out.

    Returns
    -------
    P : The projector with masking
    D : Smoothness priors

    """
    # Parse kwargs.
    obj_rmin = kwargs.get('obj_rmin', None)
    obj_rmax = kwargs.get('obj_rmax', None)
    data_rmin = kwargs.get('data_rmin', None)
    data_rmax = kwargs.get('data_rmax', None)
    mask_negative = kwargs.get('mask_negative', None)
    # Model : it is Solar rotational tomography, so obstacle="sun".
    P = siddon_lo(data.header, cube.header, obstacle="sun")
    D = [lo.diff(cube.shape, axis=i) for i in xrange(cube.ndim)]
    # Define masking.
    if obj_rmin is not None or obj_rmax is not None:
        Mo, obj_mask = mask_object(cube, kwargs)
        P = P * Mo.T
        D = [Di * Mo.T for Di in D]
    else:
        obj_mask = None
    if (data_rmin is not None or
        data_rmax is not None or
        mask_negative is not None):
        data_mask = secchi.define_data_mask(data,
                                            Rmin=data_rmin,
                                            Rmax=data_rmax,
                                            mask_negative=True)
        Md = lo.mask(data_mask)
        P = Md * P
    else:
        data_mask = None
    return P, D, obj_mask, data_mask
Exemplo n.º 2
0
def pb_thomson_lo(data, in_map, u, mask=None):
    """Defines thomson scattering linear operator"""
    # data coefs
    data_coefs = _pb_data_coef(data).flatten()
    O = lo.diag(data_coefs)
    # map coefs
    map_coefs = _pb_map_coef(in_map, u).flatten()
    M = lo.diag(map_coefs)
    # projection
    P = siddon_lo(data.header, in_map.header, obstacle="sun", mask=mask)
    # thomson lo
    T = O * P * M
    return T
Exemplo n.º 3
0
def srt(data, cube, **kwargs):
    """
    Define Solar Rotational Tomography model with optional masking of
    data and map areas. Can also define priors.
    
    Parameters
    ----------
    data: InfoArray
        data cube
    cube: FitsArray
        map cube
    obj_rmin: float
        Object minimal radius. Areas below obj_rmin are masked out.
    obj_rmax: float
        Object maximal radius. Areas above obj_rmax are masked out.
    data_rmin: float
        Data minimal radius. Areas below data_rmin are masked out.
    data_rmax: float
        Data maximal radius. Areas above data_rmax are masked out.
    mask_negative: boolean
        If true, negative values in the data are masked out.

    Returns
    -------
    P : The projector with masking
    D : Smoothness priors
    obj_mask : object mask array
    data_mask : data mask array

    """
    # Model : it is Solar rotational tomography, so obstacle="sun".
    data_mask = solar.define_data_mask(data, **kwargs)
    P = siddon_lo(data.header, cube.header, mask=data_mask, obstacle="sun")
    D = smoothness_prior(cube, kwargs.get("height_prior", False))
    P, D, obj_mask = _apply_object_mask(P, D, cube, **kwargs)
    return P, D, obj_mask, data_mask