Example #1
0
        public async Task <DeepSkyObject> GetTarget()
        {
            string route = "/api/objects/info?format=json";

            var request = new HttpGetRequest(this.baseUrl + route);

            try {
                var response = await request.Request(new CancellationToken());

                if (string.IsNullOrEmpty(response))
                {
                    return(await GetView());
                }

                var jobj   = JObject.Parse(response);
                var status = jobj.ToObject <StellariumObject>();

                var ra  = Astrometry.EuclidianModulus(status.RightAscension, 360);
                var dec = status.Declination;

                var coordinates = new Coordinates(Angle.ByDegree(ra), Angle.ByDegree(dec), Epoch.J2000);
                var dso         = new DeepSkyObject(status.Name, coordinates, string.Empty);
                return(dso);
            } catch (Exception ex) {
                Logger.Error(ex);
                throw ex;
            }
        }
Example #2
0
        private void InitializeRADecFilters()
        {
            RAFrom     = new AsyncObservableCollection <KeyValuePair <double?, string> >();
            RAThrough  = new AsyncObservableCollection <KeyValuePair <double?, string> >();
            DecFrom    = new AsyncObservableCollection <KeyValuePair <double?, string> >();
            DecThrough = new AsyncObservableCollection <KeyValuePair <double?, string> >();

            RAFrom.Add(new KeyValuePair <double?, string>(null, string.Empty));
            RAThrough.Add(new KeyValuePair <double?, string>(null, string.Empty));
            DecFrom.Add(new KeyValuePair <double?, string>(null, string.Empty));
            DecThrough.Add(new KeyValuePair <double?, string>(null, string.Empty));

            for (int i = 0; i < 25; i++)
            {
                Astrometry.HoursToDegrees(i);

                RAFrom.Add(new KeyValuePair <double?, string>(Astrometry.HoursToDegrees(i), i.ToString()));
                RAThrough.Add(new KeyValuePair <double?, string>(Astrometry.HoursToDegrees(i), i.ToString()));
            }
            for (int i = -90; i < 91; i = i + 5)
            {
                DecFrom.Add(new KeyValuePair <double?, string>(i, i.ToString()));
                DecThrough.Add(new KeyValuePair <double?, string>(i, i.ToString()));
            }
        }
Example #3
0
        /// <summary>
        /// Finds a theoretical home position for the telescope to return to. It will be pointing to the Celestial Pole, but in such a way that
        /// CW bar should be nearly vertical, and there is no meridian flip involved.
        /// </summary>
        /// <param name="currentCoordinates"></param>
        /// <returns></returns>
        private Coordinates GetHomeCoordinates(Coordinates currentCoordinates)
        {
            double siderealTime = Astrometry.GetLocalSiderealTimeNow(profileService.ActiveProfile.AstrometrySettings.Longitude);

            if (siderealTime > 24)
            {
                siderealTime -= 24;
            }
            if (siderealTime < 0)
            {
                siderealTime += 24;
            }
            double      timeToMed         = currentCoordinates.RA - siderealTime;
            Coordinates returnCoordinates = new Coordinates(Angle.ByHours(0), Angle.ByDegree(0), Epoch.J2000);

            if (profileService.ActiveProfile.AstrometrySettings.HemisphereType == Hemisphere.NORTHERN)
            {
                returnCoordinates.Dec = 89;
                returnCoordinates.RA  = siderealTime + 6 * Math.Sign(timeToMed);
            }
            if (profileService.ActiveProfile.AstrometrySettings.HemisphereType == Hemisphere.SOUTHERN)
            {
                returnCoordinates.Dec = -89;
                returnCoordinates.RA  = siderealTime + 6 * Math.Sign(timeToMed);
            }
            return(returnCoordinates);
        }
Example #4
0
        public ViewportFoV(Coordinates centerCoordinates, double vFoVDegrees, double width, double height, double rotation)
        {
            Rotation = rotation;

            OriginalWidth  = width;
            OriginalHeight = height;

            Width  = width;
            Height = height;

            OriginalVFoV = vFoVDegrees;
            OriginalHFoV = (vFoVDegrees / height) * width;

            ArcSecWidth  = Astrometry.DegreeToArcsec(OriginalHFoV) / OriginalWidth;
            ArcSecHeight = Astrometry.DegreeToArcsec(OriginalVFoV) / OriginalHeight;

            CenterCoordinates = centerCoordinates;

            ViewPortCenterPoint = new Point(width / 2, height / 2);

            Shift(new Vector(0, 0));

            horizontalBoundsPadding = Width / 6;
            verticalBoundsPadding   = Height / 6;
        }
