PYTHON   17

log pwi4 values py

Guest on 15th August 2022 12:38:13 PM

  1. import time
  2. from pwi4_client import PWI4
  3.  
  4. pwi4 = PWI4()
  5.  
  6. outfile = open("pwi4log.txt", "a")
  7.  
  8. while True:
  9.     # Take a snapshot of the PWI4 status
  10.     status = pwi4.status()
  11.  
  12.     # Add any values displayed in http://localhost:8220/status
  13.     values = (
  14.             status.response.timestamp_utc,
  15.             status.mount.julian_date,
  16.             status.mount.ra_j2000_hours,
  17.             status.mount.dec_j2000_degs,
  18.             status.mount.azimuth_degs,
  19.             status.mount.altitude_degs,
  20.             status.mount.axis0.dist_to_target_arcsec,
  21.             status.mount.axis1.dist_to_target_arcsec
  22.             )
  23.  
  24.     string_values = [str(x) for x in values]
  25.     line = ", ".join(string_values)
  26.  
  27.     print(line, file=outfile)
  28.     time.sleep(0.01) # Sleep 10 milliseconds

Raw Paste


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