public void GetNextSequence_ModeRotate_NextSequenceSelected() { //Arrange var seq = new CaptureSequence() { TotalExposureCount = 5 }; var seq2 = new CaptureSequence() { TotalExposureCount = 5 }; var seq3 = new CaptureSequence() { TotalExposureCount = 5 }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.ROTATE; l.Add(seq); l.Add(seq2); l.Add(seq3); //Act var actualFirst = l.Next(); var actualSecond = l.Next(); var actualThird = l.Next(); var actualFourth = l.Next(); //Assert Assert.AreSame(seq, actualFirst, "First wrong"); Assert.AreSame(seq2, actualSecond, "Second wrong"); Assert.AreSame(seq3, actualThird, "Third wrong"); Assert.AreSame(seq, actualFourth, "Fourth wrong"); }
public void DisableSequenceDuringPause_ModeRotate_NextItemSelected() { var seq = new CaptureSequence() { ProgressExposureCount = 0, TotalExposureCount = 5 }; var seq2 = new CaptureSequence() { TotalExposureCount = 10 }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.ROTATE; l.Add(seq); l.Next(); l.Next(); l.Next(); l.Items[l.ActiveSequenceIndex - 1].Enabled = false; l.Add(seq2); Assert.AreEqual(seq2, l.ActiveSequence); }
public void DeleteSequenceDuringPause_NextItemSelected() { var seq = new CaptureSequence() { ProgressExposureCount = 0, TotalExposureCount = 5 }; var seq2 = new CaptureSequence() { TotalExposureCount = 10 }; var l = new CaptureSequenceList(); l.Add(seq); l.Next(); l.Next(); l.Next(); l.RemoveAt(l.ActiveSequenceIndex - 1); l.Add(seq2); Assert.AreEqual(seq2, l.ActiveSequence); }
private async Task ChangeFilter(CaptureSequence seq, CancellationToken token, IProgress <ApplicationStatus> progress) { if (seq.FilterType != null) { await filterWheelMediator.ChangeFilter(seq.FilterType, token, progress); } }
public void GetNextSequence_ModeStandardOneDisabled_NextSequenceSelectedShouldBeEmpty() { //Arrange var seq = new CaptureSequence() { TotalExposureCount = 2 }; var seq2 = new CaptureSequence() { Enabled = false }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.STANDARD; l.Add(seq); l.Add(seq2); //Act var nextSeq = l.Next(); nextSeq = l.Next(); nextSeq = l.Next(); //Assert Assert.AreEqual(string.Empty, l.TargetName, "Targetname"); Assert.AreSame(null, nextSeq); Assert.AreEqual(1, l.Count); Assert.AreSame(null, l.ActiveSequence); Assert.AreEqual(-1, l.ActiveSequenceIndex); Assert.AreEqual(0, l.Delay); }
public void GetNextSequence_ModeStandardOneDisabled_Initial() { //Arrange var seq = new CaptureSequence(); var seq2 = new CaptureSequence() { Enabled = false }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.STANDARD; l.Add(seq); l.Add(seq2); //Act var nextSeq = l.Next(); //Assert Assert.AreEqual(string.Empty, l.TargetName, "Targetname"); Assert.AreSame(seq, nextSeq); Assert.AreEqual(1, l.Count); Assert.AreSame(seq, l.ActiveSequence); Assert.AreEqual(1, l.ActiveSequenceIndex); Assert.AreEqual(0, l.Delay); }
public void Constructor_ValueTest() { //Arrange var exposureTime = 5; var imageType = CaptureSequence.ImageTypes.BIAS; var filter = new FilterInfo("Red", 1234, 3); var binning = new BinningMode(2, 3); var exposureCount = 20; //Act var seq = new CaptureSequence(exposureTime, imageType, filter, binning, exposureCount); //Assert Assert.AreEqual(binning.X, seq.Binning.X, "Binning X value not as expected"); Assert.AreEqual(binning.Y, seq.Binning.Y, "Binning X value not as expected"); Assert.AreEqual(false, seq.Dither, "Dither value not as expected"); Assert.AreEqual(1, seq.DitherAmount, "DitherAmount value not as expected"); Assert.AreEqual(exposureTime, seq.ExposureTime, "ExposureTime value not as expected"); Assert.AreEqual(filter, seq.FilterType, "FilterType value not as expected"); Assert.AreEqual(-1, seq.Gain, "Gain value not as expected"); Assert.AreEqual(imageType, seq.ImageType, "ImageType value not as expected"); Assert.AreEqual(0, seq.ProgressExposureCount, "ProgressExposureCount value not as expected"); Assert.AreEqual(exposureCount, seq.TotalExposureCount, "TotalExposureCount value not as expected"); Assert.AreEqual(true, seq.Enabled, "Enabled value not as expected"); }
private void AddMetaData( ImageMetaData metaData, CaptureSequence sequence, DateTime start, RMS rms, string targetName) { metaData.Image.ExposureStart = start; metaData.Image.Binning = sequence.Binning.Name; metaData.Image.ExposureNumber = sequence.ProgressExposureCount; metaData.Image.ExposureTime = sequence.ExposureTime; metaData.Image.ImageType = sequence.ImageType; metaData.Image.RecordedRMS = rms; metaData.Target.Name = targetName; // Fill all available info from profile metaData.FromProfile(profileService.ActiveProfile); metaData.FromTelescopeInfo(telescopeInfo); metaData.FromFilterWheelInfo(filterWheelInfo); metaData.FromRotatorInfo(rotatorInfo); metaData.FromFocuserInfo(focuserInfo); metaData.FromWeatherDataInfo(weatherDataInfo); metaData.FilterWheel.Filter = sequence.FilterType?.Name ?? metaData.FilterWheel.Filter; }
public async Task Successful_Centering_NoSeparation_Test() { var seq = new CaptureSequence(); var coordinates = new Coordinates(Angle.ByDegree(5), Angle.ByDegree(3), Epoch.JNOW); var parameter = new CenterSolveParameter() { Coordinates = coordinates.Transform(Epoch.JNOW), FocalLength = 700, Threshold = 1 }; var testResult = new PlateSolveResult() { Success = true, Coordinates = coordinates.Transform(Epoch.JNOW) }; captureSolverMock .Setup(x => x.Solve(seq, It.IsAny <CaptureSolverParameter>(), It.IsAny <IProgress <PlateSolveProgress> >(), It.IsAny <IProgress <ApplicationStatus> >(), It.IsAny <CancellationToken>())) .ReturnsAsync(testResult); telescopeMediatorMock .Setup(x => x.GetCurrentPosition()) .Returns(coordinates); var sut = new CenteringSolver(plateSolverMock.Object, blindSolverMock.Object, null, telescopeMediatorMock.Object); sut.CaptureSolver = captureSolverMock.Object; var result = await sut.Center(seq, parameter, default, default, default);
private async Task <double> CalculatePoleError(Coordinates startPosition, IProgress <ApplicationStatus> progress, CancellationToken canceltoken) { var plateSolver = PlateSolverFactory.GetPlateSolver(profileService.ActiveProfile.PlateSolveSettings); var blindSolver = PlateSolverFactory.GetBlindSolver(profileService.ActiveProfile.PlateSolveSettings); var solver = new CaptureSolver(plateSolver, blindSolver, imagingMediator); var parameter = new CaptureSolverParameter() { Attempts = 1, Binning = SnapBin?.X ?? CameraInfo.BinX, DownSampleFactor = profileService.ActiveProfile.PlateSolveSettings.DownSampleFactor, FocalLength = profileService.ActiveProfile.TelescopeSettings.FocalLength, MaxObjects = profileService.ActiveProfile.PlateSolveSettings.MaxObjects, PixelSize = profileService.ActiveProfile.CameraSettings.PixelSize, ReattemptDelay = TimeSpan.FromMinutes(profileService.ActiveProfile.PlateSolveSettings.ReattemptDelay), Regions = profileService.ActiveProfile.PlateSolveSettings.Regions, SearchRadius = profileService.ActiveProfile.PlateSolveSettings.SearchRadius }; double poleError = double.NaN; try { double driftAmount = 0.5d; progress.Report(new ApplicationStatus() { Status = "Solving image..." }); var seq = new CaptureSequence(SnapExposureDuration, CaptureSequence.ImageTypes.SNAPSHOT, SnapFilter, SnapBin, 1); seq.Gain = SnapGain; parameter.Coordinates = startPosition; PlateSolveResult = await solver.Solve(seq, parameter, default, progress, canceltoken);
private async Task <bool> Darvslew(IProgress <ApplicationStatus> cameraprogress, IProgress <string> slewprogress) { if (CameraInfo?.Connected == true) { cancelDARVSlewToken?.Dispose(); cancelDARVSlewToken = new CancellationTokenSource(); try { var seq = new CaptureSequence(DARVSlewDuration + 5, CaptureSequence.ImageTypes.SNAPSHOT, SnapFilter, SnapBin, 1); var prepareParameters = new PrepareImageParameters(autoStretch: true, detectStars: false); var capture = imagingMediator.CaptureAndPrepareImage(seq, prepareParameters, cancelDARVSlewToken.Token, cameraprogress); var slew = DarvTelescopeSlew(slewprogress, cancelDARVSlewToken.Token); await Task.WhenAll(capture, slew); } catch (OperationCanceledException) { } } else { Notification.ShowError(Locale.Loc.Instance["LblNoCameraConnected"]); } cameraprogress.Report(new ApplicationStatus() { Status = string.Empty }); return(true); }
public void GetNextSequence_ModeRotate_AllFinished() { //Arrange var seq = new CaptureSequence() { TotalExposureCount = 5 }; var seq2 = new CaptureSequence() { TotalExposureCount = 5 }; var seq3 = new CaptureSequence() { TotalExposureCount = 5 }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.ROTATE; l.Add(seq); l.Add(seq2); l.Add(seq3); //Act CaptureSequence actualSeq; while ((actualSeq = l.Next()) != null) { } //Assert Assert.AreEqual(null, l.ActiveSequence); Assert.AreEqual(-1, l.ActiveSequenceIndex); Assert.AreEqual(0, l.Items.Where(x => x.ProgressExposureCount <x.TotalExposureCount || x.ProgressExposureCount> x.TotalExposureCount).Count()); }
public void GetNextSequence_ModeRotateOneDisabled_FirstEmptySecondDisabledThirdSelected() { //Arrange var seq = new CaptureSequence() { ProgressExposureCount = 0, TotalExposureCount = 0 }; var seq2 = new CaptureSequence() { ProgressExposureCount = 5, TotalExposureCount = 10, Enabled = false }; var seq3 = new CaptureSequence() { ProgressExposureCount = 5, TotalExposureCount = 7 }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.ROTATE; l.Add(seq); l.Add(seq2); l.Add(seq3); //Act var actual = l.Next(); //Assert Assert.AreSame(seq3, actual); }
public Task <IRenderedImage> CaptureAndPrepareImage( CaptureSequence sequence, PrepareImageParameters parameters, CancellationToken token, IProgress <ApplicationStatus> progress) { return(handler.CaptureAndPrepareImage(sequence, parameters, token, progress)); }
private async Task <AllImageStatistics> TakeExposure(double exposureDuration) { _cts?.Dispose(); _cts = new CancellationTokenSource(); var seq = new CaptureSequence(exposureDuration, CaptureSequence.ImageTypes.SNAPSHOT, SnapFilter, new Model.MyCamera.BinningMode(1, 1), 1); seq.Gain = SnapGain; var prepareParameters = new PrepareImageParameters(autoStretch: true, detectStars: false); var capture = await _imagingMediator.CaptureAndPrepareImage(seq, prepareParameters, _cts.Token, null); //todo progress return(await AllImageStatistics.Create(capture.RawImageData)); }
public void AddFirstSequence_ActiveSequenceSet() { var seq = new CaptureSequence() { ProgressExposureCount = 0, TotalExposureCount = 5 }; var l = new CaptureSequenceList(); l.Add(seq); Assert.AreEqual(seq, l.ActiveSequence); }
private async Task <bool> Snap(IProgress <ApplicationStatus> progress) { do { _captureImageToken?.Dispose(); _captureImageToken = new CancellationTokenSource(); var seq = new CaptureSequence(SnapExposureDuration, CaptureSequence.ImageTypes.SNAPSHOT, SnapFilter, SnapBin, 1); await imagingMediator.CaptureAndPrepareImage(seq, new PrepareImageParameters(), _captureImageToken.Token, progress); _captureImageToken.Token.ThrowIfCancellationRequested(); } while (Loop); return(true); }
public void SequenceConstructor_ValueTest() { //Arrange var seq = new CaptureSequence(); var l = new CaptureSequenceList(seq); //Act //Assert Assert.AreEqual(string.Empty, l.TargetName, "Targetname"); Assert.AreEqual(1, l.Count); Assert.AreEqual(seq, l.ActiveSequence); Assert.AreEqual(1, l.ActiveSequenceIndex); Assert.AreEqual(0, l.Delay); }
public async Task <IRenderedImage> CaptureAndPrepareImage( CaptureSequence sequence, PrepareImageParameters parameters, CancellationToken token, IProgress <ApplicationStatus> progress) { var iarr = await CaptureImage(sequence, parameters, token, string.Empty); if (iarr != null) { return(await _imageProcessingTask); } else { return(null); } }
public void AddFirstSequenceAfterOneDisabledExists_ActiveSequenceSet() { var seq = new CaptureSequence() { ProgressExposureCount = 0, TotalExposureCount = 5, Enabled = false }; var seq2 = new CaptureSequence() { TotalExposureCount = 10 }; var l = new CaptureSequenceList(); l.Add(seq); l.Add(seq2); Assert.AreEqual(seq2, l.ActiveSequence); }
public async Task <PlateSolveResult> Solve(CaptureSequence seq, CaptureSolverParameter parameter, IProgress <PlateSolveProgress> solveProgress, IProgress <ApplicationStatus> progress, CancellationToken ct) { var remainingAttempts = parameter.Attempts; PlateSolveResult plateSolveResult; do { remainingAttempts--; var renderedImage = await imagingMediator.CaptureAndPrepareImage(seq, new PrepareImageParameters(), ct, progress); solveProgress?.Report( new PlateSolveProgress { Thumbnail = await renderedImage.GetThumbnail() } ); ct.ThrowIfCancellationRequested(); if (renderedImage != null) { plateSolveResult = await ImageSolver.Solve(renderedImage.RawImageData, parameter, progress, ct); } else { plateSolveResult = new PlateSolveResult() { Success = false }; } solveProgress?.Report( new PlateSolveProgress { PlateSolveResult = plateSolveResult } ); if (!plateSolveResult.Success && remainingAttempts > 0) { await Utility.Utility.Wait(parameter.ReattemptDelay, ct, progress); } } while (!plateSolveResult.Success && remainingAttempts > 0); return(plateSolveResult); }
public void DefaultConstructor_ValueTest() { //Arrange //Act var seq = new CaptureSequence(); //Assert Assert.AreEqual(1, seq.Binning.X, "Binning X value not as expected"); Assert.AreEqual(1, seq.Binning.Y, "Binning X value not as expected"); Assert.AreEqual(false, seq.Dither, "Dither value not as expected"); Assert.AreEqual(1, seq.DitherAmount, "DitherAmount value not as expected"); Assert.AreEqual(1, seq.ExposureTime, "ExposureTime value not as expected"); Assert.AreEqual(null, seq.FilterType, "FilterType value not as expected"); Assert.AreEqual(-1, seq.Gain, "Gain value not as expected"); Assert.AreEqual(CaptureSequence.ImageTypes.LIGHT, seq.ImageType, "ImageType value not as expected"); Assert.AreEqual(0, seq.ProgressExposureCount, "ProgressExposureCount value not as expected"); Assert.AreEqual(1, seq.TotalExposureCount, "TotalExposureCount value not as expected"); Assert.AreEqual(true, seq.Enabled, "Enabled value not as expected"); }
public void GetNextSequence_ModeRotateOneDisabled_EmptyListNextNull() { //Arrange var seq = new CaptureSequence() { TotalExposureCount = 5, Enabled = false }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.ROTATE; l.Add(seq); //Act var actual = l.Next(); //Assert Assert.AreSame(null, actual); Assert.AreEqual(null, l.ActiveSequence); Assert.AreEqual(-1, l.ActiveSequenceIndex); }
public void RunSequenceMultipleTimes_ModeRotate_NumberOfExposuresCorrect() { var seq1 = new CaptureSequence() { TotalExposureCount = 50 }; var seq2 = new CaptureSequence() { TotalExposureCount = 10 }; var seq3 = new CaptureSequence() { TotalExposureCount = 30 }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.ROTATE; l.Add(seq1); while (l.Next() != null) { } l.Add(seq2); while (l.Next() != null) { } l.Add(seq3); while (l.Next() != null) { } Assert.AreEqual(50, seq1.ProgressExposureCount); Assert.AreEqual(10, seq2.ProgressExposureCount); Assert.AreEqual(30, seq3.ProgressExposureCount); }
private async Task <bool> Recenter(CancellationToken token, IProgress <ApplicationStatus> progress) { if (profileService.ActiveProfile.MeridianFlipSettings.Recenter) { Logger.Trace("Meridian Flip - Recenter after meridian flip"); progress.Report(new ApplicationStatus() { Status = Locale.Loc.Instance["LblInitiatePlatesolve"] }); var plateSolver = PlateSolverFactory.GetPlateSolver(profileService.ActiveProfile.PlateSolveSettings); var blindSolver = PlateSolverFactory.GetBlindSolver(profileService.ActiveProfile.PlateSolveSettings); var seq = new CaptureSequence( profileService.ActiveProfile.PlateSolveSettings.ExposureTime, CaptureSequence.ImageTypes.SNAPSHOT, profileService.ActiveProfile.PlateSolveSettings.Filter, new Model.MyCamera.BinningMode(profileService.ActiveProfile.PlateSolveSettings.Binning, profileService.ActiveProfile.PlateSolveSettings.Binning), 1 ); seq.Gain = profileService.ActiveProfile.PlateSolveSettings.Gain; var solver = new CenteringSolver(plateSolver, blindSolver, imagingMediator, telescopeMediator); var parameter = new CenterSolveParameter() { Attempts = profileService.ActiveProfile.PlateSolveSettings.NumberOfAttempts, Binning = profileService.ActiveProfile.PlateSolveSettings.Binning, Coordinates = _targetCoordinates, DownSampleFactor = profileService.ActiveProfile.PlateSolveSettings.DownSampleFactor, FocalLength = profileService.ActiveProfile.TelescopeSettings.FocalLength, MaxObjects = profileService.ActiveProfile.PlateSolveSettings.MaxObjects, PixelSize = profileService.ActiveProfile.CameraSettings.PixelSize, ReattemptDelay = TimeSpan.FromMinutes(profileService.ActiveProfile.PlateSolveSettings.ReattemptDelay), Regions = profileService.ActiveProfile.PlateSolveSettings.Regions, SearchRadius = profileService.ActiveProfile.PlateSolveSettings.SearchRadius, Threshold = profileService.ActiveProfile.PlateSolveSettings.Threshold, NoSync = profileService.ActiveProfile.TelescopeSettings.NoSync }; _ = await solver.Center(seq, parameter, default, progress, token);
public void ReduceExposureCount_ProgressReflectedCorrectly() { //Arrange var exposureTime = 5; var imageType = CaptureSequence.ImageTypes.BIAS; var filter = new FilterInfo("Red", 1234, 3); var binning = new BinningMode(2, 3); var exposureCount = 20; var seq = new CaptureSequence(exposureTime, imageType, filter, binning, exposureCount); var exposuresTaken = 5; //Act for (int i = 0; i < exposuresTaken; i++) { seq.ProgressExposureCount++; } //Assert Assert.AreEqual(exposuresTaken, seq.ProgressExposureCount, "ProgressExposureCount value not as expected"); Assert.AreEqual(exposureCount, seq.TotalExposureCount, "TotalExposureCount value not as expected"); }
public void GetNextSequence_ModeStandardOneDisabled_AllFinished() { //Arrange var seq = new CaptureSequence() { TotalExposureCount = 5 }; var seq2 = new CaptureSequence() { ProgressExposureCount = 0, TotalExposureCount = 5, Enabled = false }; var seq3 = new CaptureSequence() { TotalExposureCount = 5 }; var l = new CaptureSequenceList(); l.Mode = SequenceMode.STANDARD; l.Add(seq); l.Add(seq2); l.Add(seq3); //Act CaptureSequence actualSeq; while ((actualSeq = l.Next()) != null) { } //Assert Assert.AreEqual(null, l.ActiveSequence); Assert.AreEqual(-1, l.ActiveSequenceIndex); Assert.AreEqual(1, l.Items.Where(x => x.ProgressExposureCount < x.TotalExposureCount).Count()); Assert.AreEqual(5, seq.ProgressExposureCount); Assert.AreEqual(0, seq2.ProgressExposureCount); Assert.AreEqual(5, seq3.ProgressExposureCount); }
public async Task Successful_CaptureAndSolving_Test() { var imageDataMock = new Mock <IImageData>(); var renderedImageMock = new Mock <IRenderedImage>(); renderedImageMock.SetupGet(x => x.RawImageData).Returns(imageDataMock.Object); var testResult = new PlateSolveResult() { Success = true }; var seq = new CaptureSequence(); var parameter = new CaptureSolverParameter() { FocalLength = 700 }; imagingMediatorMock.Setup(x => x.CaptureAndPrepareImage(seq, It.IsAny <PrepareImageParameters>(), It.IsAny <CancellationToken>(), It.IsAny <IProgress <ApplicationStatus> >())).ReturnsAsync(renderedImageMock.Object); imageSolverMock.Setup(x => x.Solve(imageDataMock.Object, It.IsAny <PlateSolveParameter>(), It.IsAny <IProgress <ApplicationStatus> >(), It.IsAny <CancellationToken>())).ReturnsAsync(testResult); var sut = new CaptureSolver(plateSolverMock.Object, blindSolverMock.Object, imagingMediatorMock.Object); sut.ImageSolver = imageSolverMock.Object; var result = await sut.Solve(seq, parameter, default, default, default);
public CameraDownloadFailedException(CaptureSequence sequence) : this($"Camera download failed. Exposure details: Exposure time: {sequence.ExposureTime}, Type: {sequence.ImageType}, Gain: {sequence.Gain}, Filter: {sequence.FilterType?.Name ?? string.Empty}") { }
public async Task <PlateSolveResult> Center(CaptureSequence seq, CenterSolveParameter parameter, IProgress <PlateSolveProgress> solveProgress, IProgress <ApplicationStatus> progress, CancellationToken ct) { if (parameter?.Coordinates == null) { throw new ArgumentException(nameof(CenterSolveParameter.Coordinates)); } if (parameter?.Threshold <= 0) { throw new ArgumentException(nameof(CenterSolveParameter.Threshold)); } var centered = false; PlateSolveResult result; Separation offset = new Separation(); do { result = await CaptureSolver.Solve(seq, parameter, solveProgress, progress, ct); if (result.Success == false) { //Solving failed. Give up. break; } var position = (telescopeMediator.GetCurrentPosition() - offset).Transform(result.Coordinates.Epoch); result.Separation = result.DetermineSeparation(position); Logger.Debug($"Centering Solver - Scope Position: {position}; Centering Coordinates: {parameter.Coordinates}; Solve Result: {result.Coordinates}; Separation {result.Separation}"); solveProgress?.Report(new PlateSolveProgress() { PlateSolveResult = result }); if (Math.Abs(result.Separation.Distance.ArcMinutes) > parameter.Threshold) { progress?.Report(new ApplicationStatus() { Status = Locale.Loc.Instance["LblPlateSolveNotInsideToleranceSyncing"] }); if (parameter.NoSync || !await telescopeMediator.Sync(result.Coordinates)) { offset = result.DetermineSeparation(position + offset); Logger.Debug($"Sync failed - calculating offset instead to compensate. Original: {position.Transform(result.Coordinates.Epoch)}; Solved: {result.Coordinates}; Offset: {offset}"); progress?.Report(new ApplicationStatus() { Status = Locale.Loc.Instance["LblPlateSolveSyncViaTargetOffset"] }); } else { var positionAfterSync = telescopeMediator.GetCurrentPosition().Transform(result.Coordinates.Epoch); if (Astrometry.DegreeToArcsec(Math.Abs(positionAfterSync.RADegrees - result.Coordinates.RADegrees)) > 1 || Astrometry.DegreeToArcsec(Math.Abs(positionAfterSync.Dec - result.Coordinates.Dec)) > 1) { offset = result.DetermineSeparation(positionAfterSync); Logger.Debug($"Sync failed silently - calculating offset instead to compensate. Original: {positionAfterSync}; Solved: {result.Coordinates}; Offset: {offset}"); } else { // Sync worked - reset offset Logger.Debug("Synced sucessfully"); offset = new Separation(); } } Logger.Trace($"Slewing to target after sync. Target coordinates RA: {parameter.Coordinates.RAString} Dec: {parameter.Coordinates.DecString} Epoch: {parameter.Coordinates.Epoch}"); progress?.Report(new ApplicationStatus() { Status = Locale.Loc.Instance["LblPlateSolveNotInsideToleranceReslew"] }); await telescopeMediator.SlewToCoordinatesAsync(parameter.Coordinates + offset); progress?.Report(new ApplicationStatus() { Status = Locale.Loc.Instance["LblPlateSolveNotInsideToleranceRepeating"] }); } else { centered = true; } } while (!centered); return(result); }