Exemplo n.º 1
0
        private void  AddDeploymentToSeries(PicesSipperDeployment deployment,
                                            Color color
                                            )
        {
            PicesGPSDataPointList gpsData = threadConn.InstrumentDataRetrieveGPSInfo(deployment.CruiseName, deployment.StationName, deployment.DeploymentNum, (int)TimeInterval.Value);

            if ((gpsData == null) || cancelRequested)
            {
                return;
            }

            PicesGPSDataPointList fliteredGPSData = gpsData.FilterOutNoise();

            if (fliteredGPSData == null)
            {
                return;
            }

            if (fliteredGPSData.Count > 1)
            {
                DataSeriesToPlot seriesToPlot = new DataSeriesToPlot(deployment, fliteredGPSData);
                seriesToPlot.LocateGPSBounds();
                goalie.StartBlock();
                series.Add(seriesToPlot);
                goalie.EndBlock();
            }
        } /* AddDeploymentToSeries */
Exemplo n.º 2
0
        } /* CancelLoadWait */

        /// <summary> Return to caller list of images that have been loaded so far by the LoadImagesThread. </summary>
        /// <remarks>
        /// Images are loaded by a seprate thread; these images are loaded into <paramref name="loadedImages"/>. Images
        /// accumulate into it until ther are retrived by this method.
        /// </remarks>
        /// <returns> List of images loaded since the last call. </returns>
        public PicesDataBaseImageList  GetImagesAlreadyLoaded()
        {
            blocker.StartBlock();
            PicesDataBaseImageList imagesToReturn = loadedImages;

            loadedImages = new PicesDataBaseImageList();
            blocker.EndBlock();

            return(imagesToReturn);
        }
Exemplo n.º 3
0
        private void  RunLogAddMsg(String msg)
        {
            runLogGoalie.StartBlock();

            if (runLogMsgQueue == null)
            {
                runLogMsgQueue = new Queue <String> ();
            }

            runLogMsgQueue.Enqueue(msg);

            runLogGoalie.EndBlock();
        } /* RunLogAddMsg */
        } /* SaveImagesToDisk2_Load */

        private void  RunLogMsgQueueFlush()
        {
            runLogGoalie.StartBlock();
            if (runLogMsgQueue != null)
            {
                while (runLogMsgQueue.Count > 0)
                {
                    String msg = runLogMsgQueue.Dequeue();
                    RunLogText.AppendText(msg);
                }
            }

            runLogGoalie.EndBlock();
        } /* RunLogMsgQueueFlush */
        } /* CancelLoadWait */

        public String  Status()
        {
            String status = "";

            blocker.StartBlock();

            if (cancelRequested)
            {
                if (loaderThreadRuning)
                {
                    status = "Canceling";
                }
                else
                {
                    status = "Canceled";
                }
            }
            else
            {
                if (loaderThreadRuning)
                {
                    status = (curSipperFileIdx + 1).ToString() + " of " + sipperFilesCount.ToString();
                }
                else
                {
                    status = "Load Done";
                }
            }
            blocker.EndBlock();
            return(status);
        }
Exemplo n.º 6
0
        private void  AddDeploymentToSeries(PicesSipperDeployment deployment)
        {
            float[] counts = CountsByDepth(deployment, classToPlot);
            if ((counts == null) || cancelRequested)
            {
                return;
            }

            float[] depthVolumeProfile = GetDepthVolumeProfile(deployment);
            if (depthVolumeProfile == null)
            {
                return;
            }

            float[] density = new float[counts.Length];

            for (int idx = 0; idx < counts.Length; ++idx)
            {
                float vol = 0;
                if (idx < depthVolumeProfile.Length)
                {
                    vol = depthVolumeProfile[idx];
                }
                if (vol == 0.0f)
                {
                    density[idx] = 0.0f;
                }
                else
                {
                    density[idx] = counts[idx] / vol;
                }
            }

            String legend = deployment.CruiseName + "-" + deployment.StationName;

            if (!String.IsNullOrEmpty(deployment.DeploymentNum))
            {
                legend += ("-" + deployment.DeploymentNum);
            }

            goalie.StartBlock();
            series.Add(new DataSeriesToPlot(deployment, legend, density, counts, depthVolumeProfile));
            goalie.EndBlock();
        } /* AddDeploymentToSeries */
