import round from 'lodash/round' ; import type { LabwareCalibration } from '../types' ; import type { LabwareCalibrationData , BaseProtocolLabware } from './types' ; const normalizeParent = ( parent ) : string | null => parent === '' || parent === null ? null : parent ; export const matchesLabwareIdentityForQuantity = ( target , compare ) : boolean => { return ( target . loadName === compare . loadName && target . namespace === compare . namespace && target . version === compare . version && normalizeParent ( target . parent ) === normalizeParent ( compare . parent ) ) ; } ; export const matchesLabwareIdentityForCalibration = ( target , compare ) : boolean => { return ( target . definitionHash === compare . definitionHash && normalizeParent ( target . parent ) === normalizeParent ( compare . parent ) ) ; } ; export function formatCalibrationData ( model ) { const calVector = model . calibrationData . offset . value . map ( n => round ( n , 1 ) ) ; return { x : calVector [ 0 ] , y : calVector [ 1 ] , z : calVector [ 2 ] } ; }