Exemplo n.º 1
0
 public List<IStar> GetStarsInRegion(double raDeg, double deDeg, double diameterDeg, double limitMag, float epoch)
 {
     if (m_Settings.Catalog == TangraConfig.StarCatalog.UCAC2)
     {
         UCAC2Catalogue cat = new UCAC2Catalogue(m_Settings.CatalogLocation);
         List<IStar> ucac2Stars = cat.GetStarsInRegion(raDeg, deDeg, diameterDeg, limitMag, epoch);
         return (List<IStar>)ucac2Stars;
     }
     else if (m_Settings.Catalog == TangraConfig.StarCatalog.UCAC3)
     {
         UCAC3Catalogue cat = new UCAC3Catalogue(m_Settings.CatalogLocation);
         List<IStar> ucac3Stars = cat.GetStarsInRegion(raDeg, deDeg, diameterDeg, limitMag, epoch);
         return (List<IStar>)ucac3Stars;
     }
     else if (m_Settings.Catalog == TangraConfig.StarCatalog.NOMAD)
     {
         NOMADCatalogue cat = new NOMADCatalogue(m_Settings.CatalogLocation);
         List<IStar> nomadStars = cat.GetStarsInRegion(raDeg, deDeg, diameterDeg, limitMag, epoch);
         return (List<IStar>)nomadStars;
     }
     else if (m_Settings.Catalog == TangraConfig.StarCatalog.PPMXL)
     {
         PPMXLCatalogue cat = new PPMXLCatalogue(m_Settings.CatalogLocation);
         List<IStar> ppmxlStars = cat.GetStarsInRegion(raDeg, deDeg, diameterDeg, limitMag, epoch);
         return (List<IStar>)ppmxlStars;
     }
     else if (m_Settings.Catalog == TangraConfig.StarCatalog.UCAC4)
     {
         UCAC4Catalogue cat = new UCAC4Catalogue(m_Settings.CatalogLocation);
         List<IStar> ucac4Stars = cat.GetStarsInRegion(raDeg, deDeg, diameterDeg, limitMag, epoch);
         return (List<IStar>)ucac4Stars;
     }
     return null;
 }
Exemplo n.º 2
0
        private void miCalculateCalSpecMagnitudes_Click(object sender, EventArgs e)
        {
            var ucac4 = new UCAC4Catalogue(@"D:\Hristo\UCAC4\u4b");
            foreach (CalSpecStar star in CalSpecDatabase.Instance.Stars)
            {
                var starsInRegion = ucac4.GetStarsInRegion(star.RA_J2000_Hours * 15, star.DE_J2000_Deg, 0.5, 20, 2000);
                var ucac4Star = starsInRegion.FirstOrDefault(x => x.GetStarDesignation(0).Replace("-0", "-") == star.U4) as UCAC4Entry;
                if (ucac4Star != null)
                {
                    if (!double.IsNaN(ucac4Star.MagV))
                    {
                        star.MagV = ucac4Star.MagV;
                        if (!double.IsNaN(ucac4Star.MagB))
                            star.MagBV = star.MagB - star.MagV;
                    }

                    if (!double.IsNaN(ucac4Star.MagB))
                        star.MagB = ucac4Star.MagB;
                    else
                        star.MagB = star.MagBV + star.MagV;

                    star.MagR = ucac4Star.MagR;
                    star.Mag_g = ucac4Star.Mag_g;
                    star.Mag_r = ucac4Star.Mag_r;
                    star.Mag_i = ucac4Star.Mag_i;
                }

                Trace.WriteLine(string.Format("{0}: {1} {2} {3} {4} {5} {6}", star.CalSpecStarId,
                    star.MagB.ToString("0.000"), star.MagV.ToString("0.000"), star.MagR.ToString("0.000"),
                    star.Mag_g.ToString("0.000"), star.Mag_r.ToString("0.000"), star.Mag_i.ToString("0.000")));
            }

            using (var compressedStream = new FileStream(@"D:\Hristo\Tangra3\Tangra 3\VideoOperations\Spectroscopy\AbsFluxCalibration\Standards\CalSpec_wMags.db", FileMode.CreateNew, FileAccess.Write))
            using (var deflateStream = new DeflateStream(compressedStream, CompressionMode.Compress, true))
            {
                using (var writer = new BinaryWriter(deflateStream))
                {
                    CalSpecDatabase.Instance.Serialize(writer);
                }
            }
        }