1. A method for measuring flatness along a Z-axis of a detection stage, the method comprising: (a) at an electronic device comprising an objective, a light source, a camera, and the detection stage, positioning a substantially flat substrate on the detection stage perpendicular to the objective, the camera, and the light source; (b) obtaining two or more images of a first XY coordinate on a substantially flat substrate positioned on the detection stage, wherein the two or more images represent different Z coordinates at the first XY coordinate; (c) determining a sharpest Z coordinate at the first XY coordinate based on sharpness of the two or more images representing different Z coordinates at the first XY coordinate; (d) obtaining two or more images of a second XY coordinate spaced apart from the first XY coordinate on the substantially flat substrate, wherein the two or more images of the second XY coordinate represent different Z coordinates at the second XY coordinate; (e) determining a sharpest Z coordinate at the second XY coordinate based on sharpness of the two or more images representing different Z coordinates at the second XY coordinate; (f) calculating a difference between the sharpest Z coordinate at the first XY coordinate and the sharpest Z coordinate at the second XY coordinate to measure the flatness of the detection stage along the Z-axis; (g) positioning an assay plate on the detection stage perpendicular to the objective, the camera, and the light source, wherein the assay plate comprises: a plurality of encoded microcarriers, and a solution comprising at least a first analyte, wherein at least a first encoded microcarrier of the plurality comprises a capture agent specific for the first analyte; (h) obtaining a first image of the assay plate, wherein first image comprises an image of the code of the first encoded microcarrier; and (i) obtaining a second image of the assay plate, wherein the second image detects an amount of the first analyte bound to the first encoded microcarrier by the capture agent.