Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Virgil, NY
    Posts
    5,755

    Default UserActions ImageEnd() function for converting JD-->HJD

    Here's a javascript code block you can put into the ImageEnd() function of UserActions.wsc that will add two additional keywords and values to the FITS header of each image: the geocentric JD of the midpoint of the exposure, and the heliocentric JD (with respect to UTC) of the midpoint of the exposure. This does not compute the barycentric JD.

    I've used this algorithm for many years outside of ACP. The computation has an accuracy of a few seconds or better, given the RA and DEC of the target and the UTC date/time of the start of the exposure.

    For the moment, I have misplaced the original reference for the algorithm - possibly one of Meeus' algorithm books, or Arne Henden's Astronomical Photometry book. I'll provide the reference if I find it. In the meantime, there's some information on Wikipedia:
    https://en.wikipedia.org/wiki/Heliocentric_Julian_Day

    I will also rewrite and repost this code in VBS so it can be used with the VBS version of UserActions.wsc.

    EDIT: Here are both versions - one for either the JS or the VBS version of UserActions.wsc.
    Attached Files Attached Files
    Last edited by Dick Berg; Jul 31, 2015 at 00:28. Reason: included both JS and VB versions
    Dick
    www.VirgilObservatory.us
    Pier-mounted Meade 12-inch SCT "classic"
    Optec TCF-S focuser
    SBIG CFW-8A and ST7-XMEv
    H-alpha, BVRI, RGB & Clear filters
    FOV ~15 x 10



  2. #2
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    31,596

    Default

    FYI I decided to use the USNO NOVAS code to get the light time for HJD, and added BJD as an option.

    Code:
    //----------------------------------------------------------------------------------------
    // 
    // HJD() - Convert Julian date to Heliocentric Julian Date
    //
    // This will give a very slightly different answer than the (typical) Meeus algorithms
    // but you can consider this the more accurate as it uses the rigorous math in the USNO
    // NOVAS library. If Bary is True, calculate Barycentric not Heliocentric.
    //----------------------------------------------------------------------------------------
    function HJD(JD, RA, DE, Bary)
    {
        if(Bary) JD += Util.DeltaT(JD);                         // If asked for barycentric, adjust
        var KT = new ActiveXObject("Kepler.Ephemeris");         // Re-usable Earth ephem (reverse = Sun!)
        KT.BodyType = 0;                                        // Planet
        KT.Number = 3;                                          // EARTH
        var KA = new VBArray(KT.GetPositionAndVelocity(JD)).toArray(); // Get cartesian vector to earth from sun
        var SV = new ActiveXObject("NOVAS.PositionVector");
        SV.x = -KA[0];                                          // Reverse cartesian vector for sun from earth
        SV.y = -KA[1];
        SV.z = -KA[2];
        var z = (Math.sin(DE * DEGRAD) * Math.sin(SV.Declination * DEGRAD)) + 
                (Math.cos(DE * DEGRAD) * Math.cos(SV.Declination * DEGRAD) * Math.cos((RA - SV.RightAscension) * 15  * DEGRAD));
        return JD - (SV.Lighttime * z);                         // computed Helio/Bary-centric Julian Date
    }
    Last edited by Bob Denny; Aug 7, 2016 at 23:03.
    -- Bob

  3. #3
    Join Date
    Nov 2005
    Location
    Virgil, NY
    Posts
    5,755

    Default

    Neat! I'll change my code to incorporate this. Where did you install this code? (Is this going in AcquireSupport, as an auxiliary function available anywhere?)
    Dick
    www.VirgilObservatory.us
    Pier-mounted Meade 12-inch SCT "classic"
    Optec TCF-S focuser
    SBIG CFW-8A and ST7-XMEv
    H-alpha, BVRI, RGB & Clear filters
    FOV ~15 x 10



  4. #4
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    31,596

    Default

    It's in AcquireSupport but not (yet) in its interface. I've reopened the ticket to add this for public use.

    ACP-85 - Additional Info in FITS
    -- Bob

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. A function I really would like!
    By Per Frejvall in forum Pre-Sales Technical Questions and Help
    Replies: 6
    Last Post: Nov 17, 2014, 14:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •