Graders¶
Axial Non Uniformity Grader¶
- class gs1grader.graders.axial_non_uniformity_grader.AxialNonUniformityGrader[source]¶
Bases:
DataMatrixGraderInterfaceGrader for evaluating the axial non-uniformity of a Data Matrix code.
Axial non-uniformity measures the consistency of module spacing along the horizontal and vertical axes of the Data Matrix. Lower axial non-uniformity values indicate more consistent spacing between modules, which improves readability and scanning reliability.
The axial non-uniformity grade is determined by the following thresholds: - Grade A: Less than or equal to 6% - Grade B: 7% to 8% - Grade C: 9% to 10% - Grade D: 11% to 12% - Grade F: Greater than 12%
- compute_grade(decoded_data: DecodedDmtxData)[source]¶
Compute axial non-uniformity grade for the given data matrix parameters.
- Parameters:
decoded_data (DecodedDmtxData) – The decoded DataMatrix data containing grid information
- Returns:
The grade of the grid non-uniformity (A, B, C, D, or F)
- Return type:
Fixed Pattern Damage Grader¶
- class gs1grader.graders.fixed_pattern_damage_grader.FixedPatternDamageGrader[source]¶
Bases:
DataMatrixGraderInterfaceGrader for evaluating the fixed pattern damage of a Data Matrix code.
Fixed pattern damage assesses the integrity of the finder pattern and clock pattern (L-shaped patterns) of the Data Matrix. These patterns are critical for scanner orientation and timing. Damage to these fixed patterns can significantly impact the readability and decodability of the Data Matrix symbol.
Grid Non Uniformity Grader¶
- class gs1grader.graders.grid_non_uniformity_grader.GridNonUniformityGrader[source]¶
Bases:
DataMatrixGraderInterfaceGrader for evaluating the grid non-uniformity of a Data Matrix code.
Grid non-uniformity measures the deviation of the grid intersections from their ideal position. Lower grid non-uniformity values indicate more consistent and accurate grid positioning, which improves readability and scanning reliability.
The grid non-uniformity grade is determined by the following thresholds: - Grade A: Less than or equal to 0.38 - Grade B: 0.39 to 0.50 - Grade C: 0.51 to 0.63 - Grade D: 0.64 to 0.75 - Grade F: Greater than 0.75
Modulation Grader¶
- class gs1grader.graders.modulation_grader.ModulationGrader[source]¶
Bases:
DataMatrixGraderInterfaceGrader for evaluating the modulation quality of a Data Matrix code.
Modulation measures the contrast between light and dark modules in the Data Matrix. Higher modulation values indicate better contrast between modules, which improves readability and scanning reliability.
The modulation grade is determined by the following thresholds: - Grade A: 50% or higher - Grade B: 40% to 50% - Grade C: 30% to 40% - Grade D: 20% to 30% - Grade F: Less than 20%
- compute_grade(decoded_data: DecodedDmtxData) str[source]¶
Compute modulation grade based on color values.
This method calculates the modulation grade by analyzing the contrast between light and dark modules in the DataMatrix code.
- Parameters:
decoded_data (DecodedDmtxData) – The decoded DataMatrix data containing: - fit_x: X coordinates of the fitted grid points - fit_y: Y coordinates of the fitted grid points - color: Color values at each grid point - dmtx_size_row: Number of rows in the DataMatrix - dmtx_size_col: Number of columns in the DataMatrix
- Returns:
The grade of the modulation (A, B, C, D, or F)
- Return type:
- explain_grade(decoded_data: DecodedDmtxData, explanation_path: str) str[source]¶
Generate a visual explanation of the modulation grading.
This method creates a visualization of the DataMatrix with color-coded borders indicating the modulation grade of each module. The visualization is saved as an image file in the specified path.
Symbol Contrast Grader¶
- class gs1grader.graders.symbol_contrast_grader.SymbolContrastGrader[source]¶
Bases:
DataMatrixGraderInterfaceGrader for evaluating the symbol contrast of a Data Matrix code.
Symbol contrast measures the difference between the reflectance of light and dark modules in the Data Matrix. Higher symbol contrast values indicate better differentiation between light and dark modules, which improves readability and scanning reliability.
The symbol contrast grade is determined by the following thresholds: - Grade A: 70% or higher - Grade B: 55% to 70% - Grade C: 40% to 55% - Grade D: 20% to 40% - Grade F: Less than 20%
- compute_grade(decoded_data: DecodedDmtxData) str[source]¶
Compute symbol contrast grade based on color values.
Symbol contrast is the difference between the reflectance of light and dark modules. This method calculates the symbol contrast value and determines the grade based on predefined thresholds.
- Parameters:
decoded_data (DecodedDmtxData) – The decoded DataMatrix data containing information about the modules and their color values.
- Returns:
The grade of the symbol contrast (A, B, C, D, or F).
- Return type:
Unused Error Correction Grader¶
- class gs1grader.graders.uec_grader.UECGrader[source]¶
Bases:
DataMatrixGraderInterfaceGrader for Unused Error Correction (UEC) in Data Matrix codes.
This grader evaluates the amount of unused error correction capacity in a Data Matrix code. Higher unused error correction indicates better robustness against potential damage or scanning issues.
The UEC grade is determined by the percentage of error correction capacity that remains unused in the Data Matrix code. A higher percentage results in a better grade, indicating more resilience against errors.
The UEC grade is determined by the following thresholds: - Grade A: Greater than or equal to 62% unused error correction - Grade B: 50% to 61% unused error correction - Grade C: 37% to 49% unused error correction - Grade D: 25% to 36% unused error correction - Grade F: Less than 25% unused error correction
- compute_grade(decoded_data)[source]¶
Compute the Unused Error Correction (UEC) grade for the given data matrix.
This method calculates the grade based on the percentage of unused error correction capacity in the Data Matrix code.
- Parameters:
decoded_data (DecodedDmtxData) – Contains decoded Data Matrix information
- Returns:
The grade of the unused error correction (A, B, C, D, or F)
- Return type:
- GS1:
The grade is determined by the percentage of error correction capacity that remains unused. Grade A (4.0) indicates high unused capacity, while Grade F (0.0) indicates little to no unused capacity.