Old visual observation is discarded, because it is outdated frame.
    Text observations are merged, because they are messages sent from the rewarder.
977754
def _merge_observation(accum_observation, observation):
    
    if observation is None:
        # We're currently masking. So accum_observation probably
        # belongs to the previous episode. We may lose a "text"
        # observation from the previous episode, but that's ok.
        return None
    elif accum_observation is None:
        # Nothing to merge together
        return observation

    accum_observation['vision'] = observation.get('vision')
    accum_observation['text'] = accum_observation.get('text', []) + observation.get('text', [])
    return accum_observation
250099
def observe(self, C, obs_mesh_new, obs_vals_new, mean_under=None):
        

        self.C = C
        self.obs_mesh = C.obs_mesh
        self.obs_len = C.obs_len

        self.Uo = C.Uo

        # Evaluate the underlying mean function on the new observation mesh.
        if mean_under is None:
            mean_under_new = C._mean_under_new(self, obs_mesh_new)
        else:
            mean_under_new = mean_under

        # If self hasn't been observed yet:
        if not self.observed:

            self.dev = (obs_vals_new - mean_under_new)

            self.reg_mat = C._unobs_reg(self)

        # If self has been observed already:
        elif len(obs_vals_new) > 0:

            # Rank of old observations.
            m_old = len(self.dev)

            # Deviation of new observation from mean without regard to old
            # observations.
            dev_new = (obs_vals_new - mean_under_new)

            # Again, basis covariances get special treatment.
            self.reg_mat = C._obs_reg(self, dev_new, m_old)

            # Stack deviations of old and new observations from unobserved
            # mean.
            self.dev = hstack((self.dev, dev_new))
        self.observed = True
1207220
def augment_observation(
    observation, reward, cum_reward, frame_index, bar_color=None,
    header_height=27
):
  """"""
  img = PIL_Image().new(
      "RGB", (observation.shape[1], header_height,)
  )
  draw = PIL_ImageDraw().Draw(img)
  draw.text(
      (1, 0), "c:{:3}, r:{:3}".format(int(cum_reward), int(reward)),
      fill=(255, 0, 0)
  )
  draw.text(
      (1, 15), "f:{:3}".format(int(frame_index)),
      fill=(255, 0, 0)
  )
  header = np.copy(np.asarray(img))
  del img
  if bar_color is not None:
    header[0, :, :] = bar_color
  return np.concatenate([header, observation], axis=0)
399735
private ValFrame cleanCategorical(Frame oldfr, Frame newfr) {
    final boolean categoricalOK = categoricalOK();
    final Vec oldvecs[] = oldfr.vecs();
    final Vec newvecs[] = newfr.vecs();
    Futures fs = new Futures();
    for (int i = 0; i < oldvecs.length; i++)
      if ((oldvecs[i].isCategorical() && !categoricalOK)) { // categorical are OK (op is EQ/NE)
        Vec cv = newvecs[i].makeCon(Double.NaN);
        newfr.replace(i, cv).remove(fs);
      }
    fs.blockForPending();
    return new ValFrame(newfr);
  }
669787
function (oldData) {
    var data = this.data;
    if (!this.shader || data.shader !== oldData.shader) {
      this.updateShader(data.shader);
    }
    this.shader.update(this.data);
    this.updateMaterial(oldData);
  }
1234407
public void checkOutdatedStatus() {
        boolean newStatus = false;
        for (Translation translation : translations.values()) {
            if (translation.isOutdated()) {
                newStatus = true;
                break;
            }
        }
        outdated = newStatus;
    }
1370112
def observe(self, ob):
        
        option = Option()
        option.number = defines.OptionRegistry.OBSERVE.number
        option.value = ob
        self.del_option_by_number(defines.OptionRegistry.OBSERVE.number)
        self.add_option(option)
1296951
public void pruneObservationsBehindCamera() {
		Point3D_F64 X = new Point3D_F64();

		for (int viewIndex = 0; viewIndex < observations.views.length; viewIndex++) {
			SceneObservations.View v = observations.views[viewIndex];
			SceneStructureMetric.View view = structure.views[viewIndex];

			for (int pointIndex = 0; pointIndex < v.point.size; pointIndex++) {
				SceneStructureMetric.Point f = structure.points[v.getPointId(pointIndex)];

				// Get feature location in world
				f.get(X);

				if( !f.views.contains(viewIndex))
					throw new RuntimeException("BUG!");

				// World to View
				view.worldToView.transform(X, X);

				// Is the feature behind this view and can't be seen?
				if( X.z <= 0 ) {
					v.set(pointIndex, Float.NaN, Float.NaN);
				}
			}
		}

		removeMarkedObservations();
	}
883822
function syncToTmp(tmpfd, msgnumber, cb) {

        // Pass the last msg
        if (msgnumber > messages.offsets.length) cb();

        // Skip deleted messages
        else if (messages.offsets[msgnumber] === undefined) syncToTmp(tmpfd, msgnumber + 1, cb);
        else {

            var buffer = new Buffer(omessages.sizes[msgnumber]);

            fs.read(fd, buffer, 0, omessages.sizes[msgnumber], messages.offsets[msgnumber], function(err, bytesRead, buffer) {

                fs.write(tmpfd, buffer, 0, bytesRead, null, function(err, written, buffer) {

                    syncToTmp(tmpfd, msgnumber + 1, cb);

                });
            });
        }
    }
