Skip to content

Instantly share code, notes, and snippets.

@cyber-murmel
Created February 17, 2020 14:24
Show Gist options
  • Save cyber-murmel/a52276e3f6bdc9d05b60d7129335a7af to your computer and use it in GitHub Desktop.
Save cyber-murmel/a52276e3f6bdc9d05b60d7129335a7af to your computer and use it in GitHub Desktop.
DataMatrix Capacity
# each datamatrix size can fit as many numbers as according to the following dict
# a non-number letter needs double as much space as a number
# an emoji need 16x as much space as a number 😂
size_capacity_maps = {
'square': {
'10x10': 6, '12x12': 10, '14x14': 16, '16x16': 24,
'18x18': 36, '20x20': 44, '22x22': 60, '24x24': 72,
'26x26': 88, '32x32': 124, '36x36': 172, '40x40': 228,
'44x44': 288, '48x48': 348, '52x52': 408, '64x64': 560,
'72x72': 736, '80x80': 912, '88x88': 1152, '96x96': 1392,
'104x104': 1632, '120x120': 2100, '132x132': 2608, '144x144': 3116
},
'rect' : {
'8x18': 10, '8x32': 20, '12x26': 32, '12x36': 44,
'16x36': 64, '16x48': 98
}
}
# generate inverted map
capacity_size_maps = {
shape: {
value: key for key, value in size_capacity_maps[shape].items()
} for shape in size_capacity_maps
}
capacities = list({value for size_capacity_map in size_capacity_maps.values() for value in size_capacity_map.values()})
capacities.sort()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment