pyaota.generator.answersheet module

class pyaota.generator.answersheet.AnswerSheetGenerator(layout_config, question_list=None)[source]

Bases: object

generate_tex(version_label='')[source]
Return type:

str

generate_tex_full()[source]
class pyaota.generator.answersheet.LayoutConfig(num_questions, student_id_num_digits=8, choice_keys=('a', 'b', 'c', 'd'), tf_keys=('T', 'F'), bubble_radius=<Quantity(24, 'pxl')>, bubble_text_height=<Quantity(3.1, 'millimeter')>, bubble_text_depth=<Quantity(0.9, 'millimeter')>, fill_ratio_threshold=0.2, runner_up_margin=0.09, page_top_margin=<Quantity(1.0, 'inch')>, page_bottom_margin=<Quantity(1.0, 'inch')>, page_left_margin=<Quantity(1.0, 'inch')>, page_right_margin=<Quantity(1.0, 'inch')>, canonical_width=<Quantity(8.5, 'inch')>, canonical_height=<Quantity(11.0, 'inch')>, indicial_sep=<Quantity(0.5, 'millimeter')>, indicial_east_offset=<Quantity(-1.0, 'centimeter')>, indicial_west_offset=<Quantity(1.0, 'centimeter')>, indicial_north_offset=<Quantity(-2.7, 'centimeter')>, indicial_south_offset=<Quantity(1.0, 'centimeter')>, indicial_nw_location=(<Quantity(1.0, 'centimeter')>, <Quantity(2.7, 'centimeter')>), indicial_ne_location=(<Quantity(8.10629921, 'inch')>, <Quantity(2.7, 'centimeter')>), indicial_sw_location=(<Quantity(1.0, 'centimeter')>, <Quantity(10.6062992, 'inch')>), indicial_se_location=(<Quantity(8.10629921, 'inch')>, <Quantity(10.6062992, 'inch')>), indicial_search_nw=(0.12, 0.15), indicial_search_ne=(0.12, 0.15), indicial_search_sw=(0.12, 0.1), indicial_search_se=(0.12, 0.1), name_blank_ul=(<Quantity(1.75, 'inch')>, <Quantity(1.25, 'inch')>), name_blank_size=(<Quantity(5.5, 'inch')>, <Quantity(0.3, 'inch')>), student_id_digit_boxes_ul=(<Quantity(2.25, 'inch')>, <Quantity(1.4, 'inch')>), student_id_digit_boxes_box_size=(<Quantity(100, 'pxl')>, <Quantity(100, 'pxl')>), student_id_digit_boxes_horiz_gap=<Quantity(33, 'pxl')>, student_id_ocr_confidence_threshold=0.7, student_id_digits_cell_margin_frac=0.06, bubble_column_vert_gap=<Quantity(12, 'pxl')>, qr_ul=(<Quantity(6.5, 'inch')>, <Quantity(2.5, 'inch')>), qr_size=<Quantity(1.5, 'centimeter')>, bubble_font_size_pt=8.0, force_odd_page=False, warning_line_opacity=0.75, overlay_correct_choice_color=(0, 255, 0), overlay_incorrect_choice_color=(0, 0, 255), bubble_field_num_questions_per_block=5, bubble_field_num_cols=3, bubble_field_header_gap=<Quantity(0.867, 'inch')>, bubble_field_block_gap=(<Quantity(1.25, 'centimeter')>, <Quantity(1, 'centimeter')>), intrablock_row_gap=<Quantity(60, 'pxl')>, intrablock_choice_gap=<Quantity(10, 'pxl')>, intrablock_numbering_gap=<Quantity(30, 'pxl')>, id_report_position=(<Quantity(6.5, 'inch')>, <Quantity(0.45, 'inch')>), version_report_position=(<Quantity(0.5, 'inch')>, <Quantity(0.45, 'inch')>))[source]

Bases: object

bubble_column_vert_gap: Quantity = <Quantity(12, 'pxl')>
bubble_field_block_gap: Tuple[Quantity, Quantity] = (<Quantity(1.25, 'centimeter')>, <Quantity(1, 'centimeter')>)
bubble_field_header_gap: Quantity = <Quantity(0.867, 'inch')>
bubble_field_num_cols: int = 3
bubble_field_num_questions_per_block: int = 5
bubble_field_ul: Tuple[Quantity, Quantity]
bubble_font_size_pt: float = 8.0
bubble_radius: Quantity = <Quantity(24, 'pxl')>
bubble_text_depth: Quantity = <Quantity(0.9, 'millimeter')>
bubble_text_height: Quantity = <Quantity(3.1, 'millimeter')>
canonical_height: Quantity = <Quantity(11.0, 'inch')>
canonical_width: Quantity = <Quantity(8.5, 'inch')>
choice_keys: Sequence[str] = ('a', 'b', 'c', 'd')
fill_ratio_threshold: float = 0.2
force_odd_page: bool = False
get_indicial_search_regions(img_shape)[source]