Example #5
0
        /// <summary>
        /// Get the selected object in TheSkyX
        /// </summary>
        /// <returns></returns>
        public async Task <DeepSkyObject> GetTarget()
        {
            try {
                string response = await Query("GET_TARGET");

                response = response.TrimEnd('\r', '\n');

                /*
                 * Split the coordinates and object name from the returned message.
                 * GET_TARGET returns 4 fields, space-separated:
                 * RA Dec Name Position_angle
                 *
                 * RA and Dec are in radians. Epoch is J2000.
                 */
                string[] info = response.Split(' ');

                if (!(info[0].Equals("?") || string.IsNullOrEmpty(info[2])))
                {
                    Coordinates newCoordinates = new Coordinates(Astrometry.RadianToHour(double.Parse(info[0].Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture)),
                                                                 Astrometry.ToDegree(double.Parse(info[1].Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture)),
                                                                 Epoch.J2000, Coordinates.RAType.Hours);

                    DeepSkyObject dso = new DeepSkyObject(info[2], newCoordinates, string.Empty);
                    return(dso);
                }
                else
                {
                    throw new PlanetariumObjectNotSelectedException();
                }
            } catch (Exception ex) {
                Logger.Error(ex);
                throw ex;
            }
        }
Example #6
0
        public void ToDegree_ValueTest()
        {
            var rad         = Math.PI;
            var expectedDeg = 180;

            var deg = Astrometry.ToDegree(rad);

            Assert.AreEqual(expectedDeg, deg);
        }
Example #7
0
        public void DegreeToArcmin_ValueTest()
        {
            var degree         = 180;
            var expectedarcmin = 10800;

            var arcmin = Astrometry.DegreeToArcmin(degree);

            Assert.AreEqual(expectedarcmin, arcmin);
        }
Example #8
0
        public void DegreeToArcsec_ValueTest()
        {
            var degree         = 180;
            var expectedarcsec = 648000;

            var arcsec = Astrometry.DegreeToArcsec(degree);

            Assert.AreEqual(expectedarcsec, arcsec);
        }
Example #9
0
        public void ArcsecToArcmin_ValueTest()
        {
            var arcsec         = 150;
            var expectedarcmin = 2.5;

            var arcmin = Astrometry.ArcsecToArcmin(arcsec);

            Assert.AreEqual(expectedarcmin, arcmin);
        }
Example #10
0
        public void DegreesToHours_ValueTest()
        {
            var deg           = 78;
            var expectedhours = 5.2;

            var hours = Astrometry.DegreesToHours(deg);

            Assert.AreEqual(expectedhours, hours);
        }
Example #11
0
        public void ToRadians_ValueTest()
        {
            var degree      = 180;
            var expectedRad = Math.PI;

            var rad = Astrometry.ToRadians(degree);

            Assert.AreEqual(expectedRad, rad);
        }
Example #12
0
        public void HoursToDegree_ValueTest()
        {
            var hours       = 5.2;
            var expecteddeg = 78;

            var deg = Astrometry.HoursToDegrees(hours);

            Assert.AreEqual(expecteddeg, deg);
        }
Example #13
0
        public void ArcsecToDegree_ValueTest()
        {
            var arcsec      = 9000;
            var expecteddeg = 2.5;

            var deg = Astrometry.ArcsecToDegree(arcsec);

            Assert.AreEqual(expecteddeg, deg);
        }
Example #14
0
        public void ArcminToDegree_ValueTest()
        {
            var arcmin      = 150;
            var expecteddeg = 2.5;

            var deg = Astrometry.ArcminToDegree(arcmin);

            Assert.AreEqual(expecteddeg, deg);
        }
Example #15
0
        public void ArcminToArcsec_ValueTest()
        {
            var arcmin         = 20.4;
            var expectedarcsec = 1224;

            var arcsec = Astrometry.ArcminToArcsec(arcmin);

            Assert.AreEqual(expectedarcsec, arcsec);
        }