945581
def updateAltHistory(self):
        ''''''
        self.altHist.append(self.relAlt)
        self.timeHist.append(self.relAltTime)
        
        # Delete entries older than x seconds
        histLim = 10
        currentTime = time.time()
        point = 0
        for i in range(0,len(self.timeHist)):
            if (self.timeHist[i] > (currentTime - 10.0)):
                break
        # Remove old entries
        self.altHist = self.altHist[i:]
        self.timeHist = self.timeHist[i:]
        
        # Transform Data
        x = []
        y = []
        tmin = min(self.timeHist)
        tmax = max(self.timeHist)
        x1 = self.leftPos+(self.vertSize/10.0)
        y1 = -0.25
        altMin = 0
        altMax = max(self.altHist)
        # Keep alt max for whole mission
        if altMax > self.altMax:
            self.altMax = altMax
        else:
            altMax = self.altMax
        if tmax != tmin:
            mx = 0.5/(tmax-tmin)
        else:
            mx = 0.0
        if altMax != altMin:
            my = 0.5/(altMax-altMin)
        else:
            my = 0.0
        for t in self.timeHist:
            x.append(mx*(t-tmin)+x1)
        for alt in self.altHist:
            val = my*(alt-altMin)+y1
            # Crop extreme noise
            if val < -0.25:
                val = -0.25
            elif val > 0.25:
                val = 0.25
            y.append(val)
        # Display Plot
        self.altHistRect.set_x(self.leftPos+(self.vertSize/10.0))
        self.altPlot.set_data(x,y)
        self.altMarker.set_data(self.leftPos+(self.vertSize/10.0)+0.5,val)
        self.altText2.set_position((self.leftPos+(4*self.vertSize/10.0)+0.5,val))
        self.altText2.set_size(self.fontSize)
        self.altText2.set_text('%.f m' % self.relAlt)
876161
private void removeMarkedObservations() {
		Point2D_F64 observation = new Point2D_F64();

		for (int viewIndex = 0; viewIndex < observations.views.length; viewIndex++) {
//			System.out.println("ViewIndex="+viewIndex);
			SceneObservations.View v = observations.views[viewIndex];
			for(int indexInView = v.point.size-1; indexInView >= 0; indexInView-- ) {
				int pointID = v.getPointId(indexInView);
				SceneStructureProjective.Point f = structure.points[pointID];
//				System.out.println("   pointIndex="+pointIndex+" pointID="+pointID+" hash="+f.hashCode());
				v.get(indexInView, observation);

				if( !Double.isNaN(v.observations.get(indexInView*2)))
					continue;

				// Tell the feature it is no longer visible in this view
				f.removeView(viewIndex);
				// Remove the observation of this feature from the view
				v.remove(indexInView);
			}
		}
	}
811343
function () {
                var info = getValueAndObserved(getterSetter, context),
                    newObserveSet = info.observed;

                var value = info.value;
                matched = !matched;

                // go through every attribute read by this observe
                can.each(newObserveSet, function (ob) {
                    // if the observe/attribute pair is being observed
                    if (observing[ob.obj._cid + "|" + ob.attr]) {
                        // mark at as observed
                        observing[ob.obj._cid + "|" + ob.attr].matched = matched;
                    } else {
                        // otherwise, set the observe/attribute on oldObserved, marking it as being observed
                        observing[ob.obj._cid + "|" + ob.attr] = {
                            matched: matched,
                            observe: ob
                        };
                        ob.obj.bind(ob.attr, onchanged);
                    }
                });

                // Iterate through oldObserved, looking for observe/attributes
                // that are no longer being bound and unbind them
                for (var name in observing) {
                    var ob = observing[name];
                    if (ob.matched !== matched) {
                        ob.observe.obj.unbind(ob.observe.attr, onchanged);
                        delete observing[name];
                    }
                }
                return value;
            }
734830
def _original_frame(self, x, y):
        
        if self._inverted:
            return self.obs.naxis1 - x, self.obs.naxis2 - y
        return x, y
545111
void updatePARTICIPANTS(
		Set<? extends InteractionParticipant> oldSet,
		Set<? extends InteractionParticipant> newSet)
	{
		if (oldSet != null)
		{
			PARTICIPANTS.removeComposited(oldSet);
			for (InteractionParticipant ip : oldSet)
			{
				setParticipantInverse(ip, true);
			}
		}
		if (newSet != null)
		{
			PARTICIPANTS.addComposited(newSet);
			for (InteractionParticipant ip : newSet)
			{
				setParticipantInverse(ip, false);
			}
		}
	}
992779
public boolean displayMessage (ChatMessage msg, boolean alreadyDisplayed)
    {
        // see if we're full, and if so, clear out a bunch of old stuff
        int adjusted;
        if (size() == MAX_HISTORY) {
            removeRange(0, PRUNE_HISTORY);
            adjusted = PRUNE_HISTORY;

        } else {
            adjusted = 0;
        }

        // add the message to the history
        add(msg);

        // notify observers that something changed
        notify(adjusted);

        return true;
    }
554890
def updateData(self, state_data, action_data, reward_data):
        
#        self.dataLock.acquire()

        self.state_data[:, self.updates] = state_data
        self.action_data[:, self.updates] = action_data
        self.reward_data[0, self.updates] = reward_data
        self.updates += 1
        self._render()
1293648
function mergeNewAndOldMeta(old, updated) {
  const merged = {
    firstPublishTime: old.firstPublishTime || updated.publishTime
  };

  if (!Object.keys(old).length) {
    return updated;
  }

  if (old.history && updated.history) {
    merged.history = old.history.concat(updated.history);
  }

  return Object.assign(old, updated, merged);
}