Skip to content

Commit

Permalink
feat(labware): zero out cornerOffsetFromSlot from all current v2 labw…
Browse files Browse the repository at this point in the history
…are defs (#3642)

* zero out all `cornerOffsetFromSlot` x/y/z's in v2 defs & fixtures (none of the ones we have do slot spanning!)
* make `createIrregularLabware` use (0,0,0) offset from slot, instead of using `cornerOffsetFromSlot` to center small labware.
  • Loading branch information
IanLondon authored Jun 27, 2019
1 parent ed6c2a7 commit 9b91298
Show file tree
Hide file tree
Showing 52 changed files with 305 additions and 335 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`LabwareList component renders 1`] = `
},
"cornerOffsetFromSlot": Object {
"x": 0,
"y": 0.32,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -235,8 +235,8 @@ exports[`LabwareList component renders 1`] = `
],
},
"cornerOffsetFromSlot": Object {
"x": 0.01,
"y": -0.02,
"x": 0,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -573,7 +573,7 @@ exports[`LabwareList component renders 1`] = `
},
"cornerOffsetFromSlot": Object {
"x": 0,
"y": -0.01,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -6785,8 +6785,8 @@ exports[`LabwareList component renders 1`] = `
"brand": "generic",
},
"cornerOffsetFromSlot": Object {
"x": 77.76,
"y": 35.48,
"x": 0,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -6900,8 +6900,8 @@ exports[`LabwareList component renders 1`] = `
"brand": "Opentrons",
},
"cornerOffsetFromSlot": Object {
"x": 0.01,
"y": -0.02,
"x": 0,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -8033,8 +8033,8 @@ exports[`LabwareList component renders 1`] = `
"brand": "Opentrons",
},
"cornerOffsetFromSlot": Object {
"x": 0.01,
"y": -0.02,
"x": 0,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6290,7 +6290,7 @@ Object {
},
"cornerOffsetFromSlot": Object {
"x": 0,
"y": 0.32,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -6527,8 +6527,8 @@ Object {
"brand": "Opentrons",
},
"cornerOffsetFromSlot": Object {
"x": 0.01,
"y": -0.02,
"x": 0,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down Expand Up @@ -7676,8 +7676,8 @@ Object {
"brand": "Opentrons",
},
"cornerOffsetFromSlot": Object {
"x": 0.01,
"y": -0.02,
"x": 0,
"y": 0,
"z": 0,
},
"dimensions": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
_irregularWellName,
_generateIrregularLoadName,
_calculateWellCoord,
_calculateCornerOffset,
} from '../index.js'
import { splitWellsOnColumn, sortWells } from '../../helpers/index.js'

Expand All @@ -22,28 +21,6 @@ const exampleLabware1 = {
}

describe('test helper functions', () => {
test('cornerOffsetFromSlot outputs correctly', () => {
// If smaller than slot, positive values
// If larger than slot, negative values
const smallerDims = {
xDimension: 100,
yDimension: 80,
zDimension: 10,
}
const largerDims = {
xDimension: 200,
yDimension: 90,
zDimension: 10,
}
const offset = _calculateCornerOffset(smallerDims)
const offset2 = _calculateCornerOffset(largerDims)

expect(offset.x).toBeGreaterThan(0)
expect(offset.y).toBeGreaterThan(0)
expect(offset2.x).toBeLessThan(0)
expect(offset2.y).toBeLessThan(0)
})

test('Well name generated correctly', () => {
const grid = { row: 2, column: 2 }
const gridStart = [
Expand Down
13 changes: 2 additions & 11 deletions shared-data/js/labwareTools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import range from 'lodash/range'
import round from 'lodash/round'

import labwareSchema from '../../labware/schemas/2.json'
import { SLOT_WIDTH_MM, SLOT_LENGTH_MM } from '../constants'
import {
toWellName,
sortWells,
Expand Down Expand Up @@ -225,14 +224,6 @@ function calculateCoordinates(
}, {})
}

export function _calculateCornerOffset(dimensions: Dimensions): Offset {
return {
x: round(SLOT_LENGTH_MM - dimensions.xDimension, 2),
y: round(SLOT_WIDTH_MM - dimensions.yDimension, 2),
z: 0,
}
}

function ensureBrand(brand?: Brand): Brand {
return brand || { brand: 'generic' }
}
Expand Down Expand Up @@ -279,13 +270,13 @@ export function createRegularLabware(args: RegularLabwareProps): Definition {
brand,
metadata,
dimensions,
cornerOffsetFromSlot: _calculateCornerOffset(dimensions),
wells: calculateCoordinates(well, ordering, spacing, offset),
groups: [{ wells: flatten(ordering), metadata: {} }],
parameters: { ...args.parameters, loadName },
namespace,
version,
schemaVersion: SCHEMA_VERSION,
cornerOffsetFromSlot: { x: 0, y: 0, z: 0 },
})
}

Expand Down Expand Up @@ -325,11 +316,11 @@ export function createIrregularLabware(
brand,
metadata,
dimensions,
cornerOffsetFromSlot: _calculateCornerOffset(dimensions),
parameters: { ...args.parameters, loadName, format: 'irregular' },
ordering: determineIrregularOrdering(Object.keys(wells)),
namespace,
version,
schemaVersion: SCHEMA_VERSION,
cornerOffsetFromSlot: { x: 0, y: 0, z: 0 },
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
"yDimension": 85.57,
"zDimension": 44.04
},
"cornerOffsetFromSlot": {
"x": 0,
"y": -0.09,
"z": 0
},
"wells": {
"A1": {
"depth": 39.22,
Expand Down Expand Up @@ -50,5 +45,10 @@
},
"namespace": "opentrons",
"version": 1,
"schemaVersion": 2
"schemaVersion": 2,
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
12 changes: 6 additions & 6 deletions shared-data/labware/definitions/2/axygen_1_reservoir_90ml/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
"yDimension": 85.47,
"zDimension": 19.05
},
"cornerOffsetFromSlot": {
"x": 0,
"y": 0.01,
"z": 0
},
"wells": {
"A1": {
"depth": 12.42,
Expand Down Expand Up @@ -52,5 +47,10 @@
},
"namespace": "opentrons",
"version": 1,
"schemaVersion": 2
"schemaVersion": 2,
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"displayVolumeUnits": "µL",
"tags": []
},
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
},
"dimensions": {
"yDimension": 85.48,
"xDimension": 127.76,
Expand Down Expand Up @@ -1016,5 +1011,10 @@
"wellBottomShape": "v"
}
}
]
],
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
"yDimension": 85.6,
"zDimension": 20.02
},
"cornerOffsetFromSlot": {
"x": -0.13,
"y": -0.12,
"z": 0
},
"wells": {
"C1": {
"shape": "circular",
Expand Down Expand Up @@ -167,5 +162,10 @@
"wellBottomShape": "flat"
}
}
]
],
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
"yDimension": 85.47,
"zDimension": 20.27
},
"cornerOffsetFromSlot": {
"x": 0,
"y": 0.01,
"z": 0
},
"wells": {
"D1": {
"shape": "circular",
Expand Down Expand Up @@ -289,5 +284,10 @@
"wellBottomShape": "flat"
}
}
]
],
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,6 @@
"displayCategory": "wellPlate",
"tags": []
},
"cornerOffsetFromSlot": {
"x": 0,
"y": -0.01,
"z": 0
},
"dimensions": {
"xDimension": 127.76,
"yDimension": 85.47,
Expand Down Expand Up @@ -4315,5 +4310,10 @@
"wellBottomShape": "flat"
}
}
]
],
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
"displayCategory": "wellPlate",
"tags": []
},
"cornerOffsetFromSlot": {
"x": 0,
"y": -0.01,
"z": 0
},
"dimensions": {
"xDimension": 127.76,
"yDimension": 85.47,
Expand Down Expand Up @@ -531,5 +526,10 @@
"wellBottomShape": "flat"
}
}
]
],
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"displayCategory": "wellPlate",
"tags": []
},
"cornerOffsetFromSlot": {
"x": 0,
"y": 0.01,
"z": 0
},
"schemaVersion": 2,
"version": 1,
"namespace": "opentrons",
Expand Down Expand Up @@ -95,5 +90,10 @@
"wellBottomShape": "flat"
}
}
]
],
"cornerOffsetFromSlot": {
"x": 0,
"y": 0,
"z": 0
}
}
Loading

0 comments on commit 9b91298

Please sign in to comment.