vcor_dual_prf/vcor_dual_prf.py
def _vref_cmean_sc(data_ma, kernel=np.ones((7, 7)), v_ny=None, prf_factor_arr=None, min_valid=1):
    """
    Estimate reference velocity using 'cmean_sc' method (Altube et al., 2017):
    local circular mean velocity, phase space statistics with PRF-based scaling.
    
    """

    mask = data_ma.mask

    # 'Convolution' kernels for calculating ref. velocity
    k_h, k_l = _prf_hl_kernels(kernel)

    # Build signature array (high->-1, low->1)
    sign_arr = _sign_array(prf_factor_arr)

    # Convert to phases and scale values based on the PRF
    ph_arr = np.ma.array(data=data_ma.data*(m.pi/v_ny), mask=mask)
    ph_sc_ma = ph_arr*prf_factor_arr

    # Local circular mean of high and low PRF gates
    b_h = local_cmean(ph_sc_ma, kernel=k_h)
    b_l = local_cmean(ph_sc_ma, kernel=k_l)

    # Reference PHASE for outlier detection:
    ph_ref = sign_arr*(b_l-b_h)
    ph_ref = np.ma.arctan2(np.ma.sin(ph_ref), np.ma.cos(ph_ref))

    # Mask gates which do not have a minimum number of neighbours
    mask_h = _min_valid_mask(mask, kernel=k_h, min_th=min_valid)
    mask_l = _min_valid_mask(mask, kernel=k_l, min_th=min_valid)
    nmin_mask = np.ma.mask_or(mask_h, mask_l)
    new_mask = np.ma.mask_or(data_ma.mask, nmin_mask)

    v_ref = np.ma.array(data=ph_ref*(v_ny/m.pi), mask=new_mask)

    return v_ref

    Estimate reference velocity using 'cmean_sc' method (Altube et al., 2017):
    local circular mean velocity, phase space statistics with PRF-based scaling.
    
    
Estimate reference velocity using 'cmean_sc' method (Altube et al., 2017):
local circular mean velocity, phase space statistics with PRF-based scaling.
Estimate reference velocity using ' cmean_sc ' method ( Altube et al . 2017 ) : local circular mean velocity phase space statistics with PRF - based scaling .
def _vref_cmean_sc(data_ma, kernel=np.ones((7, 7)), v_ny=None, prf_factor_arr=None, min_valid=1):
    mask = data_ma.mask
    k_h, k_l = _prf_hl_kernels(kernel)
    sign_arr = _sign_array(prf_factor_arr)
    ph_arr = np.ma.array(data=data_ma.data*(m.pi/v_ny), mask=mask)
    ph_sc_ma = ph_arr*prf_factor_arr
    b_h = local_cmean(ph_sc_ma, kernel=k_h)
    b_l = local_cmean(ph_sc_ma, kernel=k_l)
    ph_ref = sign_arr*(b_l-b_h)
    ph_ref = np.ma.arctan2(np.ma.sin(ph_ref), np.ma.cos(ph_ref))
    mask_h = _min_valid_mask(mask, kernel=k_h, min_th=min_valid)
    mask_l = _min_valid_mask(mask, kernel=k_l, min_th=min_valid)
    nmin_mask = np.ma.mask_or(mask_h, mask_l)
    new_mask = np.ma.mask_or(data_ma.mask, nmin_mask)
    v_ref = np.ma.array(data=ph_ref*(v_ny/m.pi), mask=new_mask)
    return v_ref
def _vref_cmean_sc ( data_ma , kernel = np . ones ( ( 7 , 7 ) ) , v_ny = None , prf_factor_arr = None , min_valid = 1 ) : mask = data_ma . mask k_h , k_l = _prf_hl_kernels ( kernel ) sign_arr = _sign_array ( prf_factor_arr ) ph_arr = np . ma . array ( data = data_ma . data * ( m . pi / v_ny ) , mask = mask ) ph_sc_ma = ph_arr * prf_factor_arr b_h = local_cmean ( ph_sc_ma , kernel = k_h ) b_l = local_cmean ( ph_sc_ma , kernel = k_l ) ph_ref = sign_arr * ( b_l - b_h ) ph_ref = np . ma . arctan2 ( np . ma . sin ( ph_ref ) , np . ma . cos ( ph_ref ) ) mask_h = _min_valid_mask ( mask , kernel = k_h , min_th = min_valid ) mask_l = _min_valid_mask ( mask , kernel = k_l , min_th = min_valid ) nmin_mask = np . ma . mask_or ( mask_h , mask_l ) new_mask = np . ma . mask_or ( data_ma . mask , nmin_mask ) v_ref = np . ma . array ( data = ph_ref * ( v_ny / m . pi ) , mask = new_mask ) return v_ref
Estimate reference velocity using 'cmean_sc' method (Altube et al., 2017):
local circular mean velocity, phase space statistics with PRF-based scaling.
Estimate reference velocity using ' cmean_sc ' method ( Altube et al . 2017 ) : local circular mean velocity phase space statistics with PRF - based scaling .
"""
    Estimate reference velocity using 'cmean_sc' method (Altube et al., 2017):
    local circular mean velocity, phase space statistics with PRF-based scaling.
    
    """ # 'Convolution' kernels for calculating ref. velocity # Build signature array (high->-1, low->1) # Convert to phases and scale values based on the PRF # Local circular mean of high and low PRF gates # Reference PHASE for outlier detection: # Mask gates which do not have a minimum number of neighbours
data_ma
kernel
v_ny
prf_factor_arr
min_valid