Update the lattice state by accepting a specific jump

        Args:
            jump (Jump): The jump that has been accepted.

        Returns:
            None.
547976
def update( self, jump ):
        
        atom = jump.initial_site.atom
        dr = jump.dr( self.cell_lengths )
        #print( "atom {} jumped from site {} to site {}".format( atom.number, jump.initial_site.number, jump.final_site.number ) )
        jump.final_site.occupation = atom.number
        jump.final_site.atom = atom
        jump.final_site.is_occupied = True
        jump.initial_site.occupation = 0
        jump.initial_site.atom = None
        jump.initial_site.is_occupied = False
        # TODO: updating atom counters could be contained in an atom.move_to( site ) method
        atom.site = jump.final_site
        atom.number_of_hops += 1
        atom.dr += dr
        atom.summed_dr2 += np.dot( dr, dr )
555465
def set_state(self, updater=None, **kwargs):
        
        if callable(updater):
            state_change = updater(self)
        elif updater is not None:
            state_change = updater
        else:
            state_change = kwargs

        return [callback_result
                for k, v in state_change.items()
                for callback_result in self.set(k, v)]
704649
def update(self, value, timestamp=None):
        

        if timestamp is None:
            timestamp = self.current_time_in_fractional_seconds()
        self.rescale_if_needed()
        priority = self.weight(timestamp - self.start_time) / random.random()
        self.values[priority] = value
        if len(self.values) > self.size:
            self.values.remove_min()
672268
def _update(self, **kwargs):
        
        if 'value' in kwargs and self.protocol_agent_values.get('value') != \
            kwargs.get('value'):
            self.protocol_agent_values.update(value=kwargs['value'])
            return True
        return False
929193
def set_state(self, state):
        
        _field = self.binary_state_name()
        values = {"desired_state": {_field: state}}
        response = self.api_interface.local_set_state(self, values, type_override="binary_switche")
        self._update_state_from_response(response)
901517
def update_instance(self, uid, body):
        
        uri = "%s/%s" % (self.uri, uid)
        response, instance = self.request("PUT", uri, data=body)
        return self.load_instance(instance)
1134094
def update(cls, **kwargs):
        '''
        
        '''
        q = cls._get_instance(**{'id': kwargs['id']})
        if q:
            for k, v in kwargs.items():
                setattr(q, k, v)
            _action_and_commit(q, session.add)
        else:
            cls.get_or_create(**kwargs)
1091884
def update(self, dt=None):
        
        # EMELI passes dt = -1 so we need to handle that here
        dt = dt if (dt is not None and dt > 0) else self.dt
        tspan = [0, dt]
        # Run simulaton with initials set to current state
        res = self.sim.run(tspan=tspan, initials=self.state)
        # Set the state based on the result here
        self.state  = res.species[-1]
        self.time += dt
        if self.time > self.stop_time:
            self.DONE = True
        print((self.time, self.state))
        self.time_course.append((self.time.copy(), self.state.copy()))
1127585
def update(self, *args, **kwargs):
        
        if len(args) > 1:
            raise TypeError("update expected at most 1 arguments, got %d" % len(args))

        for key, value in dict(*args, **kwargs).items():
            self[key] = value
755335
def update(self, state, tnow):
        ''''''
        self.state = state
        self.update_time = tnow
171422
def event(from_states=None, to_state=None):
    
    from_states_tuple = (from_states, ) if isinstance(from_states, State) else tuple(from_states or [])
    if not len(from_states_tuple) >= 1:
        raise ValueError()
    if not all(isinstance(state, State) for state in from_states_tuple):
        raise TypeError()
    if not isinstance(to_state, State):
        raise TypeError()

    def wrapper(wrapped):

        @functools.wraps(wrapped)
        def transition(instance, *a, **kw):
            if instance.current_state not in from_states_tuple:
                raise InvalidStateTransition()
            try:
                result = wrapped(instance, *a, **kw)
            except Exception as error:
                error_handlers = getattr(instance, '___pystatemachine_transition_failure_handlers', [])
                for error_handler in error_handlers:
                    error_handler(instance, wrapped, instance.current_state, to_state, error)
                if not error_handlers:
                    raise error
            else:
                StateInfo.set_current_state(instance, to_state)
                return result

        return transition

    return wrapper
705777
def update(self, *, name=None, position=None, visibility=None):
        

        if name is None and position is None and visibility is None:
            raise ValueError('Provide at least one parameter to update')
        data = {}
        if name:
            data['name'] = name
        if position:
            data['position'] = position
        if visibility:
            data['visibility'] = visibility

        response = self.session.patch(self.build_url(''), data=data)
        if not response:
            return False

        data = response.json()
        self.name = data.get('name', self.name)
        self.position = data.get('position', self.position)
        self.visibility = data.get('visibility', self.visibility)

        return True
297265
def set_state(self, newState, timer=0):
        """"""
        if _debug: SSM._debug("set_state %r (%s) timer=%r", newState, SSM.transactionLabels[newState], timer)

        # make sure we have a correct transition
        if (self.state == COMPLETED) or (self.state == ABORTED):
            e = RuntimeError("invalid state transition from %s to %s" % (SSM.transactionLabels[self.state], SSM.transactionLabels[newState]))
            SSM._exception(e)
            raise e

        # stop any current timer
        self.stop_timer()

        # make the change
        self.state = newState

        # if another timer should be started, start it
        if timer:
            self.start_timer(timer)
542465
def _update(qs):
        
        try:
            with transaction.atomic():
                qs.update(sort_order=models.F('sort_order') + 1)
        except IntegrityError:
            for obj in qs.order_by('-sort_order'):
                qs.filter(pk=obj.pk).update(sort_order=models.F('sort_order') + 1)
635059
def _update_state(self, change):
        
        self._block_updates = True
        try:
            self.position = self.axis.Location()
            self.direction = self.axis.Direction()
        finally:
            self._block_updates = False
501716
def propose(self):
        

        arrayjump = np.dot(
            self.proposal_sd,
            np.random.normal(
                size=self.proposal_sd.shape[
                    0]))
        if self.verbose > 2:
            print_('Jump :', arrayjump)

        # Update each stochastic individually.
        for stochastic in self.stochastics:
            jump = arrayjump[self._slices[stochastic]].squeeze()
            if np.iterable(stochastic.value):
                jump = np.reshape(
                    arrayjump[
                        self._slices[
                            stochastic]],
                    np.shape(
                        stochastic.value))
            if self.isdiscrete[stochastic]:
                jump = round_array(jump)
            stochastic.value = stochastic.value + jump
802087
def jump(self, relcode, opposite, label):
        
        jump = self.OPPOSITE_JUMPS[relcode] if opposite else self.CONDITIONAL_JUMPS[relcode]
        self.newline_text("{0}\t{1}".format(jump, label), True)