A web application for determining magnetic flux from electromotive force (EMF) photographs.
Users upload an oscilloscope screenshot, calibrate the axes by clicking reference points, track the EMF curve, and calculate the magnetic flux using numerical integration.
- Upload any oscilloscope image (JPG, PNG, etc.)
- Interactive canvas — click to place axis calibration points and track the curve
- Coordinate scaling using linear interpolation
- Two integration methods: Trapezoid Rule and Simpson's 1/3 Rule
- Magnetic flux calculation from area under the curve divided by coil turns
- Export tracked coordinates as a
.txtfile
| Layer | Technology |
|---|---|
| Backend | Python, FastAPI |
| Frontend | Vanilla HTML / CSS / JavaScript (Canvas API) |
| Container | Docker + Colima |
# Start Colima (macOS only)
colima start
# Build and run
docker compose up --buildOpen http://localhost:8000 in your browser.
cd backend
pip install -r requirements.txt
uvicorn main:app --reloadsenior-project/
├── backend/
│ ├── main.py # FastAPI app — API routes
│ ├── calculator.py # Trapezoid and Simpson's integration
│ ├── requirements.txt
│ └── tests/
│ └── test_calculator.py
├── frontend/
│ ├── index.html # Single-page UI
│ ├── style.css
│ └── app.js # Canvas interaction and API calls
├── archive/ # Original desktop app (Tkinter/Python)
├── Dockerfile
├── docker-compose.yml
└── CLAUDE.md # Project rules for AI-assisted development
| Method | Route | Description |
|---|---|---|
POST |
/api/scale |
Convert pixel coordinates to real-world values |
POST |
/api/calculate |
Calculate area and magnetic flux |
POST |
/api/export |
Download coordinates as .txt |
cd backend
pip install pytest
pytestpip install pre-commit
pre-commit install # sets up hooks — runs automatically on every commit
pre-commit run --all-files # run manuallyThis project originated as a desktop application (Tkinter) for physics research on magnetic flux determination. The original code is preserved in the archive/ folder. See abstract.md for the research context.