private TargetData SearchForLightSourceInventory(ccdsoftImage tsximg, TargetData lightSource) { sky6Utils tsxu = new sky6Utils(); double ra = lightSource.TargetRA; double dec = lightSource.TargetDec; double rDelta = 1000; double rmsDelta; int sIndex = -1; for (int iSource = 0; iSource < XPosArr.Length; iSource++) { tsximg.XYToRADec((double)XPosArr[iSource], (double)YPosArr[iSource]); double raSrc = tsximg.XYToRADecResultRA(); double decSrc = tsximg.XYToRADecResultDec();; tsxu.ComputeAngularSeparation(ra, dec, raSrc, decSrc); rmsDelta = tsxu.dOut0; if (rmsDelta <= rDelta) { rDelta = rmsDelta; sIndex = iSource; lightSource.InventoryArrayIndex = sIndex; lightSource.TargetToSourcePositionError = rDelta * 3600.0; lightSource.SourceRA = raSrc; lightSource.SourceDec = decSrc; lightSource.SourceUncorrectedMagnitude = (double)MagArr[sIndex]; lightSource.SourceX = (double)XPosArr[sIndex]; lightSource.SourceY = (double)YPosArr[sIndex]; } } return(lightSource); }
private double ComputeDistance(double ra1, double dec1, double ra2, double dec2) //Computes the angular distance between two polar coordinates using TSX utility function // { sky6Utils tsx_ut = new sky6Utils(); tsx_ut.ComputeAngularSeparation(ra1, dec1, ra2, dec2); double dist = tsx_ut.dOut0; return(dist); }
/// <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); }
static DBQStar FindStar(double gIsolation) { /* Locates a nearby star for running a guider calibration * * Generate and observing list from the AtFocus database search near the current location * (sometime in the future, cull this list for stars on the wrong side of the meridian. * Get the calibration distances (arc min for now) to use for framing * Look through the observing list array for a star isolated from it's neighbors by at least * twice the calibration distance. This means that once the FOV is centered on this ster, * you can move the mount at least the calibration distance without the other star coming into * the FOV. */ //Find the first star that is isolated from all the other stars on the list // and from the edge of the search area. Note that the search area is in degrees and // centered on the star chart center. // The star position <-> center position <= search radius - isolation radius. // sky6StarChart tsxsc = new sky6StarChart(); double gMaxRadius = (searchAreaDeg * 60) - gIsolation; //arc mins double scRA = tsxsc.RightAscension; double scDec = tsxsc.Declination; sky6Utils tsxut = new sky6Utils(); //Loop through all the stars in the prospect list // For each star, loop through from that star forward to see if any other star is // within gMinRadius of the center of the star chart // if so, then look through the rest of the list for any star within the gisolation // distance. // // Eventually, need to check for meridian side as well // // if not, then that's our star int gStarIdx = 0; double gStarRadius; double gRA; double gDec; StarProspects starList = new StarProspects(searchAreaDeg); for (int i = 0; i < starList.Count; i++) { gStarIdx = i; gRA = starList.StarRA(i); gDec = starList.StarDec(i); tsxut.ComputeAngularSeparation(scRA, scDec, gRA, gDec); gStarRadius = tsxut.dOut0 * 60; if (gStarRadius < gMaxRadius) { for (int j = i + 1; j < starList.Count; j++) { tsxut.ComputeAngularSeparation(starList.StarRA(j), starList.StarDec(j), gRA, gDec); if ((tsxut.dOut0 * 60) < gIsolation) { break; } if (j == starList.Count - 1) { return(starList.Star(gStarIdx)); } } } } return(null); }