Example #1
0
 internal void SetIsTracked(bool isMeasured, NotMeasuredReasons reason)
 {
     foreach (ITrackedObject obj in m_ObjectGroup)
     {
         TrackedObjectLight trackedObject = (TrackedObjectLight)obj;
         trackedObject.SetIsTracked(isMeasured, reason);
     }
 }
Example #2
0
        protected static void DecodeByteFlags(
            byte flags,
            out NotMeasuredReasons firstFlags,
            out NotMeasuredReasons secondFlags,
            out NotMeasuredReasons thirdFlags)
        {
            int firstLevel  = (int)flags & 0x7;
            int secondLevel = ((int)flags >> 3) & 0x7;
            int thirdLevel  = ((int)flags >> 6) & 0x3;

            firstFlags  = (NotMeasuredReasons)firstLevel;
            secondFlags = (NotMeasuredReasons)(secondLevel << 8);
            thirdFlags  = (NotMeasuredReasons)((thirdLevel != 0 ? thirdLevel + 1 : thirdLevel) /* We don't save NoPixelsToMeasure, this is why we add 1 */ << 16);
        }
Example #3
0
        public void SetIsLocated(bool isLocated, NotMeasuredReasons reason)
        {
            IsLocated = isLocated;

            // Overwrite only the same level reason and keep the other level so we can have 2 reasons
            if (reason <= NotMeasuredReasons.LAST_FIRST_LEVEL_REASON)
            {
                NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0xFF00) | reason;
            }
            else
            {
                NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0xFF00FF) | reason;
            }
        }
Example #4
0
 public virtual void SetIsTracked(bool isMeasured, NotMeasuredReasons reason)
 {
     IsLocated = isMeasured;
     if (isMeasured)
     {
         NotMeasuredReasons = NotMeasuredReasons.TrackedSuccessfully;
     }
     else
     {
         // Remove the Tracked Successfully flag if set
         NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & ~(int)NotMeasuredReasons.TrackedSuccessfully);
         NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0x00FFFF) | reason;
     }
 }
Example #5
0
        private static string TranslateFlags(NotMeasuredReasons firstFlags, NotMeasuredReasons secondFlags, NotMeasuredReasons thirdFlags)
        {
            StringBuilder output = new StringBuilder();

            output.AppendLine(GetNotMeasuredReasonsDisplayValue(firstFlags));

            if (secondFlags != 0)
            {
                output.AppendLine(GetNotMeasuredReasonsDisplayValue(secondFlags));
            }

            if (thirdFlags != 0)
            {
                output.AppendLine(GetNotMeasuredReasonsDisplayValue(thirdFlags));
            }

            return(output.ToString());
        }
Example #6
0
        public virtual void SetIsTracked(bool isMeasured, NotMeasuredReasons reason, IImagePixel estimatedCenter, double?psfCertainty)
        {
            IsLocated = isMeasured;

            // Remove the Tracked Successfully flag if set
            NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & ~(int)NotMeasuredReasons.TrackedSuccessfully);

            NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0x00FFFF) | reason;
            if (estimatedCenter != null)
            {
                Center = estimatedCenter;
                LastKnownGoodPosition = estimatedCenter;
            }

            if (psfCertainty != null)
            {
                LastKnownGoodPsfCertainty = psfCertainty.Value;
            }
        }
Example #7
0
        public virtual void SetIsTracked(bool isMeasured, NotMeasuredReasons reason, IImagePixel estimatedCenter, double? psfCertainty)
        {
            IsLocated = isMeasured;

            // Remove the Tracked Successfully flag if set
            NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & ~(int)NotMeasuredReasons.TrackedSuccessfully);

            NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0x00FFFF) | reason;
            if (estimatedCenter != null)
            {
                Center = estimatedCenter;
                LastKnownGoodPosition = estimatedCenter;
            }

            if (psfCertainty != null)
                LastKnownGoodPsfCertainty = psfCertainty.Value;
        }
Example #8
0
 public virtual void SetIsMeasured(bool isMeasured, NotMeasuredReasons reason)
 {
     IsLocated = isMeasured;
     NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0x00FFFF) | reason;
 }
Example #9
0
        public void SetIsLocated(bool isLocated, NotMeasuredReasons reason)
        {
            IsLocated = isLocated;

            // Overwrite only the same level reason and keep the other level so we can have 2 reasons
            if (reason <=  NotMeasuredReasons.LAST_FIRST_LEVEL_REASON)
                NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0xFF00) | reason;
            else
                NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0xFF00FF) | reason;
        }