Exemplo n.º 7
0
        private void  AddToSeries(char classKeyToUse)
        {
            if (depthVolumeProfile == null)
            {
                return;
            }

            float[] counts = CountsByDepth(classToPlot, classKeyToUse);
            if ((counts == null) || cancelRequested)
            {
                return;
            }

            float[] density = new float[counts.Length];

            for (int idx = 0; idx < counts.Length; ++idx)
            {
                float vol = 0;
                if (idx < depthVolumeProfile.Length)
                {
                    vol = depthVolumeProfile[idx];
                }
                if (vol == 0.0f)
                {
                    density[idx] = 0.0f;
                }
                else
                {
                    density[idx] = counts[idx] / vol;
                }
            }

            String legend = (classKeyToUse == 'V') ? "Validated" : "Predicted";

            goalie.StartBlock();
            series.Add(new DataSeriesToPlot(classKeyToUse, legend, density, counts));
            goalie.EndBlock();
        } /* AddToSeries */
Exemplo n.º 8
0
        } /* SizeDistributionForAClass */

        /// <summary>
        /// This method will be ran as a separate thread; it is responsible for collecting all the data needed to generate the plot.
        /// </summary>
        private void  BuildPlotData()
        {
            if (buildPlotDataRunning)
            {
                return;
            }

            PicesDataBase.ThreadInit();

            threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            buildPlotDataRunning = true;

            classToPlot = PicesClassList.GetUniqueClass(ClassToPlot.Text, "");

            sbyte ch = (sbyte)statistic;

            downCast = null;
            upCast   = null;

            goalie.StartBlock();

            SizeDistributionForAClass(classToPlot,
                                      IncludeSubClasses.Checked,
                                      ref downCast,
                                      ref upCast
                                      );

            if (cast == "Down")
            {
                bucketsDisplayed = downCast;
            }

            else if (cast == "Up")
            {
                bucketsDisplayed = upCast;
            }

            else
            {
                bucketsDisplayed = new PicesImageSizeDistribution(downCast);
                bucketsDisplayed.AddIn(upCast, runLog);
            }

            integratedDensityDistribution = bucketsDisplayed.IntegratedDensityDistribution();

            threadConn.Close();
            threadConn = null;
            GC.Collect();
            PicesDataBase.ThreadEnd();

            goalie.EndBlock();

            if (cancelRequested)
            {
                statusMsgs.AddMsg("Plotting of data CANCELLED!!!");
            }
            else
            {
                statusMsgs.AddMsg("Building of plot data completed !!!");
            }

            buildPlotDataRunning = false;
            buildPlotDataDone    = true;
        } /* BuildPlotData */
Exemplo n.º 9
0
        } /* ModelsAreAvailable */

        private static void  BlockStart()
        {
            blocker.StartBlock();
        } /* BlockStart */
