def load_calibration(labware: Labware):
    """
    Look up a calibration if it exists and apply it to the given labware.
    """
    calibration_path = CONFIG['labware_calibration_offsets_dir_v4']
    labware_offset_path = calibration_path/'{}.json'.format(labware._id)
    if labware_offset_path.exists():
        calibration_data = _read_file(str(labware_offset_path))
        offset_array = calibration_data['default']['offset']
        offset = Point(x=offset_array[0], y=offset_array[1], z=offset_array[2])
        labware.set_calibration(offset)
        if 'tipLength' in calibration_data.keys():
            tip_length = calibration_data['tipLength']['length']
            labware.tip_length = tip_length
def load_calibration ( labware : Labware ) : calibration_path = CONFIG [ 'labware_calibration_offsets_dir_v4' ] labware_offset_path = calibration_path / '{}.json' . format ( labware . _id ) if labware_offset_path . exists ( ) : calibration_data = _read_file ( str ( labware_offset_path ) ) offset_array = calibration_data [ 'default' ] [ 'offset' ] offset = Point ( x = offset_array [ 0 ] , y = offset_array [ 1 ] , z = offset_array [ 2 ] ) labware . set_calibration ( offset ) if 'tipLength' in calibration_data . keys ( ) : tip_length = calibration_data [ 'tipLength' ] [ 'length' ] labware . tip_length = tip_length
Look up a calibration if it exists and apply it to the given labware.