Example #10
0
        private LCMeasurement ProcessSingleUnit(
            LCMeasurement reading,
            bool useLowPass,
            bool useLowPassDiff,
            int newFitMatrixSize,
            float newSignalAperture,
            bool fixedAperture,
            MeasurementsHelper measurer,
            IImagePixel[] groupCenters,
            float[] aperturesInGroup)
        {
            reading.ReProcessingPsfFitMatrixSize = newFitMatrixSize;

            TrackedObjectConfig objConfig = Footer.TrackedObjects[reading.TargetNo];
            ImagePixel          center    = new ImagePixel(reading.X0, reading.Y0);

            int areaSize = groupCenters != null && groupCenters.Length > 1 ? 35 : 17;

            if (Context.Filter != LightCurveContext.FilterType.NoFilter)
            {
                areaSize += 2;
            }

            uint[,] data = BitmapFilter.CutArrayEdges(reading.PixelData, (35 - areaSize) / 2);

            var filter = TangraConfig.PreProcessingFilter.NoFilter;

            if (useLowPassDiff)
            {
                filter = TangraConfig.PreProcessingFilter.LowPassDifferenceFilter;
            }
            else if (useLowPass)
            {
                filter = TangraConfig.PreProcessingFilter.LowPassFilter;
            }

            NotMeasuredReasons rv = ReduceLightCurveOperation.MeasureObject(
                center,
                data,
                reading.PixelData,
                Context.BitPix,
                measurer,
                filter,
                Context.SignalMethod,
                Context.PsfQuadratureMethod,
                Context.PsfFittingMethod,
                newSignalAperture,
                objConfig.RefinedFWHM,
                Footer.RefinedAverageFWHM,
                reading,
                groupCenters,
                aperturesInGroup,
                Footer.ReductionContext.FullDisappearance);

            reading.SetIsMeasured(rv);
            reading.TotalReading    = (uint)measurer.TotalReading;
            reading.TotalBackground = (uint)measurer.TotalBackground;
            reading.ApertureX       = measurer.XCenter;
            reading.ApertureY       = measurer.YCenter;
            reading.ApertureSize    = measurer.Aperture;

            return(reading);
        }
Example #11
0
 public void SetIsTracked(bool isMeasured, NotMeasuredReasons reason, IImagePixel estimatedCenter, double? certainty)
 {
     Center = estimatedCenter;
     IsLocated = isMeasured;
 }
Example #12
0
        protected static string GetNotMeasuredReasonsDisplayValue(NotMeasuredReasons reason)
        {
            switch (reason)
            {
                case NotMeasuredReasons.UnknownReason:
                    return null; //"Tracking has failed for unknown reason";

                case NotMeasuredReasons.TrackedSuccessfully:
                    return null;

                case NotMeasuredReasons.FixedObject:
                    return "W:Tracking:Object with fixed manually positioned aperture";

                case NotMeasuredReasons.GuidingStarBrightnessFluctoationTooHigh:
                    return "W:Tracking:Tracking was unsuccessful because the brightness fluctoation was out of the expected range";

                case NotMeasuredReasons.PSFFittingFailed:
                    return "W:Tracking:Tracking was unsuccessful because a PSF could not be fitted";

                case NotMeasuredReasons.FoundObjectNotWithInExpectedPositionTolerance:
                    return "W:Tracking:Tracking was unsuccessful because the center of the PSF fit was too far from the expected location";

                case NotMeasuredReasons.FullyDisappearingStarMarkedTrackedWithoutBeingFound:
                    return "I:Tracking:A fully disappearing object was marked tracked without being detected (assuming it has disappeared)";

                case NotMeasuredReasons.FitSuspectAsNoGuidingStarsAreLocated:
                    return "W:Tracking:No guiding stars have been reliably located, all objects are marked as suspect";

                case NotMeasuredReasons.ObjectExpectedPositionIsOffScreen:
                    return "W:Tracking:The expected object position is outside the FOV";

                case NotMeasuredReasons.TrackedSuccessfullyAfterDistanceCheck:
                    return "I:Recovering:The object was recovered after a distance alignment";

                case NotMeasuredReasons.TrackedSuccessfullyAfterWiderAreaSearch:
                    return "I:Recovering:The object was recovered after searching in a wider area";

                case NotMeasuredReasons.TrackedSuccessfullyAfterStarRecognition:
                    return "I:Recovering:The object was recovered after using pattern recognition";

                case NotMeasuredReasons.FailedToLocateAfterDistanceCheck:
                    return "W:Recovering:Failed to recover the object after a distance alignment";

                case NotMeasuredReasons.FailedToLocateAfterWiderAreaSearch:
                    return "W:Recovering:Failed to recover the object after searching in a wider area";

                case NotMeasuredReasons.FailedToLocateAfterStarRecognition:
                    return "W:Recovering:Failed to recover the object after using pattern recognition";

                case NotMeasuredReasons.NoPixelsToMeasure:
                    return "W:Measuring:Aperture contains no pixels";

                case NotMeasuredReasons.MeasurementPSFFittingFailed:
                    return "W:Measuring:The PSF fitting failed";

                case NotMeasuredReasons.DistanceToleranceTooHighForNonFullDisappearingOccultedStar:
                    return "W:Measuring:The object apeared too far from the expected position";

                case NotMeasuredReasons.FWHMOutOfRange:
                    return "W:Measuring:The FWHM of the PSF fit was out of the expected range";

                case NotMeasuredReasons.ObjectCertaintyTooSmall:
                    return "W:Measuring:The certainty of the located object is too small";

                case NotMeasuredReasons.ObjectTooElongated:
                    return "W:Measuring:The object was rejected as being too elongated";
            }

            return null;
        }
