//Obligatory step that all data has to go through either if gotten from a batch or // gotten one by one private RilData RegisterData(RilData rilData) { this.geoBounds.RegisterNewBounds(new float[] { rilData.RawX, rilData.RawY }); this.timeBounds.RegisterNewBounds(rilData.T); this.dataBounds.RegisterNewBounds(rilData.NOMBRE_LOG); return(rilData); }
private static List <RilData> PredictFutureData(List <RilData> pastData, SpawnCoeff spawnCoeffs, GrowthCoeff growthCoeffs) { if (spawnCoeffs.Values.Length != growthCoeffs.Values.Length) { throw new Exception("Coefficient arrays are not the same length"); } List <RilData> newData = new List <RilData>(pastData); Random rnd = new Random(); for (int i = 0; i < spawnCoeffs.Values.Length; i++) { int nbOfDataToCreate = (int)Math.Ceiling(spawnCoeffs.Values[i]); float timespanBetweenTwoSpawn = spawnCoeffs.NormalizedTimespanOfSlice / nbOfDataToCreate; float batSize = growthCoeffs.Values[i] / nbOfDataToCreate; float lastT = 1f; // we start the time at the end of the normalized timeline for (int dataToCreateIndex = 0; dataToCreateIndex < nbOfDataToCreate; dataToCreateIndex++) { float futureT = lastT + timespanBetweenTwoSpawn; //noise function for Nb log RilData pastDatatoGetPosFrom = pastData[rnd.Next(0, pastData.Count - 1)]; float[] futurePos = new[] { pastDatatoGetPosFrom.X, pastDatatoGetPosFrom.Y }; futurePos[0] += (rnd.Next(0, 50) - 25); futurePos[1] += (rnd.Next(0, 50) - 25); RilData rilData = new RilData("future", futurePos[0], futurePos[1], futureT) { //TODO : Add Noise here for organic results NOMBRE_LOG = batSize }; newData.Add(rilData); } } //Reassign new T with max being extrapolation float newMaxT = newData.Max(data => data.T); foreach (RilData rilData in pastData) { rilData.SetT(rilData.T / newMaxT); } return(newData); }