Skip to content

Commit

Permalink
Getting closer to fixing test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpitkin committed Feb 6, 2019
1 parent a8f67a0 commit 49a0200
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pint/models/timing_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class TimingModel(object):
A list for register the timing model component type name. For example,
delay components will be register as 'DelayComponent'.
top_level_params : list
A parameter name list for thoes parameters belong to the top timing
model class rather than a specific component.
A parameter name list for those parameters that belong to the top
timing model class rather than a specific component.
Properties
----------
Expand Down Expand Up @@ -95,8 +95,8 @@ def __init__(self, name='', components=[]):
description="Tracking Information"), '')
self.add_param_from_top(strParameter(name="EPHEM",
description="Ephemeris to use"), '')
#self.add_param_from_top(strParameter(name="UNITS",
# description="Units (TDB assumed)"), '')
self.add_param_from_top(strParameter(name="UNITS",
description="Units (TDB assumed)"), '')

self.setup_components(components)

Expand Down Expand Up @@ -1047,6 +1047,10 @@ def is_in_parfile(self,para_dict):
"""
pNames_inpar = list(para_dict.keys())
pNames_inModel = self.params

# remove UNITS as many components contain it
if 'UNITS' in pNames_inModel:
del pNames_inModel[pNames_inModel.index('UNITS')]

# For solar system Shapiro delay component
if hasattr(self,'PLANET_SHAPIRO'):
Expand Down Expand Up @@ -1090,6 +1094,7 @@ def print_par(self,):
result += getattr(self, p).as_parfile_line()
return result


class DelayComponent(Component):
def __init__(self,):
super(DelayComponent, self).__init__()
Expand All @@ -1111,6 +1116,11 @@ def __init__(self,):
self.phase_funcs_component = []
self.phase_derivs_wrt_delay = []

def setup(self):
super(PhaseComponent, self).setup()
if self.UNITS.value not in ['TDB', 'TCB']:
raise MissingParameter("'UNITS' must be 'TDB' or 'TCB'")


class TimingModelError(Exception):
"""Generic base class for timing model errors."""
Expand Down

0 comments on commit 49a0200

Please sign in to comment.