Skip to content

Commit

Permalink
Merge branch 'master' into validation
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisrkckl authored Dec 28, 2023
2 parents b86a90e + b8d8f7c commit 4981fa3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ the released changes.
- Fixed `derived_params` when OMDOT has 0 uncertainty
- `model.find_empty_masks` will now also look at DMX and SWX parameters
- Fixed `make_fake_toas_fromtim`
- Emit warnings when `WaveX`/`DMWaveX` is used together with other representations of red/DM noise
- Use `Hessian` instead of `Hessdiag` in `DownhillFitter._fit_noise`; compute noise parameter uncertainties only once in `DownhillFitter.fit_toas`.
- Consistent naming in `TimingModel.get_params_mapping()`
- Better exceptions for unsupported/unimplemented binary models (BTX, MSS, etc.)
- Emit warnings when `WaveX`/`DMWaveX` is used together with other representations of red/DM noise
### Removed
22 changes: 21 additions & 1 deletion src/pint/models/timing_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ def remove_param(self, param):

def get_params_mapping(self):
"""Report which component each parameter name comes from."""
param_mapping = {p: "timing_model" for p in self.top_level_params}
param_mapping = {p: "TimingModel" for p in self.top_level_params}
for cp in list(self.components.values()):
for pp in cp.params:
param_mapping[pp] = cp.__class__.__name__
Expand Down Expand Up @@ -3850,6 +3850,26 @@ def search_binary_components(self, system_name):
for cp_name in all_systems:
if system_name == self.components[cp_name].binary_model_name:
return self.components[cp_name]

if system_name == "BTX":
raise UnknownBinaryModel(
"`BINARY BTX` is not supported bt PINT. Use "
"`BINARY BT` instead. It supports both orbital "
"period (PB, PBDOT) and orbital frequency (FB0, ...) "
"parametrizations."
)
elif system_name == "DDFWHE":
raise UnknownBinaryModel(
"`BINARY DDFWHE` is not supported, but the same model "
"is available as `BINARY DDH`."
)
elif system_name in ["MSS", "EH", "H88", "DDT", "BT1P", "BT2P"]:
# Binary model list taken from
# https://tempo.sourceforge.net/ref_man_sections/binary.txt
raise UnknownBinaryModel(
f"`The binary model {system_name} is not yet implemented."
)

raise UnknownBinaryModel(
f"Pulsar system/Binary model component"
f" {system_name} is not provided."
Expand Down
3 changes: 0 additions & 3 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ def test_model():
# run tempo1 also, if the tempo_utils module is available
did_tempo1 = False
with contextlib.suppress(Exception):
import tempo_utils

log.info("Running TEMPO1...")
t1_result = np.genfromtxt(
f"{t1_parfile}.tempo_test", names=True, comments="#", dtype=np.longdouble
)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_model_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def test_component_categories(model):
("ELL1H", pytest.raises(MissingParameter)),
("T2", pytest.raises(UnknownBinaryModel)),
("ELLL1", pytest.raises(UnknownBinaryModel)),
("BTX", pytest.raises(UnknownBinaryModel)),
("DDFWHE", pytest.raises(UnknownBinaryModel)),
("MSS", pytest.raises(UnknownBinaryModel)),
]


Expand Down

0 comments on commit 4981fa3

Please sign in to comment.