Astroartによる望遠鏡コントロールとカメラコントロールの自動化

様々な環境で、望遠鏡とカメラのコントロールが出来、簡単なBasic言語が使える。
  

Camera control with MSB Software's Astroart 5
CCD Camera and telescope control for automatic imaging
 2014 Feb 1 revised.

モノクロCCDを使って天体写真を撮るには色々と設定することが多く、何をどう設定して撮影しているかという記録を残して再現性あるデータを得るには気を使う事が多い。これを自動化するためにAstroart5 のscriptを使った。Microsoft Accessで天体データベースを作りテキストに変換すること。テキストをAstroart5から読み取り撮影リストとする。撮影条件をAccessで編集してTableとして、最後にテキスト変換するところまでAccessにプログラムして、撮影ごとに一括してAstroart5から読み取ることが出来る。
生成したtextは
D:\photo\CameraScript\SerialNo.txt Astroart5から書き込み読み込みをして、撮影のシリーズNoとしている。Accessからも読み込んで条件の記録に使う。参考のためにaccessのevent procedureをここに記載します。全ての撮影条件は対象画像と一緒に同じfolderにtextで撮影毎にAstroart5からも保存されます。
ここではAccessを使いましたが、Excelでも、その他の簡単なプログラムでも撮影条件を入力できると思います。
始めの設定は星図ソフトCartes du Ciel(ASCOM対応)などで特定の天体に同期しておくと、Astroart5でも同期しているので観測リストを自動で読み取り、導入、撮影が出来ます。モザイク撮影の場合は星図ソフトから座標データベースを作る必要があります。

最後に、dark frame と flat frameのscriptを圧縮して載せています。(revised in Feb 4, 2014)
_______________________________________
参考までにaccessのevent procedureです。

Private Sub SendTakeImg_Click()
Dim scope As String

DoCmd.Save
'scope = "Scp$= '" & Me.Optics & "'"
scope = Me.Optics
Open "D:\photo\Environment\Optics.txt" For Output As #1
Write #1, scope
Close #1
Open "D:\photo\Environment\CameraTemp.txt" For Output As #1
Write #1, Me.CameraTemp
Close #1
Open "D:\photo\Environment\Seeing.txt" For Output As #1
Write #1, Me.Seeing
Close #1
Open "D:\photo\Environment\AmbientTemp.txt" For Output As #1
Write #1, Me.AmbientTemp
Close #1

'AutoGuide
Open "D:\photo\Environment\AutoGuide.txt" For Output As #1
Write #1, Me.AutoGuide
Close #1

Open "D:\photo\Environment\Camera.txt" For Output As #1
Write #1, Me.Camera
Close #1

'0ExposureTimeTbl
DoCmd.OpenQuery "ExpsureTimeQtoTable"

DoCmd.TransferText acExportFixed, "0ExposureTimeTbl エクスポート定義", "0ExposureTimeTbl", "D:\photo\Environment\0ExposureTimeTbl.txt"
End Sub
________________________________________

固定長のテキストをTableからexportするのに使う定義ファイルが”エクスポート定義”です。一回固定長でテキストを出力して、定義を決めて保存します。その時の名前が、エクスポート定義だったのです。クエリからexport出来なかったので、作表クエリで一旦Tableを作成し、そのTableをexportしています。手のかかるように見えますがボタン1つで、終わります。


読み書きしているファイルは

D:\photo\CameraScript\00TransferAutoGrab.txt script for Astroart5
D:\photo\observelist\0Nowobserving.txt Accessから生成した観測リスト(毎回の撮影毎に生成)
D:\photo\Environment\0ExposureTimeTbl.txt Accessから生成したexposure time、filter、number of exposure、biningが記録されている。
D:\photo\Environment\Seeing.txt Seeing
D:\photo\Environment\AutoGuid.txt AutoGuid yes no
D:\photo\Environment\AmbientTemp.txt environment temperature
D:\photo\Environment\Optics.txt Scope
D:\photo\Environment\CameraTemp.txt

