I've had this idea since the ImageSolver and AnnotateImage were first provided by Andres - to use them to locate white balance stars for ColorCalibration. Last night I woke at 4am and couldn't get back to sleep, and for some reason it seemed like a good time to teach myself JavaScript, how to use the Vizier catalog search features, how to use star spectral information for white balance, and to hack AnnotateImage to give me something I wanted. By 8am I came up with this and for the most part, it seems to work. I am not a programmer and do not know much about JS, but I do have a bit of experience with scripting and programming - more hacking others code than writing my own.
At first I was thinking that I'd like to be able to label all G2V stars. A simple way didn't occur to me at that time of the morning, but I did recall reading about another method of white balance using B-V magnitudes. I discovered that the NOMAD1 catalog has the appropriate information. Based on
this PDF article on B-V colour calibration, I learned that G2 stars have a constant B-V magnitude of 0.65. The article also talks about V-R magnitudes of 0.36 as well, although that's less relevant for some reason I don't understand yet. He goes through a method using Aladin, and uses the NOMAD1 catalog to filter out just stars with B-V in an "acceptable" range of 0.6 to 0.7, and R-V of 0.2 to 0.6.
In looking through the data that NOMAD1 output, I see there is a column available called "recommended". I assumed, and please correct me if I'm wrong, that these entries are the best ones to use. I noted they seem to all have the applicable filter data for B, V, and R. I understand that NOMAD1 is not supposed to be super-accurate, while SDSS is but covers less of the sky?
So I went into Andres' AstronomicalCatalogs.jsh file to see how he was getting the Hipparcos star information, copied that section to the end of the file, and started changing it to try to get the relevant information from the NOMAD1 catalog. Below is what I added to the end of the above file. So you add this to the end of the AstronomicalCatalogs.jsh file, save it, then run AnnotateImage on your solved file. Add "B-V WB Catalog" which should now appear in your list of catalogs available. I disable all the other annotations, just leaving this one ticked. So when you click OK, what should show up are the stars in the NOMAD1 catalog that have pretty close spectra to G2 stars. The label "name" is identical to the NOMAD1 ID. The idea would be to add a preview to one of those stars that is unsaturated, then copy that preview to your RGB image to use as the white balance reference for ColorCalibration.
I did notice something odd with the output. If I don't enter any values in the magnitude filter, I get stars being annotated. With my sample image, I then tried filtering a magnitude range, and added 1 as min and 10 as max. 2 stars showed up, but interestingly these 2 stars were not in the unfiltered output. So I need to get to the bottom of that. Perhaps someone more knowledgeable than I can see the flaw in my script?
Anyway, here's my snippet. Please feel free to comment, critique, improve, and add to the main script. I hope someone else finds it as useful as I hope it can be.
// ******************************************************************
// B-V White Balance Stars from NOMAD1
// ******************************************************************
// hacked by Troy Piggins from the Hipparcos function above
function BVCatalog()
{
this.name="B-V WB Catalog";
this.description = "Displays only stars within B-V range for white balance use";
this.__base__ = VizierCatalog;
this.__base__( this.name );
this.catalogMagnitude = 14;
this.fields = [ "Name", "V mag", "B-V mag", "V-R mag" ];
this.properties.push( ["magMin", DataType_Double] );
this.properties.push( ["magMax", DataType_Double] );
this.GetConstructor = function()
{
return "new BVCatalog()";
}
this.UrlBuilder = function(metadata, mirrorServer)
{
var fieldOfView=Math.max(metadata.width,metadata.height)*metadata.resolution;
var url=mirrorServer+"viz-bin/asu-tsv?-source=I/297&-c=" +
format("%f %f",metadata.ra,metadata.dec) +
"&-c.eq=J2000&-c.r=" + format("%f",fieldOfView) +
"&-c.u=deg&-out.form=|"+
"&-out.add=_RAJ,_DEJ&-out=NOMAD1&-out=Vmag&-out=Bmag&-out=Rmag&-out=pmRA&-out=pmDE&-out=R" +
this.CreateMagFilter( "Vmag", this.magMin, this.magMax ) ;
return url;
}
this.ParseRecord = function( tokens, epoch )
{
if( tokens.length>=8 && parseFloat(tokens[0])>0 )
{
// Only use NOMAD1 "recommended" stars. They appear to have all 3 B, V, and R
// filters.
var recommended = tokens[8].trim();
// Calculate B-V
var BV = +tokens[4].trim()-+tokens[3].trim();
// Calculate V-R
var VR = +tokens[3].trim()-+tokens[5].trim();
// Set acceptable ranges
var BVmin = 0.6;
var BVmax = 0.7;
var VRmin = 0.2;
var VRmax = 0.6;
// Filter out the stars we don't want
if( recommended.search("R") !=-1 && BVmin <= BV && BV <= BVmax && VRmin <= VR && VR <= VRmax)
{
var x = parseFloat( tokens[0] );
var y = parseFloat( tokens[1] );
if( !(x>=0 && x<=360 && y>=-90 && y<=90) )
return null;
if( epoch!=null )
{
var pmX = parseFloat( tokens[6] );
var pmY = parseFloat( tokens[7] );
var dx = pmX*(epoch-2000)/3600000 * Math.cos( y*Math.PI/180 );
var dy = pmY*(epoch-2000)/3600000;
x += dx;
y += dy;
}
var name = tokens[2].trim();
var record = new CatalogRecord( new Point( x, y ), 0, name, parseFloat( tokens[3] ) );
record["V mag"]=tokens[3].trim();
record["B-V mag"]=BV+"";
record["V-R mag"]=VR+"";
return record;
} else
return null;
} else
return null;
}
}
BVCatalog.prototype = new VizierCatalog;
__catalogRegister__.push( (new BVCatalog).GetConstructor() );