def load_squid_info_from_hk(screen, y, x, hk_map, sq_dev_id, sq_label, sq_label_size, max_size, serial_mapper):
    carrier_good = False
    nuller_good = False
    demod_good = False
    temp_good = False
    volt_good = False
    bolometer_good = False
    full_label = 'NoData'
    fir_stage = 0
    routing_good = False
    feedback_on = False
    (board_id, mezz_num, module_num) = sq_phys_id_to_info(sq_dev_id)
    board_serial = serial_mapper.get_serial(board_id)
    if ((not (hk_map is None)) and (board_serial in hk_map)):
        board_info = hk_map[board_serial]
        mezz_info = hk_map[board_serial].mezz[mezz_num]
        module_info = hk_map[board_serial].mezz[mezz_num].modules[module_num]
        fir_stage = int(board_info.fir_stage)
        routing_good = (module_info.routing_type.lower() == 'routing_nul')
        feedback_on = (module_info.squid_feedback.lower() == 'squid_lowpass')
        carrier_good = (not module_info.carrier_railed)
        nuller_good = (not module_info.nuller_railed)
        demod_good = (not module_info.demod_railed)

        def dic_range_check(dr, dv):
            for k in dv.keys():
                if (not (k in dr)):
                    continue
                rng = dr[k]
                v = dv[k]
                if ((v < rng[0]) or (v > rng[1])):
                    return False
            return True
        voltage_range = {'MOTHERBOARD_RAIL_VCC5V5': (5, 6), 'MOTHERBOARD_RAIL_VADJ': (2, 3), 'MOTHERBOARD_RAIL_VCC3V3': (3, 3.6), 'MOTHERBOARD_RAIL_VCC1V0': (0.8, 1.2), 'MOTHERBOARD_RAIL_VCC1V2': (1, 1.5), 'MOTHERBOARD_RAIL_VCC12V0': (11, 13), 'MOTHERBOARD_RAIL_VCC1V8': (1.6, 2), 'MOTHERBOARD_RAIL_VCC1V5': (1.3, 1.7), 'MOTHERBOARD_RAIL_VCC1V0_GTX': (0.7, 1.3)}
        temp_range = {'MOTHERBOARD_TEMPERATURE_FPGA': (0, 80), 'MOTHERBOARD_TEMPERATURE_POWER': (0, 80), 'MOTHERBOARD_TEMPERATURE_ARM': (0, 80), 'MOTHERBOARD_TEMPERATURE_PHY': (0, 80)}
        mezz_voltage_range = {'MEZZANINE_RAIL_VCC12V0': (11, 13), 'MEZZANINE_RAIL_VADJ': (2, 3), 'MEZZANINE_RAIL_VCC3V3': (3, 4)}
        temp_good = dic_range_check(temp_range, board_info.temperatures)
        volt_good = (dic_range_check(voltage_range, board_info.voltages) or dic_range_check(mezz_voltage_range, mezz_info.voltages))
        bolometer_good = True
        bolo_label = ''
        n_railed = 0
        n_diff_freq = 0
        n_dan_off = 0
        for b in module_info.channels.keys():
            chinfo = module_info.channels[b]
            if chinfo.dan_railed:
                n_railed += 1
            elif (chinfo.carrier_frequency != chinfo.demod_frequency):
                n_diff_freq += 1
            elif ((not (chinfo.dan_accumulator_enable and chinfo.dan_feedback_enable and chinfo.dan_streaming_enable)) and ((chinfo.carrier_frequency > 0) and (chinfo.carrier_amplitude > 0))):
                n_dan_off += 1
        bolometer_good = (not (n_railed or n_diff_freq or n_dan_off))
        if (not bolometer_good):
            if n_railed:
                full_label = ('DanRail:%s' % n_railed)
            elif n_diff_freq:
                full_label = ('CDDiffFreq:%s' % n_diff_freq)
            elif n_dan_off:
                full_label = ('DanOff:%s' % n_dan_off)
        else:
            full_label = ''
    add_squid_info(screen, y, x, sq_label, sq_label_size, carrier_good, nuller_good, demod_good, temp_good, volt_good, max_size, bolometer_good, fir_stage, feedback_on, bolo_label=full_label)
