예제 #1
0
        public virtual Task <CommandValues.UserInformationCommandValue> ExecuteAsync(UserInformation apiSettings, IConfiguration iconfig, CancellationToken ct = default(CancellationToken))
        {
            CLILogs.Debug("print Account info");

            CommandValues.UserInformationCommandValue objToPrint = InfoObj.CreateObj(apiSettings) as CommandValues.UserInformationCommandValue;
            objToPrint.AccountInformation["Email"]               = apiSettings.Email;
            objToPrint.AccountInformation["MaxInstances"]        = apiSettings.MaxInstances.ToString();
            objToPrint.AccountInformation["Quota Bucket Number"] = apiSettings.BucketCount.ToString() + "/" + apiSettings.MaxBucket.ToString();
            if (iconfig.HumanReadable)
            {
                objToPrint.AccountInformation["Quota Bytes Bucket"] = BytesFormat.ConvertToHumanReadable(apiSettings.UsedQuotaBytesBucket) + "/" + BytesFormat.ConvertToHumanReadable(apiSettings.QuotaBytesBucket);
            }
            else
            {
                objToPrint.AccountInformation["Quota Bytes Bucket"] = apiSettings.UsedQuotaBytesBucket.ToString() + "/" + apiSettings.QuotaBytesBucket.ToString();
            }
            objToPrint.AccountInformation["Quota Task Count"]        = apiSettings.TaskCount.ToString() + "/" + apiSettings.MaxTask.ToString();
            objToPrint.AccountInformation["Quota Running Task"]      = apiSettings.RunningTaskCount.ToString() + "/" + apiSettings.MaxRunningTask.ToString();
            objToPrint.AccountInformation["Quota Total Pool"]        = apiSettings.PoolCount.ToString() + "/" + apiSettings.MaxPool.ToString();
            objToPrint.AccountInformation["Quota Running Pool"]      = apiSettings.RunningPoolCount.ToString() + "/" + apiSettings.MaxRunningPool.ToString();
            objToPrint.AccountInformation["Quota Running Instances"] = apiSettings.RunningInstanceCount.ToString() + "/" + apiSettings.MaxInstances.ToString();
            objToPrint.AccountInformation["Quota Running Cores"]     = apiSettings.RunningCoreCount.ToString();

            return(Task.FromResult(objToPrint));
        }
예제 #2
0
        private static InfoObj[] GetNearbyStars(sky6StarChart tsxsc, int xC, int yC)
        {
            sky6ObjectInformation tsxod = new sky6ObjectInformation();

            tsxsc.ClickFind(xC, yC);
            int objcnt = tsxod.Count;

            InfoObj[] infoObj = new InfoObj[objcnt];
            for (int i = 0; i < objcnt; i++)
            {
                tsxod.Index = i;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
                infoObj[i].CatalogedName = tsxod.ObjInfoPropOut;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_MAG);
                infoObj[i].CatalogMag = tsxod.ObjInfoPropOut;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
                infoObj[i].CatalogRA = tsxod.ObjInfoPropOut;
                tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
                infoObj[i].CatalogDec = tsxod.ObjInfoPropOut;
                if (infoObj[i].CatalogedName.Contains("Gaia"))
                {
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_1); //FIlter G
                    infoObj[i].CatalogMagG = Convert.ToDouble(tsxod.ObjInfoPropOut);
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_2); //Filter PB
                    infoObj[i].CatalogMagB = Convert.ToDouble(tsxod.ObjInfoPropOut);
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_3); //Filter PR
                    infoObj[i].CatalogMagR = Convert.ToDouble(tsxod.ObjInfoPropOut);
                }
                else if (infoObj[i].CatalogedName.Contains("APASS"))
                {
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_STAR_MAGB);
                    infoObj[i].CatalogMagB = tsxod.ObjInfoPropOut;
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_STAR_MAGV);
                    infoObj[i].CatalogMagV = tsxod.ObjInfoPropOut;
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_STAR_MAGR);
                    infoObj[i].CatalogMagR = tsxod.ObjInfoPropOut;
                    tsxod.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DB_FIELD_4);
                    char[] s = new char[] { ' ' };
                    infoObj[i].CatalogMagG = Convert.ToDouble(tsxod.ObjInfoPropOut.Split(s, StringSplitOptions.RemoveEmptyEntries)[0]);
                }
            }
            return(infoObj);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lightSource"></param>
        /// <returns>TargetData[0] => APASS star
        /// TargetData[1] => GAIA star</returns>
        public static TargetData AcquireNearestQualifiedStar(TargetData lightSource)
        {
            //Find the nearest APASS star and the nearest GAIA star
            //
            const string GAIACatalogName   = "Gaia";
            const string APASSCatalogName  = "APASS";
            const string GCVSCatalogPrefix = "GCVS";

            InfoObj gaiaCatData  = new InfoObj();
            InfoObj apassCatData = new InfoObj();

            //Populate target data with catalog data, if found
            sky6StarChart tsxsc = new sky6StarChart();
            sky6Utils     tsxut = new sky6Utils();

            //Ultimately, we want to center the star chart on the FOV of the image,
            //  but not resize the chart
            tsxsc.EquatorialToStarChartXY(lightSource.SourceRA, lightSource.SourceDec);
            int xC = (int)tsxsc.dOut0;
            int yC = (int)tsxsc.dOut1;

            InfoObj[] catStarList = GetNearbyStars(tsxsc, xC, yC);
            //First, find the nearest star to the light source in the list from the catalog
            //Initialize a catalog info object with the first found star from a catalog
            gaiaCatData.CatalogSeparation  = 1000;
            apassCatData.CatalogSeparation = 1000;
            double separation;

            //Now find an APASS star that is closest, or default to the initial one
            // go through the catalog list of stars.
            foreach (InfoObj iob in catStarList)
            {
                //Disqualify any light source with a GCVS star nearby
                if (iob.CatalogedName.Contains(GCVSCatalogPrefix))
                {
                    lightSource.IsGCVSCataloged = true;
                }

                tsxut.ComputeAngularSeparation(lightSource.SourceRA, lightSource.SourceDec, iob.CatalogRA, iob.CatalogDec);
                separation = (double)tsxut.dOut0 * 3600.0;
                if (separation < apassCatData.CatalogSeparation & iob.CatalogedName.Contains(APASSCatalogName))
                {
                    apassCatData.CatalogedName     = iob.CatalogedName;
                    apassCatData.CatalogRA         = iob.CatalogRA;
                    apassCatData.CatalogDec        = iob.CatalogDec;
                    apassCatData.CatalogMag        = iob.CatalogMag;
                    apassCatData.CatalogMagB       = iob.CatalogMagB;
                    apassCatData.CatalogMagV       = iob.CatalogMagV;
                    apassCatData.CatalogMagR       = iob.CatalogMagR;
                    apassCatData.CatalogMagG       = iob.CatalogMagG;
                    apassCatData.CatalogSeparation = separation;
                }
                if (separation < gaiaCatData.CatalogSeparation & iob.CatalogedName.Contains(GAIACatalogName))
                {
                    gaiaCatData.CatalogedName     = iob.CatalogedName;
                    gaiaCatData.CatalogRA         = iob.CatalogRA;
                    gaiaCatData.CatalogDec        = iob.CatalogDec;
                    gaiaCatData.CatalogMag        = iob.CatalogMag;
                    gaiaCatData.CatalogMagB       = iob.CatalogMagB;
                    gaiaCatData.CatalogMagG       = iob.CatalogMagG;
                    gaiaCatData.CatalogMagR       = iob.CatalogMagR;
                    gaiaCatData.CatalogSeparation = separation;
                }
                //check for APASS entry and hold again if so and separation is smaller than thelast
            }
            lightSource.APASSCatalogName                  = apassCatData.CatalogedName;
            lightSource.APASSCatalogMagnitude             = apassCatData.CatalogMag;
            lightSource.APASSCatalogMagnitudeB            = apassCatData.CatalogMagB;
            lightSource.APASSCatalogMagnitudeV            = apassCatData.CatalogMagV;
            lightSource.APASSCatalogMagnitudeR            = apassCatData.CatalogMagR;
            lightSource.APASSCatalogMagnitudeG            = apassCatData.CatalogMagG;
            lightSource.APASSCatalogRA                    = apassCatData.CatalogRA;
            lightSource.APASSCatalogDec                   = apassCatData.CatalogDec;
            lightSource.SourceToAPASSCatalogPositionError = apassCatData.CatalogSeparation;
            tsxut.ComputeAngularSeparation(lightSource.TargetRA, lightSource.TargetDec, lightSource.APASSCatalogRA, lightSource.APASSCatalogDec);
            lightSource.TargetToAPASSCatalogPositionError = (double)tsxut.dOut0 * 3600.0;

            lightSource.GAIACatalogName                  = gaiaCatData.CatalogedName;
            lightSource.GAIACatalogMagnitude             = gaiaCatData.CatalogMag;
            lightSource.GAIACatalogMagnitudeB            = gaiaCatData.CatalogMagB;
            lightSource.GAIACatalogMagnitudeG            = gaiaCatData.CatalogMagG;
            lightSource.GAIACatalogMagnitudeR            = gaiaCatData.CatalogMagR;
            lightSource.GAIACatalogRA                    = gaiaCatData.CatalogRA;
            lightSource.GAIACatalogDec                   = gaiaCatData.CatalogDec;
            lightSource.SourceToGAIACatalogPositionError = gaiaCatData.CatalogSeparation;
            tsxut.ComputeAngularSeparation(lightSource.TargetRA, lightSource.TargetDec, lightSource.GAIACatalogRA, lightSource.GAIACatalogDec);
            lightSource.TargetToGAIACatalogPositionError = (double)tsxut.dOut0 * 3600.0;

            if (lightSource.APASSCatalogName != null)
            {
                string catPrefix = lightSource.APASSCatalogName.Split(' ')[0];
                lightSource.APASSCatalogName = Utility.CreateStarLabel("APASS ", lightSource.APASSCatalogRA, lightSource.APASSCatalogDec);
                lightSource.IsAPASSCataloged = true;
            }
            else
            {
                lightSource.IsAPASSCataloged = false;
            }

            if (lightSource.GAIACatalogName != null)
            {
                lightSource.GAIACatalogName = Utility.CreateStarLabel("Gaia ", lightSource.GAIACatalogRA, lightSource.GAIACatalogDec);
                lightSource.IsGAIACataloged = true;
            }
            else
            {
                lightSource.IsGAIACataloged = false;
            }

            return(lightSource);
        }