Example #16
0
        public void Create_RAHoursTest(double ra, double dec)
        {
            var epoch       = Epoch.JNOW;
            var coordinates = new Coordinates(ra, dec, epoch, Coordinates.RAType.Hours);

            Assert.AreEqual(ra, coordinates.RA, 0.0001);
            Assert.AreEqual(Astrometry.HoursToDegrees(ra), coordinates.RADegrees, 0.0001);
            Assert.AreEqual(dec, coordinates.Dec, 0.0001);
            Assert.AreEqual(epoch, coordinates.Epoch);
        }
Example #17
0
        private (double width, double height) GetBoundingBoxOfRotatedRectangle(double rotation, double width, double height)
        {
            if (rotation == 0)
            {
                return(width, height);
            }
            var rot = Astrometry.ToRadians(rotation);

            return(Math.Abs(width * Math.Sin(rot) + height * Math.Cos(rot)), Math.Abs(height * Math.Sin(rot) + width * Math.Cos(rot)));
        }
Example #18
0
        public void CreateByRadiansTest(double inputRadians)
        {
            var angle = Angle.ByRadians(inputRadians);

            var expectedDegree = Astrometry.ToDegree(inputRadians);
            var expectedArcmin = Astrometry.DegreeToArcmin(expectedDegree);
            var expectedArcsec = Astrometry.DegreeToArcsec(expectedDegree);
            var expectedHours  = Astrometry.DegreesToHours(expectedDegree);

            Assert.AreEqual(expectedHours, angle.Hours, TOLERANCE);
            Assert.AreEqual(inputRadians, angle.Radians, TOLERANCE);
            Assert.AreEqual(expectedDegree, angle.Degree, TOLERANCE);
            Assert.AreEqual(expectedArcmin, angle.ArcMinutes, TOLERANCE);
            Assert.AreEqual(expectedArcsec, angle.ArcSeconds, TOLERANCE);
        }
Example #19
0
        private void CalculateTransit(double latitude)
        {
            var    alt0   = Astrometry.GetAltitude(0, latitude, this.Coordinates.Dec);
            var    alt180 = Astrometry.GetAltitude(180, latitude, this.Coordinates.Dec);
            double transit;

            if (alt0 > alt180)
            {
                transit = Astrometry.GetAzimuth(0, alt0, latitude, this.Coordinates.Dec);
            }
            else
            {
                transit = Astrometry.GetAzimuth(180, alt180, latitude, this.Coordinates.Dec);
            }
            DoesTransitSouth = Convert.ToInt32(transit) == 180;
        }
Example #20
0
        private string Deg2str(double deg, int precision)
        {
            if (Math.Abs(deg) > 1)
            {
                return(deg.ToString("N" + precision) + "° (degree)");
            }
            var amin = Astrometry.DegreeToArcmin(deg);

            if (Math.Abs(amin) > 1)
            {
                return(amin.ToString("N" + precision) + "' (arcmin)");
            }
            var asec = Astrometry.DegreeToArcsec(deg);

            return(asec.ToString("N" + precision) + "'' (arcsec)");
        }
Example #21
0
        /// <summary>
        /// Get the selected object in CdC
        /// </summary>
        /// <returns></returns>
        public async Task <DeepSkyObject> GetTarget()
        {
            try {
                var response = await Query("GETSELECTEDOBJECT");

                if (!response.StartsWith("OK!"))
                {
                    throw new PlanetariumObjectNotSelectedException();
                }

                var columns = response.Split('\t');

                // An "OK!" response with fewer than 2 columns means that CdC is listening ok but the user has not selected an object.
                if (columns.Count() < 2)
                {
                    throw new PlanetariumObjectNotSelectedException();
                }

                if (!Match(columns[0].Replace("OK!", ""), @"(([0-9]{1,2})([h|:]|[?]{2})([0-9]{1,2})([m|:]|[?]{2})?([0-9]{1,2}(?:\.[0-9]+){0,1})?([s|:]|[?]{2}))", out var raString))
                {
                    throw new PlanetariumObjectNotSelectedException();
                }
                var ra = Astrometry.HMSToDegrees(raString);

                if (!Match(columns[1], @"([\+|-]([0-9]{1,2})([d|°|:]|[?]{2})([0-9]{1,2})([m|'|:]|[?]{2})?([0-9]{1,2}(?:\.[0-9]+){0,1})?([s|""|:]|[?]{2}))", out var decString))
                {
                    throw new PlanetariumObjectNotSelectedException();
                }
                var dec = Astrometry.DMSToDegrees(decString);

                if (!Match(columns.Last(), @"(?<=Equinox:).*", out var equinox))
                {
                    throw new PlanetariumObjectNotSelectedException();
                }
                equinox = equinox.Replace("\r", "").Replace("\n", "");

                var coordinates = new Coordinates(Angle.ByDegree(ra), Angle.ByDegree(dec), equinox.ToLower() == "now" ? Epoch.JNOW : Epoch.J2000);

                var dso = new DeepSkyObject(columns[3].Trim(), coordinates.Transform(Epoch.J2000), string.Empty);

                return(dso);
            } catch (Exception ex) {
                Logger.Error(ex);
                throw ex;
            }
        }
Example #22
0
        public void OperatorMultiplyDoubleTest(double firstDegree, double secondDegree)
        {
            var secondAngle = Angle.ByDegree(secondDegree);

            var angle = Astrometry.ToRadians(firstDegree) * secondAngle;

            var expectedRadian = Astrometry.ToRadians(firstDegree) * Astrometry.ToRadians(secondDegree);
            var expectedDegree = Astrometry.ToDegree(expectedRadian);
            var expectedArcmin = Astrometry.DegreeToArcmin(expectedDegree);
            var expectedArcsec = Astrometry.DegreeToArcsec(expectedDegree);
            var expectedHours  = Astrometry.DegreesToHours(expectedDegree);

            Assert.AreEqual(expectedDegree, angle.Degree, TOLERANCE);
            Assert.AreEqual(expectedArcmin, angle.ArcMinutes, TOLERANCE);
            Assert.AreEqual(expectedArcsec, angle.ArcSeconds, TOLERANCE);
            Assert.AreEqual(expectedHours, angle.Hours, TOLERANCE);
            Assert.AreEqual(expectedRadian, angle.Radians, TOLERANCE);
        }
Example #23
0
        public void StaticAtan2Test(double xRadians, double yRadians)
        {
            var xAngle = Angle.ByRadians(xRadians);
            var yAngle = Angle.ByRadians(yRadians);
            var angle  = Angle.Atan2(yAngle, xAngle);

            var rad            = Math.Atan2(yRadians, xRadians);
            var expectedDegree = Astrometry.ToDegree(rad);
            var expectedArcmin = Astrometry.DegreeToArcmin(expectedDegree);
            var expectedArcsec = Astrometry.DegreeToArcsec(expectedDegree);
            var expectedHours  = Astrometry.DegreesToHours(expectedDegree);

            Assert.AreEqual(expectedHours, angle.Hours, TOLERANCE);
            Assert.AreEqual(rad, angle.Radians, TOLERANCE);
            Assert.AreEqual(expectedDegree, angle.Degree, TOLERANCE);
            Assert.AreEqual(expectedArcmin, angle.ArcMinutes, TOLERANCE);
            Assert.AreEqual(expectedArcsec, angle.ArcSeconds, TOLERANCE);
        }
Example #24
0
        /// <summary>
        /// Gets start arguments for Platesolve2 out of RA,Dec, ArcDegWidth, ArcDegHeight and ImageFilePath
        /// </summary>
        /// <returns></returns>
        protected override string GetArguments(
            string imageFilePath,
            string outputFilePath,
            PlateSolveParameter parameter,
            PlateSolveImageProperties imageProperties)
        {
            var args = new string[] {
                Astrometry.ToRadians(parameter.Coordinates.RADegrees).ToString(CultureInfo.InvariantCulture),
                Astrometry.ToRadians(parameter.Coordinates.Dec).ToString(CultureInfo.InvariantCulture),
                Astrometry.ToRadians(imageProperties.FoVW).ToString(CultureInfo.InvariantCulture),
                Astrometry.ToRadians(imageProperties.FoVH).ToString(CultureInfo.InvariantCulture),
                parameter.Regions.ToString(),
                imageFilePath,
                "0"
            };

            return(string.Join(",", args));
        }
