Astroart 6.0 SP2 - New script commands

Scripts and programs to automate Astroart
Post Reply
Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Astroart 6.0 SP2 - New script commands

Post by Forum_2017 »

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: Select all

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

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Astroart 6.0 SP2 - New script commands

Post by Forum_2017 »

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

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Astroart 6.0 SP2 - New script commands

Post by Forum_2017 »

I would measure focus as the minimum between wx and wy, so:

Code: Select all

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: Select all

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

Code: Select all

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.

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Astroart 6.0 SP2 - New script commands

Post by Forum_2017 »

The check for good tracking could be integrated in the Sequencer script this way:
Define a function for checking tracking:

Code: Select all

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:

Code: Select all

....
....
for j = 1 to 3
   Camera.Start(exposure)
   Camera.Wait
   if GoodTracking() then break
   if j < 3 then Image.Close
next j
....
....

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

"InputButton" function

Post by Forum_2017 »

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: Select all

resp = InputButton("Park the telescope?","Yes","No","Later")
if resp = "Yes" then
  print "Now parking..."
else
  print "Let's continue..."
end if
which displays up to 12 buttons are permitted, for example:

Code: Select all

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

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Astroart 6.0 SP2 - New script commands

Post by Forum_2017 »

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: Select all

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.

Edit: for improved compatibility use the EXPTIME keyword instead of EXPOSURE:

Code: Select all

function ImageMidUT
  return Image.JD + Image.GetKey("EXPTIME")/3600/24/2
end function

Forum_2017
Posts: 275
Joined: 10 Dec 2018, 16:23

Re: Astroart 6.0 SP2 - New script commands

Post by Forum_2017 »

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

Post Reply