private void SetBestAngle(float bestAngle) { SelectedStarBestAngle = bestAngle; m_OperationState = SpectroscopyState.StarConfirmed; var reader = new SpectraReader(m_VideoController.GetCurrentAstroImage(false), bestAngle, PixelValueCoefficient); Spectra spectra = reader.ReadSpectra( (float)SelectedStar.XDouble, (float)SelectedStar.YDouble, MeasurementAreaWing, BackgroundAreaWing, BackgroundAreaGap, PixelCombineMethod.Average); m_ControlPanel.PreviewSpectra(spectra); }
private void frmRunMultiFrameSpectroscopy_Load(object sender, EventArgs e) { IImagePixel starCenter = m_VideoOperation.SelectedStar; m_SpectraReader = new SpectraReader(m_AstroImage, m_VideoOperation.SelectedStarBestAngle, 1); m_Spectra = m_SpectraReader.ReadSpectra((float)starCenter.XDouble, (float)starCenter.YDouble, (int)nudAreaWing.Value, (int)nudBackgroundWing.Value, (int)nudBackgroundGap.Value, PixelCombineMethod.Average); m_Mapper = new RotationMapper(m_AstroImage.Width, m_AstroImage.Height, m_VideoOperation.SelectedStarBestAngle); uint[,] pixels = m_AstroImage.GetMeasurableAreaPixels(starCenter.X, starCenter.Y, 35); m_ZeroOrderPsf = new PSFFit(starCenter.X, starCenter.Y); m_ZeroOrderPsf.Fit(pixels); m_Spectra.ZeroOrderFWHM = (float)m_ZeroOrderPsf.FWHM; PlotMeasurementAreas(); PlotAlignTarget(); nudDivisor.SetNUDValue((decimal)m_AstroImage.Pixelmap.MaxSignalValue); nudMultiplier.Value = 1024; }
public void NextFrame(int frameNo, MovementType movementType, bool isLastFrame, AstroImage astroImage, int firstFrameInIntegrationPeriod, string fileName) { m_CurrentFrameNo = frameNo; if (m_OperationState == SpectroscopyState.RunningMeasurements) { if (m_FirstMeasuredFrame == null) { m_FirstMeasuredFrame = m_CurrentFrameNo; if (m_VideoController.HasEmbeddedTimeStamps()) { m_FirstFrameTimeStamp = m_VideoController.GetCurrentFrameTime(); } else if (m_VideoController.HasSystemTimeStamps()) { m_FirstFrameTimeStamp = m_VideoController.GetCurrentFrameTime(); } m_FrameBitmapPixels = astroImage.Pixelmap.DisplayBitmapPixels; } m_Tracker.NextFrame(frameNo, astroImage); if (m_Tracker.IsTrackedSuccessfully) { TrackedObject trackedStar = m_Tracker.TrackedStar; SelectedStar = trackedStar.Center; m_Reader = new SpectraReader(astroImage, SelectedStarBestAngle, m_SpectroscopyController.SpectraReductionContext.PixelValueCoefficient); Spectra thisFrameSpectra = m_Reader.ReadSpectra( trackedStar.ThisFrameX, trackedStar.ThisFrameY, m_SpectroscopyController.SpectraReductionContext.MeasurementAreaWing, m_SpectroscopyController.SpectraReductionContext.BackgroundAreaWing, m_SpectroscopyController.SpectraReductionContext.BackgroundAreaGap, m_SpectroscopyController.SpectraReductionContext.BackgroundMethod); thisFrameSpectra.ZeroOrderFWHM = trackedStar.PSFFit != null ? (float)trackedStar.PSFFit.FWHM : float.NaN; m_AllFramesSpectra.Add(thisFrameSpectra); } if (isLastFrame || m_CancelMeasurementsRequested || m_AllFramesSpectra.Count >= m_SpectroscopyController.SpectraReductionContext.FramesToMeasure) { m_FramePlayer.Stop(); m_MasterSpectra = m_SpectroscopyController.ComputeResult( m_AllFramesSpectra, m_SpectroscopyController.SpectraReductionContext.FrameCombineMethod, m_SpectroscopyController.SpectraReductionContext.UseFineAdjustments, m_SpectroscopyController.SpectraReductionContext.AlignmentAbsorptionLinePos); m_AllFramesSpectra.Clear(); m_MasterSpectra.MeasurementInfo = m_SpectroscopyController.GetMeasurementInfo(); m_MasterSpectra.MeasurementInfo.FirstMeasuredFrame = m_FirstMeasuredFrame.Value; m_MasterSpectra.MeasurementInfo.LastMeasuredFrame = m_CurrentFrameNo; m_MasterSpectra.MeasurementInfo.FirstFrameTimeStamp = m_FirstFrameTimeStamp; if (m_VideoController.HasEmbeddedTimeStamps()) { m_MasterSpectra.MeasurementInfo.LastFrameTimeStamp = m_VideoController.GetCurrentFrameTime(); } else if (m_VideoController.HasSystemTimeStamps()) { m_MasterSpectra.MeasurementInfo.LastFrameTimeStamp = m_VideoController.GetCurrentFrameTime(); } FrameStateData frameStatus = m_VideoController.GetCurrentFrameState(); m_MasterSpectra.MeasurementInfo.Gain = frameStatus.Gain; m_MasterSpectra.MeasurementInfo.ExposureSeconds = m_SpectroscopyController.SpectraReductionContext.ExposureSeconds; m_MasterSpectra.MeasurementInfo.FrameBitmapPixels = m_FrameBitmapPixels; m_SpectroscopyController.PopulateMasterSpectraObservationDetails(m_MasterSpectra); m_OperationState = SpectroscopyState.DisplayingMeasurements; m_ControlPanel.MeasurementsFinished(); DisplaySpectra(); } Application.DoEvents(); } }