Exemplo n.º 10
0
        } /* SuperScriptExponent */

        private void  UpdateChartAreas()
        {
            goalie.StartBlock();

            bool plotLogDensity = PlotLogDensity.Checked;

            String t1 = "Abundance by Size";

            switch (statistic)
            {
            case '0': t1 = "Abundance by Size";                       break;

            case '1': t1 = "Abundance by Diameter (ESD)";             break;

            case '2': t1 = "Abundance by Volume (EBv";                break;

            case '3': t1 = "Abundance by Estimated Ellipsoid Volume"; break;
            }

            String t2 = cruise + "-" + station;

            if (!String.IsNullOrEmpty(deployment))
            {
                t2 += ("-" + deployment);
            }
            t2 += ("  " + classToPlot.Name);
            t2 += "  ";
            t2 += (cast + "-Cast" + "  Size-Range(" + sizeStart.ToString() + " - " + sizeEnd.ToString() + ")");

            ProfileChart.Titles.Clear();
            ProfileChart.Titles.Add(new Title(t1, Docking.Top, titleFont, Color.Black));
            ProfileChart.Titles.Add(new Title(t2, Docking.Top, titleFont, Color.Black));
            //ProfileChart.Titles.Add (new Title (t3, Docking.Top, titleFont, Color.Black));

            ProfileChart.Series.Clear();

            ChartArea ca1 = ProfileChart.ChartAreas[0];
            ChartArea ca2 = ProfileChart.ChartAreas[1];

            Series s = new Series("Size Distribution");

            s.ChartArea = "ChartArea1";
            s.ChartType = SeriesChartType.Line;

            Series s2 = new Series("Volume Sampled");

            s2.ChartArea = "ChartArea2";
            s2.ChartType = SeriesChartType.Line;

            float minX = float.MaxValue;
            float minY = float.MaxValue;
            float maxX = float.MinValue;
            float maxY = float.MinValue;

            int numDepthBins = sizeDistribution.NumDepthBins;

            for (uint depthBin = 0; depthBin < numDepthBins; ++depthBin)
            {
                PicesImageSizeDistributionRow row = sizeDistribution.GetDepthBin(depthBin);
                if (row == null)
                {
                    continue;
                }
                float  depth   = row.Depth;
                double density = 0.0;
                if (depthBin < depthProfile.Length)
                {
                    density = (double)depthProfile[depthBin];
                }

                if (plotLogDensity)
                {
                    density = (float)Math.Log10(density + 1.0);
                }

                minX = Math.Min(minX, (float)density);
                maxX = Math.Max(maxX, (float)density);
                minY = Math.Min(minY, depth);
                maxY = Math.Max(maxY, depth);
                DataPoint dp = new DataPoint(density, depth);
                s.Points.Add(dp);

                double vs = 0.0;
                if (depthBin < volumeSampled.Length)
                {
                    vs = volumeSampled[depthBin];
                }
                DataPoint dp2 = new DataPoint(vs, depth);
                s2.Points.Add(dp2);
            }
            s.XAxisType  = AxisType.Primary;
            s.YAxisType  = AxisType.Primary;
            s2.XAxisType = AxisType.Primary;
            s2.YAxisType = AxisType.Primary;
            s2.Color     = Color.Black;

            if (plotLogDensity)
            {
                ca1.AxisX.Title = SubInSuperScriptExponent("Log 10  Abundance");
            }
            else
            {
                ca1.AxisX.Title = SubInSuperScriptExponent("Abundance");
            }

            ca1.AxisY.Title             = SubInSuperScriptExponent("Depth (Meters)");
            ca1.AxisY.LabelStyle.Format = "##,##0";

            ca1.AxisX.IsLogarithmic = false;
            ca1.AxisX.Minimum       = 0.0;
            //ca1.AxisX.Maximum           = maxX;
            ca1.AxisX.LabelStyle.Angle = 90;
            ca1.AxisX.LabelStyle.Font  = axisLabelFont;
            ca1.AxisX.TitleFont        = axisLabelFont;

            ca1.AxisY.Minimum         = 0.0;
            ca1.AxisY.IsLogarithmic   = false;
            ca1.AxisY.LabelStyle.Font = axisLabelFont;
            ca1.AxisY.TitleFont       = axisLabelFont;
            if (plotLogDensity)
            {
                ca1.AxisX.LabelStyle.Format = "##,##0.0";
            }
            else
            {
                ca1.AxisX.LabelStyle.Format = "##,##0";
            }

            ca2.AxisX.Title             = SubInSuperScriptExponent("Volume Sampled (mm-3)");
            ca2.AxisX.Minimum           = 0.0;
            ca2.AxisX.IsLogarithmic     = false;
            ca2.AxisX.LabelStyle.Font   = axisLabelFont;
            ca2.AxisX.TitleFont         = axisLabelFont;
            ca2.AxisX.LabelStyle.Format = "##0.00";
            ca2.AxisX.LabelStyle.Angle  = 90;

            s.BorderWidth = 2;
            ProfileChart.Series.Add(s);
            ProfileChart.Series.Add(s2);

            try
            {
                ProfileChart.ChartAreas[0].RecalculateAxesScale();
            }
            catch (Exception e)
            {
                runLog.Writeln(e.ToString());
            }

            goalie.EndBlock();
        } /* UpdateChartAreas */
 private void  AddMsgToDialogMsgQueue(String s)
 {
     dialogMsgGoalie.StartBlock();
     dialogMsgQueue.Add(s);
     dialogMsgGoalie.EndBlock();
 } /* AddMsgToDialogMsgQueue */