params.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:thejoker 作者: adrn 项目源码 文件源码
def __init__(self, P_min, P_max, trend_cls=None,
                 jitter=None, jitter_unit=None, anomaly_tol=1E-10):

        # the names of the default parameters
        self.default_params = ['P', 'phi0', 'ecc', 'omega', 'jitter', 'K']

        self.P_min = P_min
        self.P_max = P_max
        self.anomaly_tol = float(anomaly_tol)

        # TODO: validate the specified long-term velocity trends
        # if trend is not None and not isinstance(trend, PolynomialVelocityTrend):
        #     raise TypeError("Velocity trends must be PolynomialVelocityTrend "
        #                     "instances, not '{0}'".format(type(trend)))

        if trend_cls is None: # by default, assume constant
            trend_cls = VelocityTrend1

        self.trend_cls = trend_cls
        self._n_trend = len(self.trend_cls.parameters)

        # validate the input jitter specification
        if jitter is None:
            jitter = 0 * u.km/u.s

        if isiterable(jitter):
            if len(jitter) != 2:
                raise ValueError("If specifying parameters for the jitter prior, you "
                                 "must pass in a length-2 container containing the "
                                 "mean and standard deviation of the Gaussian over "
                                 "log(jitter^2)")

            if jitter_unit is None or not isinstance(jitter_unit, u.UnitBase):
                raise TypeError("If specifying parameters for the jitter prior, you "
                                "must also specify the units of the jitter for "
                                "evaluating the prior as an astropy.units.UnitBase "
                                "instance.")

            self._fixed_jitter = False
            self._jitter_unit = jitter_unit
            self.jitter = jitter

        else:
            self._fixed_jitter = True
            self.jitter = jitter
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号