Results 1 to 7 of 7

Thread: Astroart 6.0 SP2 - New script commands

  1. #1
    Developer
    Join Date
    Apr 2012
    Posts
    388

    Astroart 6.0 SP2 - New script commands

    Hello, the first new command in the Camera Interface 6.2 scripts is: Image.FWHM which automatically calculates the average "Full Width Half Maximum" of the stars of the image.
    This is useful in an automatic sequence (see the demo script "Sequencer" in the Menu) to repeat a bad exposure, or to trigger an autofocus procedure.

    Try this example:

    Code:
    shape = "OK"
    wx,wy = Image.FWHM
    if wx > wy * 1.3 then shape = "Elongated X"
    if wy > wx * 1.3 then shape = "Elongated Y"
    if wx = 0 then shape = "No stars found"
    print shape ; ":" ; wx ; wy

  2. #2
    Member
    Join Date
    May 2012
    Location
    Monterey county Ca.
    Posts
    67
    Hi Fabio, could you give an example of how to use this as an autofocus trigger in a script? For example if the seeing was average one night and very good on another how would the script be written to take advantage of the average seeing of each night?

    Is the ver. 6.2 still "Beta"?

    Thanks,
    -Iver
    Iver

  3. #3
    Developer
    Join Date
    Apr 2012
    Posts
    388
    I would measure focus as the minimum between wx and wy, so:

    Code:
    function FocusFWHM
      wx,wy = Image.FWHM
      if wx < wy then return wx else return wy
    end function
    at the beginning of the script I would initialize two variables:

    Code:
    LastFocusJD = JD()
    BestFocusFWHM = 99
    then, assuming maximum one refocus per hour:

    Code:
    function NeedNewFocus
      fwhm = FocusFWHM
      if fwhm = 0 then return false
      if JD() < LastFocusJD + 1/24 then
         if fwhm < BestFWHM then BestFWHM = fwhm
         return false
      end if
      if fwhm < BestFWHM * 1.2 then return false
      LastFocusJD = JD()
      BestFWHM = 99
      return true
    end function
    The function NeedNewFocus could be called after every exposure. It returns TRUE only if one hour is passed after the last refocus, and the current fwhm is 1.2X worse then the best fwhm of the past hour.
    This is just an example, a better implementation is possible.

    The 6.2 is still in beta because there is no documentation yet.

  4. #4
    Developer
    Join Date
    Apr 2012
    Posts
    388
    The check for good tracking could be integrated in the Sequencer script this way:
    Define a function for checking tracking:

    Code:
    function GoodTracking
      wx,wy = Image.FWHM
      if wx > wy * 1.3 then return false
      if wy > wx * 1.3 then return false
      ' if wx = 0 ... no stars, define a behaviour
      return true
    end function
    Then if GoodTracking returns "False" the exposure is repeated (maximum two times), as shown here:

    Click image for larger version. 

Name:	tracking.png 
Views:	2 
Size:	14.6 KB 
ID:	227

    for example:
    Code:
    ....
    ....
    for j = 1 to 3
       Camera.Start(exposure)
       Camera.Wait
       if GoodTracking() then break
       if j < 3 then Image.Close
    next j
    ....
    ....
    Last edited by facavi; 11 May 2017 at 15:26.

  5. #5
    Developer
    Join Date
    Apr 2012
    Posts
    388

    "InputButton" function

    In the past the classic "Input" function was used to control the flow of a script, but it required to use the keyboard, so it may be awkward to use. The new InputButton let you use the mouse. Try this example:

    Code:
    resp = InputButton("Park the telescope?","Yes","No","Later")
    if resp = "Yes" then
      print "Now parking..."
    else
      print "Let's continue..."
    end if
    Which displays:
    Click image for larger version. 

Name:	InputButton.jpg 
Views:	0 
Size:	15.8 KB 
ID:	228

    up to 12 buttons are permitted, for example:

    Code:
    ns = InputButton("Number?","1","2","3","4","5","6","7","8","9")
    print "Square = " ; val(ns) * val(ns)

  6. #6
    Developer
    Join Date
    Apr 2012
    Posts
    388
    The command Image.Formula(string) applies a Formula (see the Astroart Help) to the image.
    For example, try:

    Image.Formula("v + 500")

    Other new functions are Image.Crop(x1,y1,x2,y2) , Image.JD and functions to iterate over the selected stars, to create a customized report:

    Code:
    magVar = 0
    n = Image.Stars.Count
    for i = 1 to n
       ra = Image.Stars.RA(i)
       de = Image.Stars.DE(i)
       adu = Image.Stars.ADU(i)
       mag = Image.Stars.Mag(i)
       sn = Image.Stars.SN(i)
       ocmag = Image.Stars.OCMag(i)
       pref = Image.Stars.PRef(i)
       if not pref then
          magVar = mag
       end if
    next i
    if magVar = 0 then Warning("Variable star not found") 
    WriteReportLine()
    end
    
    sub WriteReportLine
      sLine = Format(Image.JD, "0.000000") + " V"
      sLine = sLine + Format(magVar, " 0.0000") + Format(magVar, " 0.0000")
      print sLine
      'AppendText(sLine ....
    end sub
    
    function ImageMidUT
      return Image.JD + Image.GetKey("EXPOSURE")/3600/24/2
    end function
    As usual this example calculates the "Mid of Exposure" as : "Start of Exposure" + Exposure / 2.
    Mid Exposure (used in photometry and astrometry) is indeed always a calculated field, while all Times (in the FITS standard too) are always referred to the start of exposure.

  7. #7
    Member
    Join Date
    May 2012
    Location
    Selsey nr Chichester
    Posts
    69

    In the case of 3 ref stars 1 variable and 1 check star?

    Quote Originally Posted by facavi View Post
    The command Image.Formula(string) applies a Formula (see the Astroart Help) to the image.
    For example, try:

    Image.Formula("v + 500")

    Other new functions are Image.Crop(x1,y1,x2,y2) , Image.JD and functions to iterate over the selected stars, to create a customized report:

    Code:
    magVar = 0
    n = Image.Stars.Count
    for i = 1 to n
       ra = Image.Stars.RA(i)
       de = Image.Stars.DE(i)
       adu = Image.Stars.ADU(i)
       mag = Image.Stars.Mag(i)
       sn = Image.Stars.SN(i)
       ocmag = Image.Stars.OCMag(i)
       pref = Image.Stars.PRef(i)
       if not pref then
          magVar = mag
       end if
    next i
    if magVar = 0 then Warning("Variable star not found") 
    WriteReportLine()
    end
    
    sub WriteReportLine
      sLine = Format(Image.JD, "0.000000") + " V"
      sLine = sLine + Format(magVar, " 0.0000") + Format(magVar, " 0.0000")
      print sLine
      'AppendText(sLine ....
    end sub
    
    function ImageMidUT
      return Image.JD + Image.GetKey("EXPOSURE")/3600/24/2
    end function
    As usual this example calculates the "Mid of Exposure" as : "Start of Exposure" + Exposure / 2.
    Mid Exposure (used in photometry and astrometry) is indeed always a calculated field, while all Times (in the FITS standard too) are always referred to the start of exposure.
    Not sure this script would work with 3 reference 1 variable and 1 check star.

    I have to look in order if i=1 and it is a ref then assume variable is not found.
    If n = 5 and then i = 5 is the check star and compared with AAVSO value for error checking.

    Regards,
    John Mallett
    All the best,

    John
    Selsey Observatory
    UK
    Twitter: @astrojohn

Posting Permissions

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