PYTHON   69

pwi4 client demo py

Guest on 15th August 2022 12:42:55 PM

  1. import time
  2.  
  3. from pwi4_client import PWI4
  4.  
  5.  
  6. print("Connecting to PWI4...")
  7.  
  8. pwi4 = PWI4()
  9.  
  10. s = pwi4.status()
  11. print("Mount connected:", s.mount.is_connected)
  12.  
  13. if not s.mount.is_connected:
  14.     print("Connecting to mount...")
  15.     s = pwi4.mount_connect()
  16.     print("Mount connected:", s.mount.is_connected)
  17.  
  18. print("  RA/Dec: %.4f, %.4f" % (s.mount.ra_j2000_hours, s.mount.dec_j2000_degs))
  19.  
  20.  
  21. print("Slewing...")
  22. pwi4.mount_goto_ra_dec_j2000(10, 70)
  23. while True:
  24.     s = pwi4.status()
  25.  
  26.     print("RA: %.5f hours;  Dec: %.4f degs, Axis0 dist: %.1f arcsec, Axis1 dist: %.1f arcsec" % (
  27.         s.mount.ra_j2000_hours,
  28.         s.mount.dec_j2000_degs,
  29.         s.mount.axis0.dist_to_target_arcsec,
  30.         s.mount.axis1.dist_to_target_arcsec
  31.     ))
  32.  
  33.  
  34.     if not s.mount.is_slewing:
  35.         break
  36.     time.sleep(0.2)
  37.  
  38. print("Slew complete. Stopping...")
  39. pwi4.mount_stop()

Raw Paste


Login or Register to edit or fork this paste. It's free.