How to use the pypet.parameter.BaseParameter function in pypet

To help you get started, we’ve selected a few pypet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
    @copydoc(BaseParameter.f_empty)
    def f_empty(self):

        if self.v_locked:
            raise pex.ParameterLockedException('Parameter %s is locked!' % self.v_full_name)

        if self.f_has_range():
            self._shrink()

        del self._data
        del self._default
        self._data = None
        self._default = None
        self._explored = False
github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
def f_empty(self):
        """Erases all data in the parameter.

        Does not erase data from disk. So if the parameter has
        been stored with a service to disk and is emptied,
        it can be restored by loading from disk.

        :raises: ParameterLockedException: If the parameter is locked.

        ABSTRACT: Needs to be defined in subclass

        """
        raise NotImplementedError("Should have implemented this.")


class Parameter(BaseParameter):
    """ The standard container that handles access to simulation parameters.

    Parameters are simple container objects for data values. They handle single values as well as
    the so called exploration range. An array containing multiple values which are accessed
    one after the other in individual simulation runs.

    Parameter exploration is usually initiated through the trajectory see
    `:func:~pypet.trajectory.Trajectory.f_explore` and
    `:func:~pypet.trajectory.Trajectory.f_expand`.

    To access the parameter's data value one can call the :func:`~pypet.parameter.Parameter.f_get`
    method.

    Parameters support the concept of locking. Once a value of the parameter has been accessed,
    the parameter cannot be changed anymore unless it is explicitly unlocked using
    :func:`~pypet.parameter.Parameter.f_unlock`.
github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
def __init__(self, full_name, comment=''):
        super(BaseParameter, self).__init__(full_name, comment, is_parameter=True)

        self._locked = False

        # Whether to keep the full range array when pickled or not
        self._full_copy = False
        self._explored = False  # If explored or not
github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
    @copydoc(BaseParameter.f_set)
    def f_set(self, data):

        if self.v_locked:
            raise pex.ParameterLockedException('Parameter `%s` is locked!' % self._full_name)

        if self.f_has_range():
            raise AttributeError(
                'Your Parameter is an explored array can no longer change values!')

        if self.v_stored:
            self._logger.debug('You are changing an already stored parameter. If '
                                 'you not explicitly overwrite the data on disk, this change '
                                 'might be lost and not propagated to disk.')

        val = self._convert_data(data)
github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
    @copydoc(BaseParameter.f_empty)
    def f_empty(self):

        if self.v_locked:
            raise pex.ParameterLockedException('Parameter %s is locked!' % self.v_full_name)

        if self.f_has_range():
            self._shrink()

        del self._data
        del self._default
        self._data = None
        self._default = None
        self._explored = False
github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
    @copydoc(BaseParameter._set_parameter_access)
    def _set_parameter_access(self, idx=0):
        if idx >= len(self) and self.f_has_range():
            raise ValueError('You try to access data item No. %d in the parameter range, '
                             'yet there are only %d potential items.' % (idx, len(self)))
        elif self.f_has_range():
            self._data = self._explored_range[idx]
        else:
            self._logger.warning('You try to change the access to a parameter range of parameter'
                                 ' `%s`. The parameter has no range, your setting has no'
github SmokinCaterpillar / pypet / pypet / parameter.py View on Github external
def __init__(self, full_name, comment=''):
        super(BaseParameter, self).__init__(full_name, comment, is_parameter=True)

        self._locked = False

        # Whether to keep the full range array when pickled or not
        self._full_copy = False
        self._explored = False  # If explored or not