Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of WaveX model #1609

Merged
merged 70 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
fefe0e5
Adding wavex model
LuluAgazie Jul 5, 2023
28ff9a0
add wavex_delay
LuluAgazie Jul 5, 2023
06e2b6a
commit changes
LuluAgazie Jul 6, 2023
71c0b0c
uncomment register
LuluAgazie Jul 7, 2023
3a2424d
added comments
LuluAgazie Jul 7, 2023
fb4854c
comments added
LuluAgazie Jul 7, 2023
4ca631d
started add_wavex_components
LuluAgazie Jul 7, 2023
91edc28
add wavex component
LuluAgazie Jul 7, 2023
e4731f2
fixed add_wavex_component(s)
LuluAgazie Jul 7, 2023
d023865
added remove_wavex_component
LuluAgazie Jul 7, 2023
8c7d58d
add get_indices
LuluAgazie Jul 7, 2023
df01593
Add validate and setup
LuluAgazie Jul 7, 2023
bb82654
fixed delay function
LuluAgazie Jul 7, 2023
ba1ec72
add inital component
LuluAgazie Jul 10, 2023
c07e8df
registering new class
LuluAgazie Jul 10, 2023
5311f2c
added category
LuluAgazie Jul 10, 2023
6fd886e
add comma
LuluAgazie Jul 10, 2023
d923234
Fixed wavex_delay
LuluAgazie Jul 11, 2023
1778ca4
fix validate
LuluAgazie Jul 11, 2023
8cb296f
Add validate test and start tests
LuluAgazie Jul 11, 2023
c42b050
Adding test
LuluAgazie Jul 17, 2023
518d60d
Validate that num wxsin = num wxcos
LuluAgazie Jul 17, 2023
26a8e85
Add warnings to validate
LuluAgazie Jul 18, 2023
2044907
Adding tests
LuluAgazie Jul 18, 2023
c005106
Additional tests
LuluAgazie Jul 18, 2023
a633b2c
Small fixes to tests
LuluAgazie Jul 18, 2023
cdc4583
Added amplitude fitting
LuluAgazie Jul 19, 2023
9cd23d1
fixed base_phase
LuluAgazie Jul 27, 2023
7188ccc
Add fitter and deriv test
LuluAgazie Aug 15, 2023
9397bcf
work on utils functions
LuluAgazie Aug 15, 2023
1399c99
Add setup helper function
LuluAgazie Aug 15, 2023
66b72ee
Fixes to setup utils function
LuluAgazie Aug 15, 2023
2c3faaf
Fixed astropy table issue
LuluAgazie Aug 16, 2023
43c960d
Added ValueError to utils
LuluAgazie Aug 16, 2023
e3dd81a
Added translate wave to wavex utils
LuluAgazie Aug 16, 2023
027e6dd
Fix wave epoch
LuluAgazie Aug 16, 2023
1aa7062
add deepcopy
LuluAgazie Aug 17, 2023
0aef628
Added myself to authors
LuluAgazie Aug 17, 2023
cc34402
changelog entry
LuluAgazie Aug 17, 2023
4e4709a
Merge branch 'master' into wavex_model
dlakaplan Aug 17, 2023
bbbd423
Added docstring fixed freqs
LuluAgazie Aug 17, 2023
f2011c5
Removed old comment
LuluAgazie Aug 17, 2023
503ff32
Edited docstrings
LuluAgazie Aug 17, 2023
7623d79
Change wavex_setup to act on model
LuluAgazie Aug 21, 2023
d580c27
Changed wavex_setup exception to warning
LuluAgazie Aug 21, 2023
4ab24af
wavex_setup returns new model
LuluAgazie Aug 21, 2023
e695cbd
fixed error
LuluAgazie Aug 21, 2023
f1286be
More utils functions
LuluAgazie Aug 21, 2023
e891982
inverse translate
LuluAgazie Aug 22, 2023
e115091
fixed import issue
LuluAgazie Aug 22, 2023
d32b965
inverse translate function with additional fixes
LuluAgazie Aug 22, 2023
debc69e
changed atol for inverse translate
LuluAgazie Aug 22, 2023
0448eec
Fixed negative amplitudes
LuluAgazie Aug 22, 2023
cb55db7
Fixed wave number error
LuluAgazie Aug 22, 2023
b0ad68c
Fixing errors
LuluAgazie Aug 24, 2023
88cbecb
Changes to facilitate inverse translate
LuluAgazie Aug 25, 2023
2eccfe7
Roundtrip test and minor edits
LuluAgazie Aug 25, 2023
5521f49
Editted comments
LuluAgazie Aug 25, 2023
b00ff15
Merge branch 'master' into wavex_model
LuluAgazie Aug 25, 2023
4c1e233
Merge branch 'nanograv:master' into wavex_model
LuluAgazie Aug 27, 2023
f349c87
Minor edits from PR comments
LuluAgazie Aug 28, 2023
3bd18fb
Merge branch 'wavex_model' of https://github.com/LuluAgazie/PINT into…
LuluAgazie Aug 28, 2023
6cd0cd9
Fixed changelog
LuluAgazie Aug 28, 2023
9e3cd5b
Changed to fstrings
LuluAgazie Aug 28, 2023
7665a78
Merge branch 'master' into wavex_model
abhisrkckl Aug 29, 2023
62de390
Added wave.py changes to changelog
LuluAgazie Aug 29, 2023
1586dac
Added more tests and edited documentation
LuluAgazie Aug 29, 2023
e1b0ee7
Added unit conversion test
LuluAgazie Aug 29, 2023
4e12d0c
More tests
LuluAgazie Aug 31, 2023
325940e
Merge branch 'master' into wavex_model
LuluAgazie Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Contributors

