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

WIP: Making add PINT builtin parameter from a string #1167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/pint/fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def ftest(self, parameter, component, remove=False, full_output=False, maxiter=1
).value = parameter[ii].value
# If not, add it to the model
else:
fitter_copy.model.components[component[ii]].add_param(
fitter_copy.model.components[component[ii]].init_param(
parameter[ii], setup=True
)
# validate and setup model
Expand Down
6 changes: 3 additions & 3 deletions src/pint/models/absolute_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ class AbsPhase(PhaseComponent):

def __init__(self):
super(AbsPhase, self).__init__()
self.add_param(
self.init_param(
MJDParameter(
name="TZRMJD", description="Epoch of the zero phase.", time_scale="utc"
)
)
self.add_param(
self.init_param(
strParameter(
name="TZRSITE", description="Observatory of the zero phase measured."
)
)
self.add_param(
self.init_param(
floatParameter(
name="TZRFRQ",
units=u.MHz,
Expand Down
22 changes: 11 additions & 11 deletions src/pint/models/astrometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ class Astrometry(DelayComponent):

def __init__(self):
super().__init__()
self.add_param(
self.init_param(
MJDParameter(
name="POSEPOCH",
description="Reference epoch for position",
time_scale="tdb",
)
)

self.add_param(
self.init_param(
floatParameter(name="PX", units="mas", value=0.0, description="Parallax")
)

Expand Down Expand Up @@ -241,7 +241,7 @@ class AstrometryEquatorial(Astrometry):

def __init__(self):
super().__init__()
self.add_param(
self.init_param(
AngleParameter(
name="RAJ",
units="H:M:S",
Expand All @@ -250,7 +250,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
AngleParameter(
name="DECJ",
units="D:M:S",
Expand All @@ -259,7 +259,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="PMRA",
units="mas/year",
Expand All @@ -268,7 +268,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="PMDEC",
units="mas/year",
Expand Down Expand Up @@ -588,7 +588,7 @@ class AstrometryEcliptic(Astrometry):

def __init__(self):
super().__init__()
self.add_param(
self.init_param(
AngleParameter(
name="ELONG",
units="deg",
Expand All @@ -597,7 +597,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
AngleParameter(
name="ELAT",
units="deg",
Expand All @@ -606,7 +606,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="PMELONG",
units="mas/year",
Expand All @@ -616,7 +616,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="PMELAT",
units="mas/year",
Expand All @@ -626,7 +626,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
strParameter(
name="ECL",
value="IERS2010",
Expand Down
2 changes: 1 addition & 1 deletion src/pint/models/binary_bt.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self):
self.binary_model_name = "BT"
self.binary_model_class = BTmodel

self.add_param(
self.init_param(
floatParameter(
name="GAMMA",
value=0.0,
Expand Down
10 changes: 5 additions & 5 deletions src/pint/models/binary_dd.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self,):
super(BinaryDD, self).__init__()
self.binary_model_name = "DD"
self.binary_model_class = DDmodel
self.add_param(
self.init_param(
floatParameter(
name="A0",
value=0.0,
Expand All @@ -39,7 +39,7 @@ def __init__(self,):
)
)

self.add_param(
self.init_param(
floatParameter(
name="B0",
value=0.0,
Expand All @@ -48,7 +48,7 @@ def __init__(self,):
)
)

self.add_param(
self.init_param(
floatParameter(
name="GAMMA",
value=0.0,
Expand All @@ -57,7 +57,7 @@ def __init__(self,):
)
)

self.add_param(
self.init_param(
floatParameter(
name="DR",
value=0.0,
Expand All @@ -66,7 +66,7 @@ def __init__(self,):
)
)

self.add_param(
self.init_param(
floatParameter(
name="DTH",
value=0.0,
Expand Down
6 changes: 3 additions & 3 deletions src/pint/models/binary_ddk.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ def __init__(self,):
self.binary_model_name = "DDK"
self.binary_model_class = DDKmodel

self.add_param(
self.init_param(
floatParameter(
name="KIN", value=0.0, units="deg", description="Inclination angle"
)
)
self.add_param(
self.init_param(
floatParameter(
name="KOM",
value=0.0,
units="deg",
description="The longitude of the ascending node",
)
)
self.add_param(
self.init_param(
boolParameter(
name="K96",
description="Flag for Kopeikin binary model proper motion"
Expand Down
18 changes: 9 additions & 9 deletions src/pint/models/binary_ell1.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def __init__(self):
self.binary_model_name = "ELL1"
self.binary_model_class = ELL1model

self.add_param(
self.init_param(
MJDParameter(
name="TASC", description="Epoch of ascending node", time_scale="tdb"
)
)

self.add_param(
self.init_param(
floatParameter(
name="EPS1",
units="",
Expand All @@ -60,7 +60,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="EPS2",
units="",
Expand All @@ -69,7 +69,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="EPS1DOT",
units="1e-12/s",
Expand All @@ -78,7 +78,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="EPS2DOT",
units="1e-12/s",
Expand Down Expand Up @@ -205,7 +205,7 @@ def __init__(self):
self.binary_model_name = "ELL1H"
self.binary_model_class = ELL1Hmodel

self.add_param(
self.init_param(
floatParameter(
name="H3",
units="second",
Expand All @@ -214,7 +214,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="H4",
units="second",
Expand All @@ -223,7 +223,7 @@ def __init__(self):
)
)

self.add_param(
self.init_param(
floatParameter(
name="STIGMA",
units="",
Expand All @@ -232,7 +232,7 @@ def __init__(self):
aliases=["VARSIGMA"],
)
)
self.add_param(
self.init_param(
intParameter(
name="NHARMS",
units="",
Expand Down
16 changes: 8 additions & 8 deletions src/pint/models/dispersion_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class DispersionDM(Dispersion):

def __init__(self):
super().__init__()
self.add_param(
self.init_param(
floatParameter(
name="DM",
units="pc cm^-3",
Expand All @@ -150,7 +150,7 @@ def __init__(self):
long_double=True,
)
)
self.add_param(
self.init_param(
prefixParameter(
name="DM1",
units="pc cm^-3/yr^1",
Expand All @@ -161,7 +161,7 @@ def __init__(self):
long_double=True,
)
)
self.add_param(
self.init_param(
MJDParameter(
name="DMEPOCH", description="Epoch of DM measurement", time_scale="tdb"
)
Expand Down Expand Up @@ -323,7 +323,7 @@ class DispersionDMX(Dispersion):
def __init__(self):
super().__init__()
# DMX is for info output right now
self.add_param(
self.init_param(
floatParameter(
name="DMX",
units="pc cm^-3",
Expand Down Expand Up @@ -381,7 +381,7 @@ def add_DMX_range(self, mjd_start, mjd_end, index=None, dmx=0, frozen=True):
% index
)

self.add_param(
self.init_param(
prefixParameter(
name="DMX_" + i,
units="pc cm^-3",
Expand All @@ -391,7 +391,7 @@ def add_DMX_range(self, mjd_start, mjd_end, index=None, dmx=0, frozen=True):
frozen=frozen,
)
)
self.add_param(
self.init_param(
prefixParameter(
name="DMXR1_" + i,
units="MJD",
Expand All @@ -401,7 +401,7 @@ def add_DMX_range(self, mjd_start, mjd_end, index=None, dmx=0, frozen=True):
value=mjd_start,
)
)
self.add_param(
self.init_param(
prefixParameter(
name="DMXR2_" + i,
units="MJD",
Expand Down Expand Up @@ -588,7 +588,7 @@ def __init__(self):
self.dm_value_funcs += [self.jump_dm]
# Dispersion jump only model the dm values.

self.add_param(
self.init_param(
maskParameter(
name="DMJUMP",
units="pc cm^-3",
Expand Down
2 changes: 1 addition & 1 deletion src/pint/models/frequency_dependent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _description_template(cls, x):

def __init__(self):
super().__init__()
self.add_param(
self.init_param(
prefixParameter(
name="FD1",
units="second",
Expand Down
Loading