def write_source(t, s, shot, imp="Ca"):
    """Write a STRAHL source file. 
        
    This will overwrite any {imp}flx{shot}.dat locally. 
        
    Parameters
    ----------
    t : array of float, (`n`,)
        The timebase (in seconds).
    s : array of float, (`n`,)
        The source function (in particles/s).
    shot : int
        Shot number, only used for saving to a .dat file
    imp : str, optional
        Impurity species atomic symbol

    Returns
    -------
    contents : str
        Content of the source file written to {imp}flx{shot}.dat

    """
    contents = "{.d}\n".format(len(t),)
    for tv, sv in zip(t, s):
        contents += "    {5.5f}    {5.5e}\n".format(tv, sv)

    with open(f"{imp}flx{shot}.dat", "w") as f:
        f.write(contents)

    return contents