以下に、Scriptを示しています。これで自動的に対照リストと撮影条件を読みます。1か所リストを使うかと聞きます。使わないと答えると、その時のScopeの向いている天体を撮影できるので対象の名前だけ入れます。エラー処理が出来なかったので、どこかで失敗すると、プログラムが止まります。鏡筒が反転しない限りオートガイドも使えます。Monochromatic CCDでもL-Filterとみなして撮影して問題はありません。
a script program for Astroart5
固定長のテキストからデータを切りだすのにMid$関数を使っています。そのあとで数値に変換していますが表示するときはStringに変換します。
以下ご自由に利用されれば幸いです。バグがありますが、努力中です。
Script
_______________________________________
'"ooTransferObjectGarb 2014 Jan 2 program errors were corrected.
''"ooTransferAutoGarb rev.2014Feb01
'for simulation camera1 is ASCOM. seconc camera is simulator !
Telescope.List.Clear
Telescope.List.Open("D:\Photo\observelist\0Nowobserving.txt")
Prtcnt=0
AutoGoto$="N"
Scp$=opentext$("D:\Photo\Environment\Optics.txt")
Remk$=opentext$("D:\Photo\Environment\Seeing.txt")
Const$="Sky"
if Const$="" then Const$="Sky"
Temparature$=opentext$("D:\Photo\Environment\CameraTemp.txt")
Camera$=opentext$("D:\Photo\Environment\Camera.txt")
Seeing$=opentext$("D:\Photo\Environment\Seeing.txt")
ambT$=opentext$("D:\Photo\Environment\AmbientTemp.txt")
if ambT$="" then ambT$="X"
Temparature$=Temparature$ + "at" + ambT$
'
' "L Exposure time
DTimeL1=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),12,11))
nbL1=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),23,11))
DTimeL2=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),34,11))
nbL2=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),45,11))
DTimeL3=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),56,11))
nbL3=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),67,11))
if DtimeL1=0 then Ltime=0
if DTimeL2=0 and DTimeL1>0 then Ltime=1
if DTimeL3=0 and DtimeL2>0 then Ltime=2
if DtimeL3>0 then Ltime=3
DTimeR=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),78,11))
DTimeG=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),100,11))
DTimeB=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),122,11))
DTimeA=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),144,11))
'
'
'****number of exposure***
nbR=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),89,11))
nbG=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),111,11))
nbB=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),133,11))
nbA=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),155,11))
'*** Bining ****
BinL=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),166,11))
BinRGB=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),177,11))
BinA=Val(Mid$(opentext$("D:\Photo\Environment\0ExposureTimeTbl.txt"),188,11))
'print "bining L RGG A:" +Str$(BinL) + ", " + Str$(BinRGB) + ", " + Str$(BinA)
input "Do you select Telescope List ? Y/or else ", TList$
TList$=ucase$(TList$)
'*******
if TList$="Y" then
T=Telescope.List.Count
'Print str$(T) + " :List counts "
AutoGoto$="Y"
'
AutoGuide$=Mid$((opentext$("D:\Photo\Environment\AutoGuide.txt")),2,1)
Print "Autoguiding: " + AutoGuide$
'*******
else
input "Object Name", objName$
AutoGoto$="N"
AutoGuide$="not programed"
Tbline=1
T=1
print " Scope Ra: " + str$(Telescope.Ra) + "Scope Dec: " + str$(Telescope.Dec)
X=Telescope.Ra
X$=ra$(X)
Y=Telescope.Dec
Y$=dec$(Y)
Print str$(X) + ", " + str$(Y) + ", " + objName$
Print X$ + ", " + Y$ + ", " + objName$
endif

