Skip to content

the correct way to get_PSR_freq #713

Open
@luojing1211

Description

@luojing1211

Currently get_PSR_freq(modelF0=True) only returns F0 in the model, however, should we get the F0 at TOA? F0(TOA) = F0 + dt * F1 +....
Secondly, this check seems duplicated with the Spindown component's validation.

PINT/src/pint/residuals.py

Lines 135 to 156 in 6fbbd92

if modelF0:
"""Return pulsar rotational frequency in Hz. model.F0 must be defined."""
if self.model.F0.units != "Hz":
ValueError("F0 units must be Hz")
# All residuals require the model pulsar frequency to be defined
F0names = ["F0", "nu"] # recognized parameter names, needs to be changed
nF0 = 0
for n in F0names:
if n in self.model.params:
F0 = getattr(self.model, n).value
nF0 += 1
if nF0 == 0:
raise ValueError(
"no PSR frequency parameter found; "
+ "valid names are %s" % F0names
)
if nF0 > 1:
raise ValueError(
"more than one PSR frequency parameter found; "
+ "should be only one from %s" % F0names
)
return F0 * u.Hz

Metadata

Metadata

Assignees

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