42 """ Target handler for compass simulation
45 sources : (List) : List of SutraSource instances used for raytracing
47 _target : (sutraWrap.Target) : Sutra target instance
49 _context : (carmaContext) : CarmaContext instance
51 _config : (config module) : Parameters configuration structure module
53 def __init__(self, context, config, tel):
54 """ Initialize a TargetCompass component for target related supervision
57 context : (carmaContext) : CarmaContext instance
59 config : (config module) : Parameters configuration structure module
61 tel : (TelescopeCompass) : A TelescopeCompass instance
65 print(
"->target init")
68 self.
_config_config.p_geom, self.
_config_config.p_dms, brahma=
False)
71 def get_tar_image(self, tar_index : int, *, expo_type: str =
"se") -> np.ndarray:
72 """ Get the PSF in the direction of the given target
75 tar_index : (int) : Index of target
78 expo_type : (str) : "se" for short exposure (default)
79 "le" for long exposure
82 psf : (np.ndarray) : PSF
84 if (expo_type ==
"se"):
85 return np.fft.fftshift(
86 np.array(self.
_target_target.d_targets[tar_index].d_image_se))
87 elif (expo_type ==
"le"):
88 nb = self.
_target_target.d_targets[tar_index].strehl_counter
90 return np.fft.fftshift(np.array(self.
_target_target.d_targets[tar_index].d_image_le)) / nb
92 raise ValueError(
"Unknown exposure type")
95 """ Set the phase screen seen by the tar
98 tar_index : (int) : target index
100 phase : (np.ndarray) : phase screen to set
102 self.
_target_target.d_targets[tar_index].set_phase(phase)
104 def get_tar_phase(self, tar_index: int, *, pupil: bool =
False) -> np.ndarray:
105 """ Returns the target phase screen of target number tar_index
108 tar_index : (int) : Target index
111 pupil : (bool) : If True, applies the pupil on top of the phase screen
115 tar_phase : (np.ndarray) : Target phase screen
117 tar_phase = np.array(self.
_target_target.d_targets[tar_index].d_phase)
119 pup = self.
_config_config.p_geom._spupil
124 """ Reset the Strehl Ratio of the target tar_index
127 tar_index : (int) : Target index
129 self.
_target_target.d_targets[tar_index].reset_strehlmeter()
132 """ Reset the phase screen of the target tar_index
135 tar_index : (int) : Target index
137 self.
_target_target.d_targets[tar_index].d_phase.reset()
139 def get_strehl(self, tar_index: int, *, do_fit: bool =
True) -> np.ndarray:
140 """ Return the Strehl Ratio of target number tar_index.
141 This fuction will return an array of 4 values as
142 [SR SE, SR LE, phase variance SE [rad²], phase variance LE [rad²]]
145 tar_index : (int) : Target index
148 do_fit : (bool) : If True (default), fit the PSF
149 with a sinc before computing SR
152 strehl : (np.ndarray) : Strehl ratios and phase variances
154 src = self.
_target_target.d_targets[tar_index]
155 src.comp_strehl(do_fit)
157 if (src.phase_var_count > 0):
158 avg_var = src.phase_var_avg / src.phase_var_count
159 return [src.strehl_se, src.strehl_le, src.phase_var, avg_var]
162 """ Return the current NCPA phase screen of the target path
165 tar_index : (int) : Index of the target
168 ncpa : (np.ndarray) : NCPA phase screen
170 return np.array(self.
_target_target.d_targets[tar_index].d_ncpa_phase)
172 def set_ncpa_tar(self, tar_index: int, ncpa: np.ndarray) ->
None:
173 """ Set the additional fixed NCPA phase in the target path.
174 ncpa must be of the same size of the spupil support
177 tar_index : (int) : WFS index
179 ncpa : (ndarray) : NCPA phase screen to set [µm]
181 self.
_target_target.d_targets[tar_index].set_ncpa(ncpa)
183 def comp_tar_image(self, tarNum: int, *, puponly: int = 0, compLE: bool =
True) ->
None:
187 tarNum: (int): target index
190 puponly: (int) : if set to 1, computes Airy (default=0)
192 compLE: (bool) : if True, the computed image is taken into account in long exposure image (default=True)
194 self.
_target_target.d_targets[tarNum].comp_image(puponly, compLE)
196 def comp_strehl(self, tarNum: int, *, do_fit: bool =
True) ->
None:
197 """ Computes the Strehl ratio
200 tarNum: (int): target index
203 do_fit: (bool): Flag for enabling fitting by sinc
Source handler for compass simulation.
sources
(List) : List of SutraSource instances
Target handler for compass simulation.
None reset_tar_phase(self, int tar_index)
Reset the phase screen of the target tar_index.
None set_tar_phase(self, int tar_index, np.ndarray phase)
Set the phase screen seen by the tar.
None set_ncpa_tar(self, int tar_index, np.ndarray ncpa)
Set the additional fixed NCPA phase in the target path.
None comp_tar_image(self, int tarNum, *int puponly=0, bool compLE=True)
Computes the PSF.
def __init__(self, context, config, tel)
np.ndarray get_strehl(self, int tar_index, *bool do_fit=True)
Return the Strehl Ratio of target number tar_index.
np.ndarray get_tar_image(self, int tar_index, *str expo_type="se")
Get the PSF in the direction of the given target.
np.ndarray get_ncpa_tar(self, int tar_index)
Return the current NCPA phase screen of the target path.
None comp_strehl(self, int tarNum, *bool do_fit=True)
Computes the Strehl ratio.
np.ndarray get_tar_phase(self, int tar_index, *bool pupil=False)
Returns the target phase screen of target number tar_index.
None reset_strehl(self, int tar_index)
Reset the Strehl Ratio of the target tar_index.
sources
(List) : List of SutraSource instances used for raytracing
Initialization of a Target object.