'130:
Expdate$=left$(date$(),4)+"_" + mid$(date$(),6,2)+"_"+right$(date$(),2)
Path$ = "d:\photo\" + ExpDate$ +"\"
Createdir(Path$)
'*******
guiding$="N"
print "XXXXXXXXXXXX"
for Tbline=1 to T
if TList$="Y" then
X=telescope.list.ra(Tbline)
Y=telescope.list.Dec(Tbline)
objName$=Telescope.List.Name$(Tbline)
else
X=Telescope.Ra
Y=Telescope.Dec
endif

ObjectHead$=rtrim$(objName$)
if guiding$="Y" then
Camera.StopAutoguide()
Guider.stop
Guider.close
guiding$="N"
endif
'
cls
file$=opentext$("D:\Photo\CameraScript\SerialNo.txt")
serNo= val(file$)+1
print serNo
Output.Save("D:\Photo\CameraScript\SerialNo.txt")
'
Txfile$=Path$ + str$(SerNo) + objName$+ ".txt"
Print "date: " + date$()
Print "time: " + time$()
Print "Scope: " + Scp$
Print "Camera: " + Camera$
Print "Seeing: " + Seeing$
Print "Remarks: " + Remk$
Print "Camera temparature:" + Temparature$
Print "Data Table Name: " + const$
'
If AutoGoto$="Y" then
Print "Programed Slew: " + AutoGoto$
endif
if AutoGuide$ = "Y" then
Print "Programed Autoguiding: Y "
else
Print "Programed Autoguiding: Not programed. "
endif
Print "Data counts: " + str$(Tbline) + "/" + str$(T)
print objName$
print "Ra:" + ra$(X)
print "Dec:" + Dec$(y)
Print "exposure time(sec)"
print "bining L RGG A:" +Str$(BinL) + ", " + Str$(BinRGB) + ", " + Str$(BinA)
if Ltime=1 then Print "L1:" + str$(DTimeL1)+ "sec. n= " + str$(nbL1)
if Ltime=2 then Print "L1:" + str$(DTimeL1)+ "sec. n= " + str$(nbL1) + " L2: " + str$(DTimeL2) + "sec. n= " + str$(nbL2)
if Ltime=3 then Print "L1:" + str$(DTimeL1)+ "sec, n= " + str$(nbL1) + " L2: " + str$(DTimeL2) + "sec. n= " + str$(nbL2)+ " L3: " + str$(DTimeL3) + "sec. n= " + str$(nbL3)
Print " R:" + str$(DTimeR)
print " G:" + str$(DTimeG)
Print " B:" + str$(DTimeB)
Print " Alpha:" + str$(DTimeA)
Print " R:" + str$(nbR) + " G:" + str$(nbG) +" B:" + str$(nbB) + " alpha:" + str$(nbA)
print Txfile$
'message("Ready to start ?")
output.save(Txfile$)
'
ObjectHead$=ObjectHead$ +"_"
if AutoGoto$="Y" then
Telescope.Goto(X,Y)
Telescope.Wait
seq$ = "LRGBA"
f$ = seq$[1]
Wheel.Connect
Wheel.Goto(f$)
Camera.Binning(2)
Camera.Start(10)
Camera.Wait
ObjectImage$=ObjectHead$+"_test" +"_"+str$(SerNo)+ ".fit"
Image.Rename(ObjectImage$)
filename$=path$ + ObjectImage$
Image.Save(filename$)
Image.findcoordinates(x,y,4)
dist=image.distancefrom(x,y)
if dist>0.1 then
print "centering telescope..."
telescope.SyncTo(Image.RA,image.Dec)
telescope.GoTo(X,Y)
telescope.wait
endif
pause(10)
if AutoGuide$="Y" then
guiding$="Y"
Guider.Select(2)
Camera.StartAutoguide()
Pause(20)
endif
'
endif
nb=0
seq$ = "LRGBA"
if nbL1=0 then Goto 250
'● 2
for Lexp=1 to Ltime
if DTimeL1=0 then Goto 250
if Lexp=1 then
nb=nbL1
DTime=DTimeL1
endif
if nb*Dtime=0 then Goto 250
'
if Lexp=2 then
nb=nbL2
DTime=DTimeL2
'if nb*Dtime=0 then i=2 and Goto 250
endif
'
if Lexp=3 then
nb=nbL3
DTime=DTimeL3
endif
if nb*Dtime=0 then i=2 and Goto 250
if Ltime=0 then Goto 250
'
i = 1
seq$ = "LRGBA"
f$ = seq$[i]
Wheel.Connect
Wheel.Goto(f$)
'Camera.Binning(b)
if i=1 then
CB=BinL
endif
'
Camera.Binning(CB)
'● 3
for L=1 to nb
n=L
if Ltime=0 then Goto 250
if nbL1=0 then goto 250
if nb=0 then next L
Camera.Start(Dtime)
Camera.Wait
pause(5)
Prtcnt=Prtcnt+1
ObjectImage$=ObjectHead$+"0" + str$(Dtime) + "_"+str$(SerNo)+"_"+str$(Prtcnt) + f$ + str$(n)+ ".fit"
Image.Rename(ObjectImage$)
filename$=path$ + ObjectImage$
Image.Save(filename$)
pause(5)
Image.close
print filename$
'???????
next L

