Пример #1
0
    public void ApplyThrust()
    {
        var thrustVector = middleMarker.transform.forward.normalized;
        var acc          = thrustVector * Plotting.Thrust;

        Velocity += acc;

        Plotting = Plotting.Empty;
    }
Пример #2
0
        private void ProcessFile(IOptions options, string rawFilePath, Action <string> statusUpdate = null)
        {
            var outputFilePath = GetOutputFileForDataset(options, rawFilePath);

            if (!options.OverwriteOutput && File.Exists(outputFilePath) && CompoundData.CheckSettings(outputFilePath, options))
            {
                Console.WriteLine("Skipping file \"{0}\"; existing output was created with matching settings", rawFilePath);
                return;
            }

            Console.WriteLine("Processing file \"{0}\"", rawFilePath);
            statusUpdate?.Invoke($"Processing file \"{rawFilePath}\"");

            var instanceCreator = ReaderLoader.GetReaderForFile(rawFilePath);
            var rawReader       = instanceCreator.CreateSpectraReader(rawFilePath);
            var methodReader    = instanceCreator.CreateMethodReader(rawFilePath, options.MethodFilePath);
            var compounds       = methodReader.ReadMethodData(options);
            var results         = rawReader.ReadSpectraData(compounds);

            if (results == null)
            {
                return;
            }
            //Console.WriteLine("File \"{0}\": RawResults: {1}", rawFilePath, results.Count);
            //var combined = rawReader.AggregateResults(results, options.DefaultThreshold, CompoundThresholdsLookup);
            //Console.WriteLine("File \"{0}\": CombinedResults: {1}", rawFilePath, combined.Count);

            CompoundData.WriteCombinedResultsToFile(outputFilePath, results, options);
            Plotting.PlotResults(results, Path.GetFileNameWithoutExtension(rawFilePath), Path.ChangeExtension(outputFilePath, null) + "_summary", options.ImageSaveFormat);
            var pdfPath   = Path.ChangeExtension(outputFilePath, "pdf");
            var pdfWriter = new PdfWriter(Path.GetFileNameWithoutExtension(rawFilePath), rawFilePath, pdfPath);

            pdfWriter.WritePdf(results, options);

            /*//////
             * var imagesDir = Path.ChangeExtension(outputFilePath, null) + "_images";
             * if (!Directory.Exists(imagesDir))
             * {
             *  try
             *  {
             *      Directory.CreateDirectory(imagesDir);
             *  }
             *  catch { }
             * }
             *
             * if (Directory.Exists(imagesDir))
             * {
             *  foreach (var compound in results)
             *  {
             *      // replace invalid characters with underscores
             *      var name = Path.GetInvalidFileNameChars().Aggregate(compound.CompoundName, (current, c) => current.Replace(c.ToString(), "_"));
             *      var namePrefix = (compound.PassesAllThresholds
             *                           ? "P"
             *                           : GetCompoundDataPrefix(compound)) + "_";
             *      var pathBase = Path.Combine(imagesDir, namePrefix + name);
             *      Plotting.PlotCompound(compound, pathBase + ".png", Plotting.ExportFormat.PDF);
             *
             *      foreach (var transition in compound.Transitions)
             *      {
             *          var path = $"{pathBase}_{transition.ProductMz:F2}.png";
             *          Plotting.PlotTransition(transition, path, Plotting.ExportFormat.PDF);
             *      }
             *  }
             * }
             * /**/

            Console.WriteLine("Finished Processing file \"{0}\"", rawFilePath);
            statusUpdate?.Invoke($"Finished Processing file \"{rawFilePath}\"");
        }
        public void RefreshGraphics()
        {
            ArrayList array             = null;
            bool      includeDuplicates = Visualization.IncludeDuplicates == CheckState.Checked ? true : false;

            EnableNDisable();

            switch (PlotType)
            {
            case PlotTypes.Mass:
                array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.Radius:
                array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.OrbitalPeriod:
                array = Exoplanets.PlanetsWithOrbitalPeriods(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.SemiMajorAxis:
                array = Exoplanets.PlanetsWithSemiMajorAxis(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.Eccentricity:
                array = Exoplanets.PlanetsWithEccentricity(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.AngularDistance:
                array = Exoplanets.PlanetsWithAngularDistance(Exoplanets.ExoplanetsArray, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.Inclination:
                array = Exoplanets.PlanetsWithInclination(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.TemperatureCalculated:
                array = Exoplanets.PlanetsWithTemperatureCalculated(Exoplanets.ExoplanetsArray, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.Omega:
                array = Exoplanets.PlanetsWithOmega(Exoplanets.ExoplanetsArray, false, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.VelocitySemiamplitude:
                array = Exoplanets.PlanetsWithVelocitySemiamplitude(Exoplanets.ExoplanetsArray, false, true, includeDuplicates);
                Plotting.VisualizeLinearDiagrams(PlotSurface2D, array, PlotType);
                break;

            case PlotTypes.MassAndRadius:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithRadius(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndRadius);
                    }
                }
                break;

            case PlotTypes.MassAndOrbitalPeriod:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithOrbitalPeriods(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndOrbitalPeriod);
                    }
                }
                break;

            case PlotTypes.MassAndSemiMajorAxis:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithSemiMajorAxis(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndSemiMajorAxis);
                    }
                }
                break;

            case PlotTypes.MassAndEccentricity:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithEccentricity(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndEccentricity);
                    }
                }
                break;

            case PlotTypes.MassAndAngularDistance:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithAngularDistance(array, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndAngularDistance);
                    }
                }
                break;

            case PlotTypes.MassAndOmega:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithOmega(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndOmega);
                    }
                }
                break;

            case PlotTypes.MassAndInclination:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithInclination(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndInclination);
                    }
                }
                break;

            case PlotTypes.MassAndVelocitySemiamplitude:
                if ((array = Exoplanets.PlanetsWithMass(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithVelocitySemiamplitude(array, false, true, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.MassAndVelocitySemiamplitude);
                    }
                }
                break;

            case PlotTypes.RadiusAndMass:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithMass(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndMass);
                    }
                }
                break;

            case PlotTypes.RadiusAndOrbitalPeriod:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithOrbitalPeriods(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndOrbitalPeriod);
                    }
                }
                break;

            case PlotTypes.RadiusAndSemiMajorAxis:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithSemiMajorAxis(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndSemiMajorAxis);
                    }
                }
                break;

            case PlotTypes.RadiusAndEccentricity:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithEccentricity(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndEccentricity);
                    }
                }
                break;

            case PlotTypes.RadiusAndAngularDistance:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithAngularDistance(array, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndAngularDistance);
                    }
                }
                break;

            case PlotTypes.RadiusAndOmega:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithOmega(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndOmega);
                    }
                }
                break;

            case PlotTypes.RadiusAndInclination:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithInclination(array, false, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndInclination);
                    }
                }
                break;

            case PlotTypes.RadiusAndVelocitySemiamplitude:
                if ((array = Exoplanets.PlanetsWithRadius(Exoplanets.ExoplanetsArray, false, true)) != null)
                {
                    if ((array = Exoplanets.PlanetsWithVelocitySemiamplitude(array, false, true, true)) != null)
                    {
                        Plotting.VisualizePointDiagrams(PlotSurface2D, array, PlotTypes.RadiusAndVelocitySemiamplitude);
                    }
                }
                break;

            case PlotTypes.Stars:
                Plotting.VisualizeStars(PlotSurface2D, Exoplanets.ExoplanetsArray);
                break;
            }

            PlotSurface2D.RightMenu = NPlot.Windows.PlotSurface2D.DefaultContextMenu;
        }