Example #13
0
 internal void SetIsTracked(bool isMeasured, NotMeasuredReasons reason)
 {
     foreach (ITrackedObject obj in m_ObjectGroup)
     {
         TrackedObjectLight trackedObject = (TrackedObjectLight)obj;
         trackedObject.SetIsTracked(isMeasured, reason);
     }
 }
Example #14
0
 public virtual void SetIsMeasured(bool isMeasured, NotMeasuredReasons reason)
 {
     IsLocated          = isMeasured;
     NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & 0x00FFFF) | reason;
 }
Example #15
0
        protected static string GetNotMeasuredReasonsDisplayValue(NotMeasuredReasons reason)
        {
            switch (reason)
            {
            case NotMeasuredReasons.UnknownReason:
                return(null);                        //"Tracking has failed for unknown reason";

            case NotMeasuredReasons.TrackedSuccessfully:
                return(null);

            case NotMeasuredReasons.FixedObject:
                return("W:Tracking:Object with fixed manually positioned aperture");

            case NotMeasuredReasons.GuidingStarBrightnessFluctoationTooHigh:
                return("W:Tracking:Tracking was unsuccessful because the brightness fluctoation was out of the expected range");

            case NotMeasuredReasons.PSFFittingFailed:
                return("W:Tracking:Tracking was unsuccessful because a PSF could not be fitted");

            case NotMeasuredReasons.FoundObjectNotWithInExpectedPositionTolerance:
                return("W:Tracking:Tracking was unsuccessful because the center of the PSF fit was too far from the expected location");

            case NotMeasuredReasons.FullyDisappearingStarMarkedTrackedWithoutBeingFound:
                return("I:Tracking:A fully disappearing object was marked tracked without being detected (assuming it has disappeared)");

            case NotMeasuredReasons.FitSuspectAsNoGuidingStarsAreLocated:
                return("W:Tracking:No guiding stars have been reliably located, all objects are marked as suspect");

            case NotMeasuredReasons.ObjectExpectedPositionIsOffScreen:
                return("W:Tracking:The expected object position is outside the FOV");

            case NotMeasuredReasons.TrackedSuccessfullyAfterDistanceCheck:
                return("I:Recovering:The object was recovered after a distance alignment");

            case NotMeasuredReasons.TrackedSuccessfullyAfterWiderAreaSearch:
                return("I:Recovering:The object was recovered after searching in a wider area");

            case NotMeasuredReasons.TrackedSuccessfullyAfterStarRecognition:
                return("I:Recovering:The object was recovered after using pattern recognition");

            case NotMeasuredReasons.FailedToLocateAfterDistanceCheck:
                return("W:Recovering:Failed to recover the object after a distance alignment");

            case NotMeasuredReasons.FailedToLocateAfterWiderAreaSearch:
                return("W:Recovering:Failed to recover the object after searching in a wider area");

            case NotMeasuredReasons.FailedToLocateAfterStarRecognition:
                return("W:Recovering:Failed to recover the object after using pattern recognition");

            case NotMeasuredReasons.NoPixelsToMeasure:
                return("W:Measuring:Aperture contains no pixels");

            case NotMeasuredReasons.MeasurementPSFFittingFailed:
                return("W:Measuring:The PSF fitting failed");

            case NotMeasuredReasons.DistanceToleranceTooHighForNonFullDisappearingOccultedStar:
                return("W:Measuring:The object apeared too far from the expected position");

            case NotMeasuredReasons.FWHMOutOfRange:
                return("W:Measuring:The FWHM of the PSF fit was out of the expected range");

            case NotMeasuredReasons.ObjectCertaintyTooSmall:
                return("W:Measuring:The certainty of the located object is too small");

            case NotMeasuredReasons.ObjectTooElongated:
                return("W:Measuring:The object was rejected as being too elongated");
            }

            return(null);
        }