Example #25
0
        private void DrawRALineCollection(Graphics g, FrameLine frameLine)
        {
            if (frameLine.Collection.Count > 1)
            {
                //Prevent annotations to overlap on southern pole
                var    southPole = new Coordinates(0, -MAXDEC, Epoch.J2000, Coordinates.RAType.Degrees).XYProjection(currentViewport);
                PointF?position  = frameLine.Collection.FirstOrDefault(x => x.X > 0 && x.Y > 0 && x.X < currentViewport.Width && x.Y < currentViewport.Height && Math.Abs(x.X - southPole.X) > 5 && Math.Abs(x.Y - southPole.Y) > 5);

                if (position != null)
                {
                    var hms  = Astrometry.HoursToHMS(frameLine.Angle.Hours);
                    var text = $"{hms.Substring(0, hms.Length - 3)}h";
                    var size = g.MeasureString(text, gridAnnotationFont);
                    g.DrawString(text, gridAnnotationFont, gridAnnotationBrush, (position.Value.X), Math.Max(0, (position.Value.Y - size.Height)));
                }

                DrawFrameLineCollection(g, frameLine);
            }
        }
Example #26
0
        private void CalculateAltitude()
        {
            var start = this._referenceDate;

            Altitudes.Clear();
            var siderealTime = Astrometry.GetLocalSiderealTime(start, _longitude);
            var hourAngle    = Astrometry.GetHourAngle(siderealTime, this.Coordinates.RA);

            for (double angle = hourAngle; angle < hourAngle + 24; angle += 0.1)
            {
                var degAngle = Astrometry.HoursToDegrees(angle);
                var altitude = Astrometry.GetAltitude(degAngle, _latitude, this.Coordinates.Dec);
                Altitudes.Add(new DataPoint(DateTimeAxis.ToDouble(start), altitude));
                start = start.AddHours(0.1);
            }

            MaxAltitude = Altitudes.OrderByDescending((x) => x.Y).FirstOrDefault();

            CalculateTransit(_latitude);
        }
Example #27
0
        /// <summary>
        /// Return the configured user location from HNSKY
        /// </summary>
        /// <returns></returns>
        public async Task <Coords> GetSite()
        {
            try {
                var response = await Query("GET_LOCATION");

                response = response.TrimEnd('\r', '\n');

                /*
                 * Split the latitude and longitude from the returned message.
                 * GET_LOCATION returns 3 fields, space-separated:
                 * Latitude Longitude Julian_Date
                 *
                 * Latitude and Logitude are in radians.
                 */
                var info = response.Split(' ');

                if (!(info[0].Equals("?") || string.IsNullOrEmpty(info[1])))
                {
                    /*
                     * East is negative and West is positive in HNSKY.
                     * We must flip longitude's sign here.
                     */
                    var loc = new Coords {
                        Latitude  = Astrometry.ToDegree(double.Parse(info[1].Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture)),
                        Longitude = Astrometry.ToDegree(double.Parse(info[0].Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture)) * -1,
                        Elevation = 0
                    };

                    return(loc);
                }
                else
                {
                    throw new PlanetariumFailedToGetCoordinates();
                }
            } catch (Exception ex) {
                Logger.Error(ex);
                throw ex;
            }
        }
Example #28
0
        public async Task <Coords> GetSite()
        {
            try {
                var response = await Query("GETOBS");

                if (!response.StartsWith("OK!"))
                {
                    throw new PlanetariumFailedToGetCoordinates();
                }

                if (!Match(response, @"(?<=LAT:)[\+|-]([0-9]{1,2})[:|d]([0-9]{1,2})[:|m]?([0-9]{1,2}(?:\.[0-9]+){0,1})?[:|s]", out var latutideString))
                {
                    throw new PlanetariumFailedToGetCoordinates();
                }

                if (!Match(response, @"(?<=LON:)[\+|-]([0-9]{1,3})[:|d]([0-9]{1,2})[:|m]?([0-9]{1,2}(?:\.[0-9]+){0,1})?[:|s]", out var longitudeString))
                {
                    throw new PlanetariumFailedToGetCoordinates();
                }

                if (!Match(response, @"(?<=ALT:)([0-9]{0,5})[m]", out var altitudeString))
                {
                    throw new PlanetariumFailedToGetCoordinates();
                }

                var coords = new Coords {
                    Latitude  = Astrometry.DMSToDegrees(latutideString),
                    Longitude = -Astrometry.DMSToDegrees(longitudeString),
                    Elevation = Astrometry.DMSToDegrees(altitudeString)
                };

                return(coords);
            } catch (Exception ex) {
                Logger.Error(ex);
                throw ex;
            }
        }