'???????
next Lexp
'
'endif


250:
'● 4
for i = 2 to 5
'
if i= 2 then
DTime=DTimeR
nb=nbR
CB=BinRGB
if nb*Dtime=0 then next i
endif
endif
'
if i= 3 then
DTime=DTimeG
CB=BinRGB
nb=nbG
if nb*Dtime=0 then next i
endif
endif
'
if i= 4 then
DTime=DTimeB
CB=BinRGB
nb=nbB
if nb*Dtime=0 then next i
endif
endif
'
if i= 5 then
DTime=DTimeA
nb=nbA
CB=BinA
if nb*Dtime=0 then next i
endif
endif

f$ = seq$[i]
Wheel.Goto(f$)
Camera.Binning(CB)
'● 5
for n=1 to nb
Camera.Start(Dtime)
Camera.Wait
pause(5)
Prtcnt=Prtcnt+1
ObjectImage$=ObjectHead$+"0" + str$(Dtime) + "_"+str$(SerNo)+"_"+str$(Prtcnt) + f$ + str$(n)+ ".fit"
if Dtime<>0 then '
Image.Rename(ObjectImage$)
'
filename$=path$ + ObjectImage$
Image.Save(filename$)
print filename$
pause(5)
endif
Image.close
next n
'n is each count
next i
'******
' i is filter count
next Tbline
'Tbline is object list
300:
print "All telescope list finished."
if guiding$="Y" then
Camera.StopAutoguide()
Guider.stop
Guider.close
endif'

END






Script for Dark frame and Flat frame get LZH copressed text
(revised in Feb 4, 2014)

  撮影対象の位置データと、カメラの撮影条件の指示を、Microsoft Accessから行うためのフォームの例を示している。
 天体位置情報のデータベースは2000年分点で表示されている。Astroart5のTelescope GoToのフォームに取り込まれる座標データをテキスト、CSVファイルなどで送ることが出来る。
 この方法で座標データを送って、自動導入をプログラムで行うと、星図ソフトに位置が表示されるが、位置のずれがあった。原因は不明であった。2014年5月,1月にAstroart5のフォームが改良されたが、注意を惹かなかった。(Astroart Camera Interface – Ver. 5.40 – Rev. 2014-05-12、Ver. 5.30 – Rev. 2014-01-31) 天体の座標は多くの場合、2000年分点で登録されている。導入時の座標の指示が、現時点の座標なのか、2000年分点のモノなのかを指示できるようになった。

 左下が従来のフォームで、右下が現在のフォーム改良されたフォームである。JNowというチェックが入るようになりました。これをチェックすると、2000年分点の座標が、現在の座標に変換されて導入されるので、座標のずれが解決する。Enable the JNow option to convert the coordinates from J2000 to the current epoch.

inserted by FC2 system