def load_squid_info_from_hk(screen, y, x, hk_map, sq_dev_id, sq_label, sq_label_size, max_size, serial_mapper):
    carrier_good = False
    nuller_good = False
    demod_good = False
    temp_good = False
    volt_good = False
    bolometer_good = False
    full_label = 'NoData'
    fir_stage = 0
    routing_good = False
    feedback_on = False
    (board_id, mezz_num, module_num) = sq_phys_id_to_info(sq_dev_id)
    board_serial = serial_mapper.get_serial(board_id)
    if ((not (hk_map is None)) and (board_serial in hk_map)):
        board_info = hk_map[board_serial]
        mezz_info = hk_map[board_serial].mezz[mezz_num]
        module_info = hk_map[board_serial].mezz[mezz_num].modules[module_num]
        fir_stage = int(board_info.fir_stage)
        routing_good = (module_info.routing_type.lower() == 'routing_nul')
        feedback_on = (module_info.squid_feedback.lower() == 'squid_lowpass')
        carrier_good = (not module_info.carrier_railed)
        nuller_good = (not module_info.nuller_railed)
        demod_good = (not module_info.demod_railed)

        def dic_range_check(dr, dv):
            for k in dv.keys():
                if (not (k in dr)):
                    continue
                rng = dr[k]
                v = dv[k]
                if ((v < rng[0]) or (v > rng[1])):
                    return False
            return True
        voltage_range = {'MOTHERBOARD_RAIL_VCC5V5': (5, 6), 'MOTHERBOARD_RAIL_VADJ': (2, 3), 'MOTHERBOARD_RAIL_VCC3V3': (3, 3.6), 'MOTHERBOARD_RAIL_VCC1V0': (0.8, 1.2), 'MOTHERBOARD_RAIL_VCC1V2': (1, 1.5), 'MOTHERBOARD_RAIL_VCC12V0': (11, 13), 'MOTHERBOARD_RAIL_VCC1V8': (1.6, 2), 'MOTHERBOARD_RAIL_VCC1V5': (1.3, 1.7), 'MOTHERBOARD_RAIL_VCC1V0_GTX': (0.7, 1.3)}
        temp_range = {'MOTHERBOARD_TEMPERATURE_FPGA': (0, 80), 'MOTHERBOARD_TEMPERATURE_POWER': (0, 80), 'MOTHERBOARD_TEMPERATURE_ARM': (0, 80), 'MOTHERBOARD_TEMPERATURE_PHY': (0, 80)}
        mezz_voltage_range = {'MEZZANINE_RAIL_VCC12V0': (11, 13), 'MEZZANINE_RAIL_VADJ': (2, 3), 'MEZZANINE_RAIL_VCC3V3': (3, 4)}
        temp_good = dic_range_check(temp_range, board_info.temperatures)
        volt_good = (dic_range_check(voltage_range, board_info.voltages) or dic_range_check(mezz_voltage_range, mezz_info.voltages))
        bolometer_good = True
        bolo_label = 
        n_railed = 0
        n_diff_freq = 0
        n_dan_off = 0
        for b in module_info.channels.keys():
            chinfo = module_info.channels[b]
            if chinfo.dan_railed:
                n_railed += 1
            elif (chinfo.carrier_frequency != chinfo.demod_frequency):
                n_diff_freq += 1
            elif ((not (chinfo.dan_accumulator_enable and chinfo.dan_feedback_enable and chinfo.dan_streaming_enable)) and ((chinfo.carrier_frequency > 0) and (chinfo.carrier_amplitude > 0))):
                n_dan_off += 1
        bolometer_good = (not (n_railed or n_diff_freq or n_dan_off))
        if (not bolometer_good):
            if n_railed:
                full_label = ('DanRail:%s' % n_railed)
            elif n_diff_freq:
                full_label = ('CDDiffFreq:%s' % n_diff_freq)
            elif n_dan_off:
                full_label = ('DanOff:%s' % n_dan_off)
        else:
            full_label = 
    add_squid_info(screen, y, x, sq_label, sq_label_size, carrier_good, nuller_good, demod_good, temp_good, volt_good, max_size, bolometer_good, fir_stage, feedback_on, bolo_label=full_label)