Commit f535b982 authored by alex's avatar alex

choose another refant if no stations left after filtering

parent dc54ef14
Pipeline #11863 failed with stages
in 10 minutes and 46 seconds
......@@ -46,19 +46,26 @@ requirements:
with open('input.json', 'r') as f_stream:
flagged_fraction_dict_list = json.load(f_stream)
filter_station = '$(inputs.filter_station)'
no_station_selected = True
flagged_fraction_data = {}
for flagged_fraction_dict in flagged_fraction_dict_list:
entry = ast.literal_eval(flagged_fraction_dict)
antennas = entry.keys()
selected_stations = [ station_name for station_name in antennas if re.match(filter_station, station_name) ]
if len(selected_stations) == 0:
raiseError('No stations left after filtering.')
for antenna in selected_stations:
try:
flagged_fraction_data[antenna].append(float(entry[antenna]))
except KeyError:
flagged_fraction_data[antenna] = [float(entry[antenna])]
while no_station_selected:
print('Applying station filter ' + str(filter_station))
flagged_fraction_data = {}
no_station_selected = False
for flagged_fraction_dict in flagged_fraction_dict_list:
entry = ast.literal_eval(flagged_fraction_dict)
antennas = entry.keys()
selected_stations = [ station_name for station_name in antennas if re.match(filter_station, station_name) ]
if len(selected_stations) == 0:
print('No stations left after filtering. Station(s) do(es) not exist in all subbands. No filter is used.')
filter_station = ''
no_station_selected = True
break
for antenna in selected_stations:
try:
flagged_fraction_data[antenna].append(float(entry[antenna]))
except KeyError:
flagged_fraction_data[antenna] = [float(entry[antenna])]
flagged_fraction_list = []
sorted_stations = sorted(flagged_fraction_data.keys())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment