Skip to content

Latest commit

 

History

History
98 lines (72 loc) · 2.99 KB

File metadata and controls

98 lines (72 loc) · 2.99 KB

TrackGraph

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.

Features

  • 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 .txt file

Tech Stack

Layer Technology
Backend Python, FastAPI
Frontend Vanilla HTML / CSS / JavaScript (Canvas API)
Container Docker + Colima

Getting Started

Requirements

Run with Docker

# Start Colima (macOS only)
colima start

# Build and run
docker compose up --build

Open http://localhost:8000 in your browser.

Run locally (without Docker)

cd backend
pip install -r requirements.txt
uvicorn main:app --reload

Development

Project Structure

senior-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

API Endpoints

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

Running Tests

cd backend
pip install pytest
pytest

Code Quality (pre-commit)

pip install pre-commit
pre-commit install     # sets up hooks — runs automatically on every commit
pre-commit run --all-files  # run manually

Background

This 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.