Differential Aperture Photometry Script Example

Scripts and programs to automate Astroart
Post Reply
seanspratt54
Posts: 3
Joined: 19 Nov 2019, 03:46

Differential Aperture Photometry Script Example

Post by seanspratt54 » 27 Nov 2019, 07:46

Here is an example script that will perform Differential Aperture Photometry for a single stellar image in 3 major steps:
(Thankyou to Fabio and Astro John!!!)

Preprocessing – Combines image, dark, flat and flat dark to create calibrated image
FindCoordinates – Plate Solve the image
Photometry – Differential Aperture Photometry – compute magnitude of a star by comparing the measured ADUs of a star with a known magnitude in the same field of view

File->Preferences->Stars (tab)
To set desired Aperture, Gap, Background (for ADU and magnitude calculation)
To set Gain, Readout Noise, Total dark current (for Signal/Noise calculation)

Other Options are set in Tools->Preprocessing->Options(tab) - I left them as default as I am still leaning about them!

(FindCoordinates is using width addition in AA7 service pack 2 - thanks Fabio!)

I might have missed some other preferences as I am new to this - comments are appreciated

Below is the script:

dir = "D:\Astro-pics\misc\" ' my directory
pre$ = "#PREPROCESSING" + CRLF
pre$ = pre$ + "Dark=" + dir + "Dark-5.FIT" + CRLF ' my dark
pre$ = pre$ + "Flat=" + dir + "V-Flat.FIT" + CRLF ' my flat
pre$ = pre$ + "F.Dark=" + dir + "F-Dark.FIT" + CRLF 'my flat dark
pre$ = pre$ + "Image=" + dir + "V0836 CYG-V-5-5.FIT" + CRLF ' my image taken with photo-metric V filter of the variable star V0836 CYG (AAVSO) and a reference star of mag 9.066
pre$ = pre$ + "ExtraFilters=0" + CRLF
pre$ = pre$ + "AlignMethod=0" + CRLF
pre$ = pre$ + "CombineMethod=0" + CRLF
pre$ = pre$ + "CutBorders=0" + CRLF
Preprocessing(pre$)
Print "Pre-processing Done"
' *****************************************************
Image.FlipV ' older fit require flip image vertically
PS = Image.FindCoordinates(21.4,35.3,5,2,24) ‘ RA, DEC guess, numbers of stars to match, search area (deg), ccd image approx width (minutes of arc) - AA7 Service Pack 2
Print "RA = " , Image.Ra
Print "Dec = " , Image.Dec
Print "Plate solving status : " , PS
Print "FWHM = " , Image.FWHM
Print "JD = " , JD
' *****************************************************
Image.Stars.Open(dir + "V0836.txt")
Image.Photometry
magVar = 0
magRef = 0
n = Image.Stars.Count ‘ from V0836.txt - 1st star is the variable RA, DEC followed by the reference star(s) RA, DEC, MAG
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)
pref = Image.Stars.PRef(i)
if i = 1 then
magVar = mag
AUDVar = adu
end if
if i = n then
magRef = mag
ADURef = adu
end if
next i
print "Ref MAG = " , magRef
print "Ref ADU = " , ADURef
print "Var MAG = " , magVar
print "Var ADU = " , AUDVar

My results:

Pre-processing Done
RA = 21.36130797
Dec = 35.78530155
Plate solving status : True
FWHM = 4.040911674
JD = 2458814.822
Ref MAG = 9.066
Ref ADU = 118816
Var MAG = 8.837
Var ADU = 146773

Below is V0836.txt with the variable and one reference star. More reference stars can be included along the same line

Astroart Photometry
Var RA Var Dec R RA R Dec R Mag
21 21 23.66 +35 44 10.43 21 21 51.242 +35 47 35.11 9.066

seanspratt54
Posts: 3
Joined: 19 Nov 2019, 03:46

Re: Differential Aperture Photometry Script Example

Post by seanspratt54 » 28 Nov 2019, 01:21

Oops!

JD should be replaced with Image.JD

Post Reply