Skip to content

Reduce code duplication for make*pulse #369

Description

@mcencini

I was thinking RF pulse codes are largerly redundant. We could maybe consider reducing most of these to thin wrappers around make_rf_arbitrary(), e.g:

def make_sinc_pulse(...):
    """docstring"""
    # no need to validate (most if not all) inputs: make_arbitrary_rf already does it
    
    # focus on signal array generation
    bandwidth = time_bw_product / duration
    alpha = apodization
    n_samples = round(duration / dwell)
    t = (np.arange(1, n_samples + 1) - 0.5) * dwell
    tt = t - (duration * center_pos)
    window = 1 - alpha + alpha * np.cos(2 * np.pi * tt / duration)
    signal = np.multiply(window, np.sinc(bandwidth * tt))
    flip = np.sum(signal) * dwell * 2 * np.pi
    signal = signal * flip_angle / flip

    return pp.make_arbitrary_rf(signal, ...) # pass through relevant args

thoughts? @schuenke

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions