|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "73620923-8165-4d80-a81a-cb768294cc6f", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "Week 3 Assignment: Knitting Pattern Calculator Project Report\n", |
| 9 | + "\n", |
| 10 | + "1. Project Overview\n", |
| 11 | + "Knitting a custom sweater from the top down requires translating physical body measurements into a discrete grid of stitches and rows based on a individual knitting gauge. Manual conversion often leads to structural math errors. Furthermore, knitters wanting to incorporate multi-colored intarsia or stranded motifs (\"alpha patterns\") must manually map those pixel charts onto their specific garment dimensions, which is a slow and error-prone process.\n", |
| 12 | + "\n", |
| 13 | + "This project automates both tasks. It pairs a Streamlit web interface with a specialized Python backend that accepts pixel-based alpha patterns, calculates necessary fabric grading, and automatically generates a matching color chart, text instructions, and a visual preview of the finalized piece." |
| 14 | + ] |
| 15 | + }, |
| 16 | + { |
| 17 | + "cell_type": "markdown", |
| 18 | + "id": "fea57056-3a79-4bde-a173-4e34421c522b", |
| 19 | + "metadata": {}, |
| 20 | + "source": [ |
| 21 | + "2. Software Architecture\n", |
| 22 | + "The software uses the standard Python src/ layout to isolate core business and graphical logic from the presentation layer.\n", |
| 23 | + "knitting_pattern/\n", |
| 24 | + "├── src/\n", |
| 25 | + "│ ├── knitting_pattern/\n", |
| 26 | + "│ │ ├── __init__.py # Exposes core calculation functions\n", |
| 27 | + "│ │ ├── app.py # Streamlit web application interface\n", |
| 28 | + "│ │ ├── math_engine.py # Math logic, matrix grid creation, and chart operations\n", |
| 29 | + "│ │ └── image_engine.py # Visualization logic, plotting chart and recognizing alpha patterns\n", |
| 30 | + "│ └── tests/\n", |
| 31 | + "│ ├── test_image_engine.py\n", |
| 32 | + "│ └── test_math_engine.py \n", |
| 33 | + "Stitch and Row Allocation: The engine converts user dimensions (in centimeters) to absolute integers. \n", |
| 34 | + "It uses ceiling rounding (math.ceil) since a knitter cannot execute a partial stitch. The underlying formula is:\n", |
| 35 | + "stitches = [{width (cm)} * {stitch gauge} / 10)]\n", |
| 36 | + "\n", |
| 37 | + "Grid Canvas Representation: The backend models the fabric as a two-dimensional grid (nested lists or arrays). Unoccupied background fabric is initialized to 0.\n", |
| 38 | + "Alpha Pattern Integration: The system reads pixel-based assets representing the alpha design. It maps these coordinates directly onto the sweater grid, reassigning target cells from background 0 to specific integer color IDs (e.g., 1, 2, 3). This acts as the layout for the color chart." |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "markdown", |
| 43 | + "id": "c6508f58-97f2-4e02-ad03-a1d7d445bfcf", |
| 44 | + "metadata": {}, |
| 45 | + "source": [ |
| 46 | + "3. Current Implementation: Drop-Shoulder Top-Down Construction\n", |
| 47 | + "The application currently models a traditional drop-shoulder construction, worked from the top down.\n", |
| 48 | + "\n", |
| 49 | + "Back Panel Cast-On: The program calculates the back shoulder width and establishes the upper grid boundary.\n", |
| 50 | + "\n", |
| 51 | + "Short-Row Contour Carving: To create an ergonomic shoulder slope and back-neck contour, the engine calculates short-row steps. It modifies the fabric matrix by marking unknitted coordinates as dead space (-1) while keeping active channels at 0. This allows the application to accurately trace variable-row knitting before mapping the alpha motif.\n", |
| 52 | + "\n", |
| 53 | + "Straight Body Extension: Once short rows are complete, the body grid expands downward in straight, uniform columns to form the classic drop-shoulder silhouette." |
| 54 | + ] |
| 55 | + }, |
| 56 | + { |
| 57 | + "cell_type": "markdown", |
| 58 | + "id": "b8f45f76-aedd-47be-b76e-461a696b3812", |
| 59 | + "metadata": {}, |
| 60 | + "source": [ |
| 61 | + "4. Current Limitations and Future Expansion\n", |
| 62 | + "While the drop-shoulder math and base grid generation are operational, our development roadmap highlights three areas of expansion:\n", |
| 63 | + "\n", |
| 64 | + "High-Contrast Visualizations and Text Instructions\n", |
| 65 | + "Problem: The current output shows a basic matrix visualization. It works for debugging but does not generate clear, printable charts or row-by-row text patterns for the user.\n", |
| 66 | + "\n", |
| 67 | + "Solution: Upgrade the visualization component with customized, high-contrast color maps to output downloadable PDF color charts. Concurrently, write a translation loop that reads the matrix rows and outputs automated text instructions (e.g., \"Row 12: K10 Turn; Row 13: P to end of row\").\n", |
| 68 | + "\n", |
| 69 | + "Geometric Silhouette Expansion\n", |
| 70 | + "Problem: The system is limited to drop-shoulder shapes, which utilize straight armhole paths and simple rectangular panels.\n", |
| 71 | + "\n", |
| 72 | + "Solution: Expand the mathematical backend to calculate complex raglan lines and set-in sleeve caps. This requires developing dynamic decrease formulas to scale diagonal stitch lines across the grid canvas while maintaining the integrity of the centered alpha patterns." |
| 73 | + ] |
| 74 | + } |
| 75 | + ], |
| 76 | + "metadata": { |
| 77 | + "kernelspec": { |
| 78 | + "display_name": "Python [conda env:base] *", |
| 79 | + "language": "python", |
| 80 | + "name": "conda-base-py" |
| 81 | + }, |
| 82 | + "language_info": { |
| 83 | + "codemirror_mode": { |
| 84 | + "name": "ipython", |
| 85 | + "version": 3 |
| 86 | + }, |
| 87 | + "file_extension": ".py", |
| 88 | + "mimetype": "text/x-python", |
| 89 | + "name": "python", |
| 90 | + "nbconvert_exporter": "python", |
| 91 | + "pygments_lexer": "ipython3", |
| 92 | + "version": "3.13.9" |
| 93 | + } |
| 94 | + }, |
| 95 | + "nbformat": 4, |
| 96 | + "nbformat_minor": 5 |
| 97 | +} |
0 commit comments