

def setup_bounds(self):
    "set up Minuit-style internal/external parameter transformation\n        of min/max bounds.\n\n        returns internal value for parameter from self.value (which holds\n        the external, user-expected value).   This internal values should\n        actually be used in a fit....\n\n        As a side-effect, this also defines the self.from_internal method\n        used to re-calculate self.value from the internal value, applying\n        the inverse Minuit-style transformation.  This method should be\n        called prior to passing a Parameter to the user-defined objective\n        function.\n\n        This code borrows heavily from JJ Helmus' leastsqbound.py\n        "
    if ((self.min in (None, (- inf))) and (self.max in (None, inf))):
        self._from_internal = (lambda val: val)
        _val = self._val
    elif (self.max in (None, inf)):
        self._from_internal = (lambda val: ((self.min - 1) + sqrt(((val * val) + 1))))
        _val = sqrt(((((self._val - self.min) + 1) ** 2) - 1))
    elif (self.min in (None, (- inf))):
        self._from_internal = (lambda val: ((self.max + 1) - sqrt(((val * val) + 1))))
        _val = sqrt(((((self.max - self._val) + 1) ** 2) - 1))
    else:
        self._from_internal = (lambda val: (self.min + (((sin(val) + 1) * (self.max - self.min)) / 2)))
        _val = arcsin((((2 * (self._val - self.min)) / (self.max - self.min)) - 1))
    return _val

dataset/ETHPy150Open xraypy/xraylarch/lib/fitting/parameter.py Parameter.setup_bounds/original