Skip to content

Commit

Permalink
basic support for polyco doppler and rms
Browse files Browse the repository at this point in the history
  • Loading branch information
dlakaplan committed Jan 15, 2024
1 parent b8d8f7c commit fb12177
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pint/polycos.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,13 +793,17 @@ def generate_polycos(
rdcPhase = rdcPhase.int - (dt * model.F0.value * 60.0) + rdcPhase.frac
dtd = dt.astype(float) # Truncate to double
rdcPhased = rdcPhase.astype(float)
coeffs = np.polyfit(dtd, rdcPhased, ncoeff - 1)[::-1]
rawcoeffs = np.polyfit(dtd, rdcPhased, ncoeff - 1)
coeffs = rawcoeffs[::-1]
rms = np.std(np.polyval(rawcoeffs, dtd) - rdcPhased)

date, hms = Time(tmid, format="mjd", scale="utc").iso.split()
yy, mm, dd = date.split("-")
date = f"{dd}-{MONTHS[int(mm) - 1]}-{yy[-2:]}"
hms = float(hms.replace(":", ""))

ssbfreq = model.barycentric_radio_freq(toaMid)
doppler = 1e4 * ((ssbfreq - toaMid["freq"]) / toaMid["freq"]).decompose()
entry = PolycoEntry(
tmid,
segLength,
Expand All @@ -816,8 +820,8 @@ def generate_polycos(
entry_dict["utc"] = hms
entry_dict["tmid"] = tmid
entry_dict["dm"] = model.DM.value
entry_dict["doppler"] = 0.0
entry_dict["logrms"] = 0.0
entry_dict["doppler"] = doppler
entry_dict["logrms"] = np.log10(rms)
entry_dict["mjd_span"] = segLength
entry_dict["t_start"] = entry.tstart
entry_dict["t_stop"] = entry.tstop
Expand Down

0 comments on commit fb12177

Please sign in to comment.