Page 1 of 1

Scripted Autofocus parameters

Posted: 23 Aug 2019, 15:19
by astrojohn
Hi,

I am sure I have seen this somewhere. But I was trying to explain to a new user how to autofocus in a script and could not remember the parameters for Focuser.Autofocus(p,q,r,s) and exactly what they did..

Thanks
John

Re: Scripted Autofocus parameters

Posted: 23 Aug 2019, 20:24
by Dunmunro
astrojohn wrote:
23 Aug 2019, 15:19
Hi,

I am sure I have seen this somewhere. But I was trying to explain to a new user how to autofocus in a script and could not remember the parameters for Focuser.Autofocus(p,q,r,s) and exactly what they did..

Thanks
John
Astroart Guide->scripts->script functions->camera functions:


Camera / Guider.StartAutoguide(...) () - (r) - (r,x,y) - (r,snrel) - (r,snrel,satmax,expo)

Starts an autoguided session. It's possible use some parameters to select the radius of the subframe and its coordinates, otherwise this command takes a sample image and selects automatically the best star. It's possible to define a minimum relative S/N for that star, (default = 1.0), a maximum saturation value and the exposure time. Example: g = Camera.StartAutoguide() : if g then [.. star found and autoguide active]

Camera / Guider.StopAutoguide()

Stops an autoguide session.

Camera.Autofocus(...) () - (r) - (r,x,y) - (r,snrel) - (r,snrel,satmax,expo)

Starts an autofocus session. The parameters are the same of the function StartAutoguide().
I'm away from my observatory till November, so I'm a bit rusty now, on this. This is a script that I used for autofocusing between subs:
SeqName = "Abell2065AFmar8"
SeqDir = "C:\Astroart7\"
SeqSep = "_"
IndexStart = 1
IndexEnd = 44
Setup()

Sequence("light", 44, 300, 1, -1)

End





Sub Sequence(command,images,exposure,binning,focuspos)
Camera.Binning(binning)

For i = 1 To images
Index = Index + 1
If Index < IndexStart Then Continue
If Index > IndexEnd Then Break
fileName = BuildFileName(command,Index)
Guider.MoveReference()


Camera.Start(exposure, command <> "dark")
Camera.Wait

Image.Save(SeqDir + fileName)

Camera.Autofocus (95,156,711)
If ClosePreviousImage Then Image.ClosePrevious
ClosePreviousImage = true
Next i
End Sub

Sub Setup()
Index = 0
ClosePreviousImage = false
End Sub

Function BuildFileName(cmd,idx)
fileName = SeqName + SeqSep + Format(idx,"000")
If cmd <> "light" Then fileName = fileName + SeqSep + cmd
Print idx ; "/" ; IndexEnd ; " " + fileName
Return fileName + ".fit"
End Function

Re: Scripted Autofocus parameters

Posted: 23 Aug 2019, 21:36
by fabdev
You may also try the new full-frame autofocus procedure, as explained in "AA7SP1-Quicknotes.PDF" here:
viewtopic.php?f=2&t=417

where the command is:

Camera.FullFrameAutofocus(exposure)

if you saved the default options, or

Camera.FullFrameAutoFocus(exposure, darks, positions, step, binning)

if not.