Skip to content

Commit

Permalink
Fixes bug introduced by last merge of #437 and addresses comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bennahugo committed Aug 20, 2021
1 parent a7ac46b commit d6ad668
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 3 additions & 1 deletion cubical/data_handler/ms_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def load_ddfacet_models(self, uvwco, loaded_models, model_source, cluster, imod,
ndirs = model_source._nclus
loaded_models[model_source] = {}
ddfsim.set_model_provider(model_source)
log.info("Predicting targetted directions... This may take some time")
log.info("Predicting targeted directions... This may take some time")
for idir, clus in enumerate(model_source._cluster_keys):
ddfsim.set_direction(clus)
model = ddfsim.simulate(self.tile.dh,
Expand Down Expand Up @@ -1141,6 +1141,8 @@ def get_chunk_cubes(self, key, ctype=np.complex128, allocator=np.empty, flag_all

# These points correspond to the autocorrelations - they should always
# be flagged for the purpose of calibration.
assert flags.ndim == 4 and flags.shape[2] == flags.shape[3]
nants = flags.shape[3]
flags[..., range(nants), range(nants)] |= FL.SKIPSOL

obs_arr = subset._column_to_cube(data['obvis'], t_dim, f_dim, row_index, freq_slice, ctype,
Expand Down
27 changes: 19 additions & 8 deletions cubical/machines/interval_gain_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,20 +557,31 @@ def issue_warning(msg, sort_index=70):

if len(bad_dirs):
if log.verbosity() > 1:
def __extract_dirs(d):
if (type(d) is list or type(d) is np.ndarray) and len(d) == 1:
return str(d[0])
elif (type(d) is list or type(d) is np.ndarray):
return ", ".join(d)
else:
return str(d)

def __extract_dirs_perc(d):
if (type(d) is list or type(d) is np.ndarray) and len(d) == 1:
return "{0:.3f}%".format(percflagged[d[0]])
elif (type(d) is list or type(d) is np.ndarray):
return ", ".join(["{0:.3f}%".format(percflagged[dd]) for dd in d])
else:
return "UNDETERMINED"

msg = "{} directions ({}) flagged {}".format(
len(bad_dirs),
", ".join(["dir {0:s}: {1:s} gains affected".format(
str(d[0]) if (type(d) is list or type(d) is np.ndarray) and len(d) == 1 else
", ".join(d) if (type(d) is list or type(d) is np.ndarray) else
str(d),
"{0:.3f}%".format(percflagged[d[0]]) if (type(d) is list or type(d) is np.ndarray) and len(d) == 1 else
", ".join(["{0:.3f}%".format(percflagged[dd]) for dd in d]) if (type(d) is list or type(d) is np.ndarray) else
"UNDETERMINED")
__extract_dirs(d), __extract_dirs_perc(d))
for d in bad_dirs]),
why_flagged)
#import ipdb; ipdb.set_trace()
else:
msg = "{} directions flagged {}. Verbosity level 2 gives a full list of these directions".format(len(bad_dirs), why_flagged)
msg = "{} directions flagged {}. Verbosity level 2 gives a full list of these directions".format(
len(bad_dirs), why_flagged)
issue_warning(msg, 50)

def _update_gain_flags(self, flagtype, flags_arr):
Expand Down

0 comments on commit d6ad668

Please sign in to comment.