Example #16
0
 public virtual void SetIsTracked(bool isMeasured, NotMeasuredReasons reason)
 {
     IsLocated = isMeasured;
     if (isMeasured)
         NotMeasuredReasons = NotMeasuredReasons.TrackedSuccessfully;
     else
     {
         // Remove the Tracked Successfully flag if set
         NotMeasuredReasons = (NotMeasuredReasons)((int)NotMeasuredReasons & ~(int)NotMeasuredReasons.TrackedSuccessfully);
         NotMeasuredReasons = (NotMeasuredReasons) ((int) NotMeasuredReasons & 0x00FFFF) | reason;
     }
 }
Example #17
0
        protected static void DecodeByteFlags(
			byte flags,
			out NotMeasuredReasons firstFlags,
			out NotMeasuredReasons secondFlags,
			out NotMeasuredReasons thirdFlags)
        {
            int firstLevel = (int)flags & 0x7;
            int secondLevel = ((int)flags >> 3) & 0x7;
            int thirdLevel = ((int)flags >> 6) & 0x3;

            firstFlags = (NotMeasuredReasons)firstLevel;
            secondFlags = (NotMeasuredReasons)(secondLevel << 8);
            thirdFlags = (NotMeasuredReasons)((thirdLevel != 0 ? thirdLevel + 1 : thirdLevel) /* We don't save NoPixelsToMeasure, this is why we add 1 */ << 16);
        }
        private void MeasureCurrentPSF()
        {
            if (m_PSFFit == null)
            {
                return;
            }

            float aperture = (float)nudMeasuringAperture.Value;

            using (Graphics g = Graphics.FromImage(picPixels.Image))
            {
                m_PSFFit.DrawDataPixels(g, new Rectangle(0, 0, picPixels.Width, picPixels.Height), aperture, Pens.Lime, m_Bpp, m_NormVal);
                g.Save();
            }
            picPixels.Invalidate();

            int centerX = (int)Math.Round(m_PSFFit.XCenter);
            int centerY = (int)Math.Round(m_PSFFit.YCenter);

            uint[,] data      = m_VideoController.GetCurrentAstroImage(false).GetMeasurableAreaPixels(centerX, centerY, 17);
            uint[,] bagPixels = m_VideoController.GetCurrentAstroImage(false).GetMeasurableAreaPixels(centerX, centerY, 35);

            NotMeasuredReasons rv = MeasureObject(
                new ImagePixel(m_PSFFit.XCenter, m_PSFFit.YCenter),
                data,
                bagPixels,
                m_VideoController.VideoBitPix,
                m_Measurer,
                TangraConfig.PreProcessingFilter.NoFilter,
                m_SignalMethod,
                TangraConfig.PsfQuadrature.NumericalInAperture,
                TangraConfig.Settings.Photometry.PsfFittingMethod,
                aperture,
                m_PSFFit.FWHM,
                (float)m_PSFFit.FWHM,
                new FakeIMeasuredObject(m_PSFFit),
                null,
                null,
                false);

            double reading   = m_Measurer.TotalReading;
            double bgReading = m_Measurer.TotalBackground;

            if (rv == NotMeasuredReasons.MeasuredSuccessfully)
            {
                tbxSmBG.Text = (reading - bgReading).ToString("0.000");
                tbxBg.Text   = bgReading.ToString("0.000");
            }
            else
            {
                Trace.WriteLine("TargetPSFViewer.NotMeasuredReasons: " + rv.ToString());
                tbxBg.Text   = "ERR";
                tbxSmBG.Text = "ERR";
            }

            // Show the apertures in the main view
            m_Aperture    = aperture;
            m_InnerRadius = (float)(TangraConfig.Settings.Photometry.AnnulusInnerRadius * aperture);
            m_OuterRadius = (float)Math.Sqrt(TangraConfig.Settings.Photometry.AnnulusMinPixels / Math.PI + m_InnerRadius * m_InnerRadius);

            //m_VideoController.RefreshCurrentFrame();
        }
Example #19
0
        private static string TranslateFlags(NotMeasuredReasons firstFlags, NotMeasuredReasons secondFlags, NotMeasuredReasons thirdFlags)
        {
            StringBuilder output = new StringBuilder();

            output.AppendLine(GetNotMeasuredReasonsDisplayValue(firstFlags));

            if (secondFlags != 0)
                output.AppendLine(GetNotMeasuredReasonsDisplayValue(secondFlags));

            if (thirdFlags != 0)
                output.AppendLine(GetNotMeasuredReasonsDisplayValue(thirdFlags));

            return output.ToString();
        }
Example #20
0
 public void SetIsTracked(bool isMeasured, NotMeasuredReasons reason, IImagePixel estimatedCenter, double?certainty)
 {
     Center    = estimatedCenter;
     IsLocated = isMeasured;
 }