Skip to content

acceleration resampling #51

@FengqiuAdamDong

Description

@FengqiuAdamDong

Hello,
I am looking at the resample_tim function and I can not work out where the formulation comes from.
This is clearly different from the pulsar handbook and Camillo et al 2000

##THIS CODE IS COPIED FROM SIGPYPROC3, https://github.com/FRBs/sigpyproc3/blob/main/sigpyproc/core/kernels.py
@njit("f4[:](f4[:], f4, f4)", cache=True, parallel=True)
def resample_tim(array: np.ndarray, accel: float, tsamp: float) -> np.ndarray:
    nsamps = len(array) - 1 if accel > 0 else len(array)
    resampled = np.zeros(nsamps, dtype=array.dtype)

    partial_calc = (accel * tsamp) / (2 * CONST_C_VAL)
    tot_drift = partial_calc * (nsamps // 2) ** 2
    last_bin = 0
    for ii in prange(nsamps):
        index = int(ii + partial_calc * (ii - nsamps // 2) ** 2 - tot_drift)
        resampled[index] = array[ii]
        if index - last_bin > 1:
            resampled[index - 1] = array[ii]
        last_bin = index
    return resampled

The version in the handbook and Camollo et al 2000 gives the formulation

Image

In saying that, it seems to work. I have used it successfully to de-modulate the orbit of binaries in Ter 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions