A small toolkit for analysing bipolar-junction-transistor (BJT) measurements and designing a common-emitter (WE) amplifier, written for an analog electronics lab course (AGH WFiIS, exercises A-8 and P-4). It ingests CSV sweeps exported from a Digilent Analog Discovery 2 / WaveForms curve tracer and turns them into gain/resistance figures and plots, plus computes E24 resistor values for a target amplifier design.
- Input & transfer characteristics (
I_B = f(V_BE),I_C = f(V_BE)): extracts β, transconductanceg_m, and input resistancer_be. - Output characteristics (
I_C = f(V_CE)family of curves): estimates Early voltageV_Aand output resistancer_ceper curve. - Amplifier design: given a target gain/bandwidth spec, computes bias
point and component values (
R1,R2,RC,RE1,RE2,Ci,Co), snapped to the nearest E24 value, plus a Bode plot of the resulting frequency response. - Operating-point verification: compares theoretical vs. measured
V_B/V_C/V_E/I_Cafter the circuit is built.
| Input & transfer characteristics | Output characteristics | Bode plot |
|---|---|---|
![]() |
![]() |
![]() |
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtbjt_lab.py is the main entry point and covers the whole workflow:
python bjt_lab.py # interactive menu
python bjt_lab.py --bjt-input input.csv # §1a/1b: input & transfer characteristics
python bjt_lab.py --bjt-output output.csv # §1c: output characteristic
python bjt_lab.py --design 9 # §2: amplifier design for variant 9
python bjt_lab.py --design 9 --beta 280 # ...using a measured beta instead of the table value
python bjt_lab.py --all-variants # summary table for all 10 amplifier variantsSample WaveForms CSVs are in examples/data; try e.g.
python bjt_lab.py --bjt-input examples/data/fictional_input_transfer.csv
python bjt_lab.py --bjt-output examples/data/1c.csv(1a.csv/1b.csv are raw single-sweep traces exported separately, with
different column names/header offsets than bjt_lab.py expects —
scripts/beta_from_separate_csv.py is a starting-point template for that
case; adjust its column names/skiprows to match your export, as noted in
its comments.)
WaveForms CSV exports may prefix the data with a few #-commented metadata
lines — bjt_lab.py detects and skips these automatically, and auto-detects
which columns are V_BE/I_B/I_C/V_CE by header name.
Smaller standalone calculators kept for quick, no-argument interactive use;
bjt_lab.py supersedes all of them but they're handy on their own:
quick_amplifier_design.py— amplifier design only, prompts for a variant number (1-10).quick_operating_point_check.py— operating-point verification only, prompts for measured voltages and actual component values.beta_from_separate_csv.py— computes β(DC) and β(AC) from two separate CSV exports (one withI_BvsV_BE, one withI_CvsV_BE) instead of one combined file.
MIT, see LICENSE.


