PYTHON   14

# custom path test

Guest on 15th August 2022 12:34:22 PM

1. import math
2.
3. import pwi4_client
4.
5. pwi4 = pwi4_client.PWI4()
6.
7. # coord_type can be "raw" or "altaz"
8. # raw: use the "native" axis coordinates (equipment to mount.axisN.position_degs)
9. # altaz: use unrefracted altaz coordinates, passing through the pointing model
10. coord_type = "raw"
11.
12.
13. # points is a list of tuples, of the form:
14. #  (time_seconds, coord0_degs, coord1_degs)
15. #
16. # where time_seconds is the number of seconds from
17. # the time this script started.
18. #
19. # Later we'll convert from relative seconds into absolute JD values.
20.
21. # Here's a sample point list that traces out a rectangle on the sky:
22. #points = [
23. #    (10, 180, 45),
24. #    (30, 180, 65),
25. #    (50, 220, 65),
26. #    (70, 220, 45),
27. #    (90, 180, 45)
28. #]
29.
30. # Here's another example that oscillates +/- 5 degrees in Altitude
31. # every 6.28 seconds while rotating around in Azimuth. This generates
32. # 12,000 points and can be used to demonstrate the speed of the new
33. # "bulk upload" method.
34. t = 0
35. points = []
36. while t < 120:
37.     coord0 = t + 120
38.     coord1 = 40 + math.sin(t)*5
39.     points.append((t, coord0, coord1))
40.     t += 0.01
41. print("%d points" % len(points))
42.
43. # Here's a third example that just stares at the same point.
44. # It can be used to test that the actual coordinates match
45. # what you expect. (For example, you can compare these numbers
46. # to mount.axis0.position_degs, mount.axis0.azimuth_degs, etc.)
47. #points = [
48. #     (10, 180, 45),
49. #     (40, 180, 45),
50. #]
51.
52.
53. #########################################################
54.
55. # Get the JD right now
56. jd0 = pwi4.status().mount.julian_date
57.
58. # Build a table of tuples:
59. #   (jd, coord0_degs, coord1_degs)
60. jd_points = []
61. for point in points:
62.     seconds = point
63.     jd = jd0 + seconds / 86400.0
64.     jd_points.append((jd, point, point))
65.
66. # Start a new path of the selected coordinate type
67. print("Creating new path")
68. pwi4.mount_custom_path_new(coord_type)
69. # Upload a list of points