-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
100 lines (82 loc) · 2.94 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""
Offset TA Tools
Author: Jonathan Aguilar
Latest update: April 17, 2024
USAGE
-----
This script is provided as an example for importing compute_offsets as a module
into other code. Users should edit the `slew_to`, `slew_from`, `v3`, and
`coron_id` variables using the appropriate values for their observation. The
instructions for editing each section are written in comments in the script.
Once the user has entered the requested values, they should run `example.py` as
a a script. `example.py` will call tools from `compute_offsets.py` and print
out the appropriate X and Y offsets to enter into APT. `example.py` and
`compute_offsets.py` must be located in the same folder.
If the users wish to use the offsets for their own code, instead of just
printing them to screen, they can pass the argument `return_offsets=True` to
compute_offsets.compute_offsets(). It is suggested that users make a new copy
of this script for each variation of acquisition target, science target, and V3
angle.
Requirements:
- numpy
- matplotlib
- astropy
- pySIAF
- compute_offsets.py
"""
from astropy.coordinates import SkyCoord
from miri_coro_offset_ta import compute_offsets
###############################
###### BEGIN USER INPUT #######
###############################
# Star positions - make sure to enter all values.
# The coordinates should be given *at the time of observation*
# By default, we expect the coordinates to be given in RA, Dec system,
# in units of degrees, and in the ICRS frame.
# Users who are comfortable with astropy.coordiantes.SkyCoord may set them
# as they like.
# The "slew_to" variable stores the position of the final target of the observations.
# The "slew_from" variable stores the position of the star that is used for TA.
slew_to = {
'label': 'B component',
'position': SkyCoord(
272.81221024, 69.24905315,
unit='deg',
frame='icrs',
)
}
slew_from = {
'label': 'A component',
'position': SkyCoord(
272.81369648, 69.25014279,
unit='deg',
frame='icrs',
)
}
# Telescope V3PA
# enter the PA angle of the *telescope* V3 axis, at the time of the observation
v3pa = 320.074
# Choose a coronagraph by assigning one of the following to `coron_id`:
# 1065, 1140, 1550, LYOT
coron_id = '1550'
# Plotting - set to False if you don't want to show plots, or True if you do
# If False, other plotting commands are ignored.
# plot_full is a switch for plotting the Imager footprint as well
show_plots = True
plot_full = True
###############################
######## END USER INPUT #######
###############################
# Script takes over from here #
###############################
if __name__ == "__main__":
dx, dy = compute_offsets.compute_offsets(
slew_from, slew_to, v3pa, coron_id,
verbose = False,
show_plots = show_plots,
plot_full = plot_full,
return_offsets = True,
)
print("Offsets: ")
print(f"\tdx: {dx:+4.5f}")
print(f"\tdy: {dy:+4.5f}")