Scripted Autofocus parameters

Scripts and programs to automate Astroart
Post Reply
astrojohn
Posts: 4
Joined: 23 Aug 2019, 15:07
Location: Selsey Chichester UK
Contact:

Scripted Autofocus parameters

Post by astrojohn » 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

Dunmunro
Posts: 225
Joined: 10 Jan 2019, 01:11

Re: Scripted Autofocus parameters

Post by Dunmunro » 23 Aug 2019, 20:24

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

fabdev
Posts: 461
Joined: 03 Dec 2018, 21:43

Re: Scripted Autofocus parameters

Post by fabdev » 23 Aug 2019, 21:36

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.

Post Reply