import logging


def MergeVNSIMAndMOS(mos_dict, nsim_dict):
  """Combines NSIM and MOS CSVs into a dictionary.

  Args:
    mos_dict: Dictionary returned by LoadMOS() function.
    nsim_dict: Dictionary returned by LoadVNSIM() function.

  Returns:
    Dictionary with degraded filename keys and (NSIM, MOS) tuple values.
  """

  # NSIM keys are full paths, wheras MOS keys are filenames
  merged_dict = {}

  for nsim_key, nsim_value in nsim_dict.items():
    # Some nsim values are NaN, skip those.
    if nsim_value == 'nan':
        logging.warn('skipping nan nsim key %s', nsim_key)
        continue

    if nsim_key not in mos_dict:
        logging.warn('skipping missing mos key %s', nsim_key)
        continue

    mos_value = mos_dict[nsim_key]
    merged_dict[nsim_key] = [nsim_value, mos_value]

  return merged_dict