Skip to content

Commit

Permalink
is_binary uses isinstance and inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
dlakaplan committed Oct 30, 2023
1 parent 9d59661 commit 0f1d91c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ the released changes.
- Update CI tests for Python 3.12
- Made `test_grid` routines faster
- `pintk` uses downhill fitters by default
- `is_binary` attribute now uses component inheritance
### Added
- CHI2, CHI2R, TRES, DMRES now in postfit par files
- Added `WaveX` model as a `DelayComponent` with Fourier amplitudes as fitted parameters
Expand Down
5 changes: 4 additions & 1 deletion src/pint/models/timing_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,10 @@ def phase_funcs(self):
@property_exists
def is_binary(self):
"""Does the model describe a binary pulsar?"""
return any(x.startswith("Binary") for x in self.components.keys())
# need to import here to avoid circular imports
from pint.models.pulsar_binary import PulsarBinary

return any(isinstance(x, PulsarBinary) for x in self.components.keys())

def orbital_phase(self, barytimes, anom="mean", radians=True):
"""Return orbital phase (in radians) at barycentric MJD times.
Expand Down

0 comments on commit 0f1d91c

Please sign in to comment.