Author Topic: Script for Astrophotography  (Read 168 times)

f.javi.pz

  • New to the forum
  • *
  • Posts: 6
Script for Astrophotography
« on: October 27, 2020, 03:45:45 PM »
Hi,

I'm trying to write an script for Astrophotography, to complete the sequence of pics for DARK, BIAS, LIGHT and FLAT corrections.

It seems an easy one, it just have to take several pictures in silent mode at different shutter values, with or without a cap on the objetive. But I'm afraid I'm new with lua. I copied code from other scripts in the forum, examples, etc.

This is the code I write as an starting point (don't be cruel with the rookie):
Code: [Select]
menu.new
{
  name = "Astrophoto",
  help = "Takes several photos to complete BIAS, DARK, LIGHT and FLAT sequences, for astrophotografy",
  select = function(this) task.create(astrophoto) end,
}

function astrophoto()
  menu.close()
  console.show()
  console.clear()
  print "BIAS and DARK initial sequences (10+10 photos)"
  print "Switch to Manual mode and cover the objetive with the cap"
  print "Press any key to start"
  key.wait()
  console.hide()

  -- BIAS sequence
  camera.aperture.value = 3.5
  camera.iso.value = 1600
  camera.shutter.value = 1/4000
local i = 0
while i < 10 do
camera.shoot()
i = i+1
end

  -- DARK sequence
  camera.aperture.value = 3.5
  camera.iso.value = 1600
  camera.shutter.value = 1
  local i = 0
while i < 10 do
camera.shoot()
i = i+1
end
 
  console.show()
  console.clear()
  print "LIGHT sequence (10 photos)"
  print "Uncover the objetive and press any key to start"
  key.wait()
  console.hide()
 
  -- LIGHT sequence
  camera.aperture.value = 3.5
  camera.iso.value = 1600
  camera.shutter.value = 1
  local i = 0
while i < 10 do
camera.shoot()
i = i+1
end

  console.show()
  console.clear()
  print "BIAS and DARK final sequences (10+10 photos)"
  print "Cover the objetive and press any key to start"
  key.wait()
  console.hide()

  -- DARK sequence
  camera.aperture.value = 3.5
  camera.iso.value = 1600
  camera.shutter.value = 1
  local i = 0
while i < 10 do
camera.shoot()
i = i+1
end
 
  -- BIAS sequence
  camera.aperture.value = 3.5
  camera.iso.value = 1600
  camera.shutter.value = 1/4000
  local i = 0
while i < 10 do
camera.shoot()
i = i+1
end

  console.show()
  console.clear()
  print "FLAT sequence (20 photos)"
  print "Cover with an iluminated diffusor and switch to Av mode"
  print "Press any key to start"
  key.wait()
  console.hide()

  -- FLAT sequence
  camera.aperture.value = 3.5
  camera.iso.value = 1600
  local i = 0
while i < 20 do
camera.shoot()
i = i+1
end

  console.show()
  console.clear()
  print "Everything done!"
  print "Press any key to end the script"
  key.wait()
  console.hide()

end

Todo:

1 Get it working!  :-\
2 Print the count of pictures taken/to be taken
3 Automatically change mode to manual/Av/silent (I don't know if can be done)
4 Automatically take shutther/iso/speed values set at the beggining of the script

I'll keep trying, but the truth is... I'm stuck. I would appreciate some help.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2057
Re: Script for Astrophotography
« Reply #1 on: October 27, 2020, 04:40:10 PM »
@f.javi.pz

Too many questions in one go ;-)

Have a look at my latest script, DOFIS, for some ideas to help you.

Cheers

Garry

f.javi.pz

  • New to the forum
  • *
  • Posts: 6
Re: Script for Astrophotography
« Reply #2 on: October 27, 2020, 04:53:32 PM »
Sorry about the questions. Just get it working is enough, it's true. Take it as a consecuence os being stuck.

I'll check out your DOFIS script, sure. I checked some other of your scripts before posting (you are quite active, thanks!), but I'm afraid they are really complex for me.

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 7588
Re: Script for Astrophotography
« Reply #3 on: October 27, 2020, 05:15:00 PM »
I think you know the drill:
Break it down into smaller pieces. Make piece after piece working and don't try to solve everything at once.

And be sure: garry23 had to struggle in the very beginning, too. We witnessed most of it and his progress. ;-)

AFAIK there is no option to switch modes. I think you have to check for manual mode change, instead.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2057
Re: Script for Astrophotography
« Reply #4 on: October 27, 2020, 05:29:54 PM »
Walter

How dare you!

What do you mean “garry23 had to struggle in the very beginning”.

I’m still bloody struggling  :) :) :) :) :)


f.javi.pz

  • New to the forum
  • *
  • Posts: 6
Re: Script for Astrophotography
« Reply #5 on: October 27, 2020, 05:44:14 PM »
I think you know the drill:
Break it down into smaller pieces. Make piece after piece working and don't try to solve everything at once.

And be sure: garry23 had to struggle in the very beginning, too. We witnessed most of it and his progress. ;-)

AFAIK there is no option to switch modes. I think you have to check for manual mode change, instead.

Drill started!

Thanks!

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 7588
Re: Script for Astrophotography
« Reply #6 on: October 27, 2020, 05:57:27 PM »
People will help you if you get stuck. Just don't expect throwing a big chunk of code over the fence and get it fixed.