Page 1 of 1

Peculiar flat fields for research

Posted: 08 Jun 2022, 13:53
by fabdev
Hello, for a peculiar UBVRI research, the following specification were needed for flat fields:

1) Taken every night, on the sky, at sunset or dawn.
2) Taken for all filters (UBVRI) using an optimal exposure of 2/3 of dynamic range.

The main problem was to find the correct exposure. It was solved taking a test exposure then measuring the average value of the image. Knowing the bias level of the camera, the correct exposure time could be calculated as:

newExpo = currExpo * (TargetADU - biasADU) / (Image.Average - biasADU)

Here is a prototype script were the bias is set at 100 ADU and the target ADU is 40000.
Flats are taken near the zenit switching off the telescope tracking.

Code: Select all

seqDir = "D:\Temp\"
sunAltitude = -5.0
nExpo = 3
initExposure = 5.0
targetADU = 40000
biasADU = 100

WaitSun
GotoZenith
Sequence("u", nExpo)
Sequence("b", nExpo)
Sequence("v", nExpo)
Sequence("r", nExpo)
Sequence("i", nExpo)
Message("Script ended")

end

Sub WaitSun
  while true
     a = SunAlt
     cls
     print "Sun altitude = " + Format(a, "0.000") + "°"
     if a < sunAltitude then break
     Pause(2)
  end while
End Sub

function SunAlt
  lon = Observatory.Longitude
  lat = Observatory.Latitude
  ra,de = SunRaDec(JD)
  az,al = EquatToAltaz(ra,de,lon,lat)
  return al
end function

Sub GotoZenith
  lon = Observatory.Longitude
  lat = Observatory.Latitude
  ra,de = AltazToEquat(175, 89, lon, lat)
  print "Moving telescope to zenith ..."
  Telescope.Goto(ra, de)
  Telescope.Wait
  print "Telescope arrived"
  Telescope.StopTracking
End Sub

Sub Sequence(filter,images)
  print "Moving filter wheel to " + filter + " ..."
  Wheel.Goto(filter)
  Wheel.Wait
  print "Test exposure ..."
  exposure = CalcOptimalExposure
  print "Optimal exposure for " + filter + " is " + Str(exposure) + " s"
  for i = 1 to images
     Camera.Start(exposure, true)
     Camera.Wait
     fileName = BuildFileName(filter,i)
     print fileName
     Image.Save(seqDir + fileName)
     if i > 1 then Image.ClosePrevious
  Next i
  Image.Close
End Sub

Function CalcOptimalExposure
  Camera.Start(initExposure, true)
  Camera.Wait
  mult = (TargetADU - biasADU) / (Image.Average - biasADU)
  Image.Close
  return Round(initExposure * mult)
End Function

Function BuildFileName(filter,idx)
  return "Flat " + filter + " " + Date() + " " + Format(idx,"00") + ".fit"
End Function


Re: Peculiar flat fields for research

Posted: 09 Jun 2022, 12:39
by AlessandroMaitan
Excellent piece of advice Fabio.
I'll give it a try.
Thank you.

Alessandro