Commits
Laszlo Szucs authored 683459d88ae
1180 1180 | return 'hogbom' |
1181 1181 | else: |
1182 1182 | return 'hogbom' |
1183 1183 | |
1184 1184 | def get_min_max_freq(self, spwspec): |
1185 1185 | """ |
1186 1186 | Given a comma separated string list of spectral windows, determines the minimum and maximum |
1187 1187 | frequencies in spectral window list and the corresponding spectral window indexes. |
1188 1188 | |
1189 1189 | :param spwspec: comma separated string list of spectral windows. |
1190 - | :return: tuple min. and max. frequencies (in Hz) and corresponding spw indexes. |
1190 + | :return: dictionary min. and max. frequencies (in Hz) and corresponding spw indexes. |
1191 1191 | """ |
1192 1192 | abs_min_frequency = 1.0e15 |
1193 1193 | abs_max_frequency = 0.0 |
1194 + | min_freq_spwid = -1 |
1195 + | max_freq_spwid = -1 |
1194 1196 | msname = self.vislist[0] |
1195 1197 | ms = self.observing_run.get_ms(name=msname) |
1196 1198 | for spwid in spwspec.split(','): |
1197 1199 | real_spwid = self.observing_run.virtual2real_spw_id(spwid, self.observing_run.get_ms(msname)) |
1198 1200 | spw = ms.get_spectral_window(real_spwid) |
1199 1201 | min_frequency = float(spw.min_frequency.to_units(measures.FrequencyUnits.HERTZ)) |
1200 1202 | if (min_frequency < abs_min_frequency): |
1201 1203 | abs_min_frequency = min_frequency |
1204 + | min_freq_spwid = spwid |
1202 1205 | max_frequency = float(spw.max_frequency.to_units(measures.FrequencyUnits.HERTZ)) |
1203 1206 | if (max_frequency > abs_max_frequency): |
1204 1207 | abs_max_frequency = max_frequency |
1205 - | return (abs_min_frequency, abs_max_frequency) |
1208 + | max_freq_spwid = spwid |
1209 + | return {'abs_min_freq': abs_min_frequency, 'abs_max_freq': abs_max_frequency, |
1210 + | 'min_freq_spwid': min_freq_spwid, 'max_freq_spwid': max_freq_spwid} |
1206 1211 | |
1207 1212 | def get_fractional_bandwidth(self, spwspec): |
1208 1213 | |
1209 1214 | """Returns fractional bandwidth for selected spectral windows""" |
1210 1215 | |
1211 - | abs_min_frequency, abs_max_frequency = self.get_min_max_freq(spwspec) |
1212 - | return 2.0 * (abs_max_frequency - abs_min_frequency) / (abs_min_frequency + abs_max_frequency) |
1216 + | freq_limits = self.get_min_max_freq(spwspec) |
1217 + | return 2.0 * (freq_limits['abs_max_freq'] - freq_limits['abs_min_freq']) / \ |
1218 + | (freq_limits['abs_min_freq'] + freq_limits['abs_max_freq']) |
1213 1219 | |
1214 1220 | def robust(self): |
1215 1221 | |
1216 1222 | """Default robust value.""" |
1217 1223 | |
1218 1224 | return 0.5 |
1219 1225 | |
1220 1226 | def center_field_ids(self, msnames, field, intent, phasecenter, exclude_intent=None): |
1221 1227 | |
1222 1228 | """Get per-MS IDs of field closest to the phase center.""" |