Active developers are indicated by (*). Authors of the PINT paper are indicated by (#).

* Gabriella Agazie (*)
* Akash Anumarlapudi (*)
* Anne Archibald (#*)
* Matteo Bachetti (#)
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ the released changes.
## Unreleased
### Changed
### Added
- Added WaveX model as DelayComponent with wave amplitudes as fitted parameters
abhisrkckl marked this conversation as resolved.
Show resolved Hide resolved
### Fixed
- Fixed RTD by specifying theme explicitly.
- Setting `model.PARAM1 = model.PARAM2` no longer overrides the name of `PARAM1`
### Removed
1 change: 1 addition & 0 deletions src/pint/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from pint.models.timing_model import DEFAULT_ORDER, TimingModel
from pint.models.troposphere_delay import TroposphereDelay
from pint.models.wave import Wave
from pint.models.wavex import WaveX

# Define a standard basic model
StandardTimingModel = TimingModel(
Expand Down
1 change: 1 addition & 0 deletions src/pint/models/timing_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"spindown",
"phase_jump",
"wave",
"wavex",
]


Expand Down
65 changes: 55 additions & 10 deletions src/pint/models/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@

def __init__(self):
super().__init__()

self.add_param(
MJDParameter(
name="WAVEEPOCH",
description="Reference epoch for wave solution",
time_scale="tdb",
)
)
self.add_param(
floatParameter(
name="WAVE_OM",
Expand All @@ -46,13 +52,6 @@
parameter_type="pair",
)
)
self.add_param(
MJDParameter(
name="WAVEEPOCH",
description="Reference epoch for wave solution",
time_scale="tdb",
)
)
self.phase_funcs_component += [self.wave_phase]

def setup(self):
Expand All @@ -64,14 +63,14 @@
super().validate()
self.setup()
if self.WAVEEPOCH.quantity is None:
if self.PEPOCH.quantity is None:
if self._parent.PEPOCH.quantity is None:
raise MissingParameter(
"Wave",
"WAVEEPOCH",
"WAVEEPOCH or PEPOCH are required if " "WAVE_OM is set.",
)
else:
self.WAVEEPOCH = self.PEPOCH
self.WAVEEPOCH.quantity = self._parent.PEPOCH.quantity

if (not hasattr(self._parent, "F0")) or (self._parent.F0.quantity is None):
raise MissingParameter(
Expand All @@ -95,6 +94,52 @@

return result

def add_wave_component(self, amps, index=None):
"""Add Wave Component

Parameters
----------

index : int
Interger label for Wave components.
amps : tuple of float or astropy.quantity.Quantity
Sine and cosine amplitudes

Returns
-------

index :
Index that has been assigned to new Wave component
"""
#### If index is None, increment the current max Wave index by 1. Increment using WAVE
if index is None:
dct = self.get_prefix_mapping_component("WAVE")
index = np.max(list(dct.keys())) + 1

Check warning on line 117 in src/pint/models/wave.py

View check run for this annotation

Codecov / codecov/patch

src/pint/models/wave.py#L116-L117

Added lines #L116 - L117 were not covered by tests
i = f"{int(index):04d}"
abhisrkckl marked this conversation as resolved.
Show resolved Hide resolved

if int(index) in self.get_prefix_mapping_component("WAVE"):
raise ValueError(

Check warning on line 121 in src/pint/models/wave.py

View check run for this annotation

Codecov / codecov/patch

src/pint/models/wave.py#L121

Added line #L121 was not covered by tests
f"Index '{index}' is already in use in this model. Please choose another"
)

for amp in amps:
if isinstance(amp, u.quantity.Quantity):
amp = amp.to_value(u.s)
self.add_param(
prefixParameter(
name=f"WAVE{index}",
value=amps,
units="s",
description="Wave components",
type_match="pair",
long_double=True,
parameter_type="pair",
)
)
self.setup()
self.validate()
return f"{index}"

def wave_phase(self, toas, delays):
times = 0
wave_names = ["WAVE%d" % ii for ii in range(1, self.num_wave_terms + 1)]
LuluAgazie marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading
Loading