pyaota.grader.autograder module¶
autograder.py
Given a multi-page PDF (one answer sheet per page):
Convert each page to an image
Detect fiducials, warp, read bubbles + QR version label
Look up the correct answers for that version from a CSV
Grade each page
The answer-key CSV should be generated by make_exams.py and have columns:
version_label, Q1, Q2, Q3, …
Example row:
01234567,a,b,c,d,a,…
- Dependencies:
pdf2image
answer_sheet_reader.LayoutConfig
answer_sheet_reader.read_answer_sheet_with_version
- class pyaota.grader.autograder.Autograder(layout_config)[source]¶
Bases:
objectAutograder for multi-page PDF answer sheets.
- grade_pdf(pdf_file_path, output_dir_path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/pyaota/checkouts/latest/docs/source'), failed_pages_dir_path=None, gradebook_paths=None, score_column='score', num_counted=None, question_tally_path=None, debug_output_dir_path=None, interactive=False, column_id=None)[source]¶
Grade the given PDF of answer sheets.
- Parameters:
output_dir_path ([pathlib.Path | str]) – Path of directory in which to save graded overlay PDFs. If None, no graded overlays are written.
failed_pages_dir_path (
Union[Path,str,None]) – Directory to save single-page PDFs and the report for pages that could not be fully read/graded. If None, defaults tooutput_dir_path.gradebook_paths (
Optional[List[Path|str]]) – Paths to one or more non-overlapping gradebook CSV files. Each must contain aStudent IDcolumn. Grading results (version_label,num_questions,num_correct,score,status) are written into the row whoseStudent IDmatches the detected student ID. If None, no gradebooks are updated.score_column (
str) – Column name in the gradebook(s) where the score should be written. Defaults to"score".num_counted (
Optional[int]) – Number of questions that count toward the score. If None, defaults to the total number of questions. Must be <= total questions.question_tally_path (
Union[Path,str,None]) – Path to output CSV file summarizing question tallies. If None, no CSV is writtendebug_output_dir_path (
Union[Path,str,None]) – Directory to save debug output images. If None, no debug images are saved.