Ejemplo n.º 1
0
        private void PlotDynamicPlotFile(string fileName, string csv, List <string> headers)
        {
            var pointIndexes   = Enumerable.Range(1, headers.Count).ToList();
            var times          = CsvUtils.GetContentColumnsByIndex <string>(csv, DynamicPlotTime)[DynamicPlotTime];
            var columnsByIndex = CsvUtils.GetContentColumnsByIndex <float>(csv, pointIndexes.ToArray());
            var pointColumns   = new List <DynamicPlotHelper.DynamicPlotData.PointColumns>();
            var nPoints        = (headers.Count - 1) / 3;

            for (int i = 0; i < nPoints; i++)
            {
                int offset = i * 3;
                pointColumns.Add(
                    new DynamicPlotHelper.DynamicPlotData.PointColumns(
                        columnsByIndex[offset + DynamicPlotX],
                        columnsByIndex[offset + DynamicPlotY],
                        columnsByIndex[offset + DynamicPlotZ]
                        )
                    );
            }

            var data = new DynamicPlotHelper.DynamicPlotData(
                fileName,
                pointColumns,
                times,
                headers[DynamicPlotX],
                headers[DynamicPlotY],
                headers[DynamicPlotZ]
                );

            var plotter       = DynamicPlotHelper.GetDynamicPlotter(data);
            var plotContainer = Instantiate(plotter);

            SetSpawn(plotContainer.PointHolder);
        }
Ejemplo n.º 2
0
        public DynamicPlotter GetDynamicDronePlotter()
        {
            var columnsByName = CsvUtils.GetColumnsByHeader <float>(CsvResourcePath, XHeader, YHeader, ZHeader);
            var times         = CsvUtils.GetColumnsByHeader <string>(CsvResourcePath, TimeHeader)[TimeHeader];

            var pointColumns =
                new List <DynamicPlotHelper.DynamicPlotData.PointColumns>()
            {
                new DynamicPlotHelper.DynamicPlotData.PointColumns(
                    columnsByName[XHeader],
                    columnsByName[YHeader],
                    columnsByName[ZHeader]
                    )
            };

            var data = new DynamicPlotHelper.DynamicPlotData(
                Title,
                pointColumns,
                times,
                XHeader,
                YHeader,
                ZHeader
                );

            data.PointObject = (GameObject)Resources.Load(DroneObjectPath);

            return(DynamicPlotHelper.GetDynamicPlotter(data));
        }
Ejemplo n.º 3
0
        public DynamicPlotter GetElectronScatterPlotter()
        {
            var columnsByName = CsvUtils.GetColumnsByIndex <float>(CsvResourcePath, XIndex, YIndex, ZIndex);
            var times         = CsvUtils.GetColumnsByIndex <string>(CsvResourcePath, XIndex)[XIndex];

            var pointColumns =
                new List <DynamicPlotHelper.DynamicPlotData.PointColumns>()
            {
                new DynamicPlotHelper.DynamicPlotData.PointColumns(
                    columnsByName[XIndex],
                    columnsByName[YIndex],
                    columnsByName[ZIndex]
                    )
            };

            var data = new DynamicPlotHelper.DynamicPlotData(
                Title,
                pointColumns,
                times,
                XName,
                YName,
                ZName
                );

            return(DynamicPlotHelper.GetDynamicPlotter(data));
        }
Ejemplo n.º 4
0
        public DynamicPlotter GetSineWavePlotter()
        {
            var columnsByIndex = CsvUtils.GetColumnsByIndex <float>(CsvResourcePath, Enumerable.Range(0, NPoints * 3).ToArray());
            var capacity       = columnsByIndex[0].Count;
            var pointColumns   = new List <DynamicPlotHelper.DynamicPlotData.PointColumns>();

            for (int i = 0; i < NPoints; i++)
            {
                int offset = i * 3;
                pointColumns.Add(
                    new DynamicPlotHelper.DynamicPlotData.PointColumns(
                        columnsByIndex[offset + XOffset],
                        columnsByIndex[offset + YOffset],
                        columnsByIndex[offset + ZOffset]
                        ));
            }

            var times = Enumerable.Range(0, capacity).Select(i => i.ToString()).ToList();

            var data = new DynamicPlotHelper.DynamicPlotData(
                Title,
                pointColumns,
                times,
                XLabel,
                YLabel,
                ZLabel
                );

            return(DynamicPlotHelper.GetDynamicPlotter(data));
        }