Example #29
0
        public void FITSTargetMetaDataPopulated()
        {
            var now      = DateTime.Now;
            var metaData = new ImageMetaData();

            metaData.Target.Name        = "TEST";
            metaData.Target.Coordinates = new NINA.Utility.Astrometry.Coordinates(Angle.ByHours(2.125), Angle.ByDegree(10.154), Epoch.J2000);

            var expectedHeaderCards = new List <FITSHeaderCard>()
            {
                new FITSHeaderCard("OBJECT", metaData.Target.Name, "Name of the object of interest"),
                new FITSHeaderCard("OBJCTRA", Astrometry.HoursToFitsHMS(metaData.Target.Coordinates.RA), "[H M S] RA of imaged object"),
                new FITSHeaderCard("OBJCTDEC", Astrometry.DegreesToFitsDMS(metaData.Target.Coordinates.Dec), "[D M S] Declination of imaged object"),
            };

            var sut = new FITS(new ushort[] { 1, 2 }, 1, 1);

            sut.PopulateHeaderCards(metaData);

            foreach (var expectedCard in expectedHeaderCards)
            {
                sut.Header.HeaderCards.First(x => x.Key == expectedCard.Key).Should().BeEquivalentTo(expectedCard);
            }
        }
Example #30
0
        /// <summary>
        /// Extract result out of generated .axy file. File consists of three rows
        /// 1. row: RA,Dec,Code
        /// 2. row: Scale,Orientation,?,?,Stars
        /// </summary>
        /// <returns>PlateSolveResult</returns>
        protected override PlateSolveResult ReadResult(
            string outputFilePath,
            PlateSolveParameter parameter,
            PlateSolveImageProperties imageProperties)
        {
            PlateSolveResult result = new PlateSolveResult()
            {
                Success = false
            };

            if (File.Exists(outputFilePath))
            {
                using (var s = new StreamReader(outputFilePath)) {
                    string line;
                    int    linenr = 0;
                    while ((line = s.ReadLine()) != null)
                    {
                        string[] resultArr = line.Split(',');
                        if (linenr == 0)
                        {
                            if (resultArr.Length > 2)
                            {
                                double ra, dec;
                                int    status;
                                if (resultArr.Length == 5)
                                {
                                    /* workaround for when decimal separator is comma instead of point.
                                     * won't work when result contains even numbers tho... */
                                    status = int.Parse(resultArr[4]);
                                    if (status != 1)
                                    {
                                        /* error */
                                        result.Success = false;
                                        break;
                                    }

                                    ra  = double.Parse(resultArr[0] + "." + resultArr[1], CultureInfo.InvariantCulture);
                                    dec = double.Parse(resultArr[2] + "." + resultArr[3], CultureInfo.InvariantCulture);
                                }
                                else
                                {
                                    status = int.Parse(resultArr[2]);
                                    if (status != 1)
                                    {
                                        /* error */
                                        result.Success = false;
                                        break;
                                    }

                                    ra  = double.Parse(resultArr[0], CultureInfo.InvariantCulture);
                                    dec = double.Parse(resultArr[1], CultureInfo.InvariantCulture);
                                }

                                /* success */
                                result.Success     = true;
                                result.Coordinates = new Coordinates(Astrometry.ToDegree(ra), Astrometry.ToDegree(dec), Epoch.J2000, Coordinates.RAType.Degrees);
                            }
                        }
                        if (linenr == 1)
                        {
                            if (resultArr.Length > 2)
                            {
                                if (resultArr.Length > 5)
                                {
                                    /* workaround for when decimal separator is comma instead of point.
                                     * won't work when result contains even numbers tho... */
                                    result.Pixscale    = double.Parse(resultArr[0] + "." + resultArr[1], CultureInfo.InvariantCulture);
                                    result.Orientation = double.Parse(resultArr[2] + "." + resultArr[3], CultureInfo.InvariantCulture);

                                    result.Flipped = !(double.Parse(resultArr[4] + "." + resultArr[5], CultureInfo.InvariantCulture) < 0);
                                    if (result.Flipped)
                                    {
                                        result.Orientation = result.Orientation - 180;
                                    }
                                }
                                else
                                {
                                    result.Pixscale    = double.Parse(resultArr[0], CultureInfo.InvariantCulture);
                                    result.Orientation = double.Parse(resultArr[1], CultureInfo.InvariantCulture);

                                    result.Flipped = !(double.Parse(resultArr[2], CultureInfo.InvariantCulture) < 0);
                                    if (result.Flipped)
                                    {
                                        result.Orientation = result.Orientation - 180;
                                    }
                                }
                            }
                        }
                        linenr++;
                    }
                }
            }
            return(result);
        }