Get pixel-based search regions for locating indicials in raw image.

Parameters:

img_shape – (height, width) of the image

Returns:

dict with keys ‘nw’, ‘ne’, ‘sw’, ‘se’, each containing (x1, y1, x2, y2)

id_report_position: Tuple[Quantity, Quantity] = (<Quantity(6.5, 'inch')>, <Quantity(0.45, 'inch')>)
indicial_east_offset: Quantity = <Quantity(-1.0, 'centimeter')>
indicial_ne_location: Tuple[Quantity, Quantity] = (<Quantity(8.10629921, 'inch')>, <Quantity(2.7, 'centimeter')>)
indicial_north_offset: Quantity = <Quantity(-2.7, 'centimeter')>
indicial_nw_location: Tuple[Quantity, Quantity] = (<Quantity(1.0, 'centimeter')>, <Quantity(2.7, 'centimeter')>)
indicial_se_location: Tuple[Quantity, Quantity] = (<Quantity(8.10629921, 'inch')>, <Quantity(10.6062992, 'inch')>)
indicial_search_ne: Tuple[float, float] = (0.12, 0.15)
indicial_search_nw: Tuple[float, float] = (0.12, 0.15)
indicial_search_se: Tuple[float, float] = (0.12, 0.1)
indicial_search_sw: Tuple[float, float] = (0.12, 0.1)
indicial_sep: Quantity = <Quantity(0.5, 'millimeter')>
indicial_south_offset: Quantity = <Quantity(1.0, 'centimeter')>
indicial_sw_location: Tuple[Quantity, Quantity] = (<Quantity(1.0, 'centimeter')>, <Quantity(10.6062992, 'inch')>)
indicial_west_offset: Quantity = <Quantity(1.0, 'centimeter')>
intrablock_choice_gap: Quantity = <Quantity(10, 'pxl')>
intrablock_numbering_gap: Quantity = <Quantity(30, 'pxl')>
intrablock_row_gap: Quantity = <Quantity(60, 'pxl')>
name_blank_size: Tuple[Quantity, Quantity] = (<Quantity(5.5, 'inch')>, <Quantity(0.3, 'inch')>)
name_blank_ul: Tuple[Quantity, Quantity] = (<Quantity(1.75, 'inch')>, <Quantity(1.25, 'inch')>)
num_questions: int
overlay_correct_choice_color: Tuple[int, int, int] = (0, 255, 0)
overlay_incorrect_choice_color: Tuple[int, int, int] = (0, 0, 255)
page_bottom_margin: Quantity = <Quantity(1.0, 'inch')>
page_left_margin: Quantity = <Quantity(1.0, 'inch')>
page_right_margin: Quantity = <Quantity(1.0, 'inch')>
page_top_margin: Quantity = <Quantity(1.0, 'inch')>
qr_size: Quantity = <Quantity(1.5, 'centimeter')>
qr_ul: Tuple[Quantity, Quantity] = (<Quantity(6.5, 'inch')>, <Quantity(2.5, 'inch')>)
runner_up_margin: float = 0.09
student_id_digit_boxes_box_size: Tuple[Quantity, Quantity] = (<Quantity(100, 'pxl')>, <Quantity(100, 'pxl')>)
student_id_digit_boxes_horiz_gap: Quantity = <Quantity(33, 'pxl')>
student_id_digit_boxes_ul: Tuple[Quantity, Quantity] = (<Quantity(2.25, 'inch')>, <Quantity(1.4, 'inch')>)
student_id_digits_cell_margin_frac: float = 0.06
student_id_num_digits: int = 8
student_id_ocr_confidence_threshold: float = 0.7
tf_keys: Sequence[str] = ('T', 'F')
version_report_position: Tuple[Quantity, Quantity] = (<Quantity(0.5, 'inch')>, <Quantity(0.45, 'inch')>)
warning_line_opacity: float = 0.75
pyaota.generator.answersheet.setup_ureg()[source]
Return type:

UnitRegistry