MIT Researcher Builds a Digital Twin of His Dog in Pure Python: Turning Jackie's fMRI Brain into AI

An MIT researcher built an interactive digital twin of his dog Jackie using fMRI and EEG data in pure Python.
An MIT researcher combined his dog Jackie's veterinary MRI and home EEG data into six synchronized session datasets and built an interactive digital twin using only pure Python (dataclasses, deques, a state machine). The system maintains a 6-dimensional emotion vector and a 25-region brain activation map. After a stimulus is input, it simulates emotional and brain region responses by matching real sessions, injecting BOLD values, and updating heart rate. The social condition data are especially striking: encountering a strange stray dog causes bilateral amygdala activation and a heart rate of 124 bpm; meeting a dog friend produces a more balanced midbrain/temporal response; and seeing a familiar neighbor dog strongly activates the bilateral temporal lobes while heart rate drops to 98. The researcher admits the model is a highly simplified linear approximation with no HRF convolution or neural mass modeling, but emphasizes that every number can be traced back to real measurements. The code is open-sourced on GitHub.
An MIT researcher shared a rather unusual project on Reddit: he turned his dog Jackie's brain imaging data into an interactive "digital twin." The entire system was built in pure Python, without PyTorch or TensorFlow.
From a Vet MRI to an Accidental Dataset
The whole thing started as a complete accident. Last year, Jackie needed a few veterinary MRI scans for a minor issue, which turned out to be nothing serious. Since she was already in the scanner, the vet team let the researcher stay and, out of curiosity, ran a few extra short functional sequences. They later did wireless EEG at home using a custom soft cap, recording Jackie's brain activity when she was exposed to different smells, other dogs, walks, and food.
In the end, they had six clean data sessions (J001–J006), each containing:
- T2*-weighted EPI fMRI data
- EEG band power (theta, alpha, beta, gamma)
- Heart rate, respiration, acceleration
- Simple behavioral records (licking, etc.)
- BOLD values extracted from the left and right olfactory bulbs, left and right amygdala, and left and right nucleus accumbens
Three axial slices under social conditions were especially interesting: when encountering a strange stray dog, heart rate rose to 124 bpm with clear bilateral amygdala activation; when meeting a real dog friend, heart rate was 112 with a more balanced midbrain/temporal response; when seeing the neighbor's dog (already encountered many times), heart rate dropped to 98 with strong bilateral temporal activation.

Terminology note: T2* weighted EPI fMRI
T2* weighted EPI (Echo-Planar Imaging) is the most commonly used fast imaging sequence in functional magnetic resonance imaging (fMRI). It uses the T2* signal change caused by the magnetic susceptibility difference between deoxyhemoglobin and oxyhemoglobin in the blood (i.e., the BOLD effect) to indirectly reflect local neural activity. EPI can acquire an entire 2D image within tens of milliseconds, giving it a temporal resolution of 1–3 seconds, which makes it suitable for capturing the time course of brain region activation. However, its spatial resolution and resistance to susceptibility artifacts are weaker than conventional T1/T2 anatomical scans, and it is mostly used in experimental settings with a fixed head—implementing EPI in awake animals in a veterinary setting requires overcoming additional challenges such as motion artifacts, anesthesia interference, and noise tolerance, which is one reason the Jackie dataset is relatively rare.
Terminology note: BOLD signal and ROI extraction
The BOLD (Blood-Oxygen-Level-Dependent) signal is the measurement basis of fMRI: when neuronal activity in a brain region increases, local blood flow and oxygen supply exceed oxygen demand, causing a relative decrease in deoxyhemoglobin and a slight increase in the T2* weighted signal. The BOLD values mentioned here—left and right olfactory bulbs, left and right amygdala, left and right nucleus accumbens, etc.—are time series obtained by averaging the voxel signals within each anatomical region (ROI, Region of Interest). ROIs are usually defined by a registered anatomical atlas or manual tracing; for dogs, a simplified canine brain atlas is often used because their sulcal and gyral structure differs greatly from humans. The key steps in ROI extraction include motion correction, smoothing, detrending, and physiological noise regression, and these preprocessing steps directly affect the credibility of the emotional increments in the subsequent digital twin.
A Digital Twin Implemented in Pure Python
The researcher turned all the data into a digital twin. Interestingly, he did not choose a fancy deep learning framework—no PyTorch, no TensorFlow, only dataclasses, deques, basic statistics, and a state machine.
The system maintains several core states: a 6-dimensional emotion vector (joy, curiosity, calm, excitement, anxiety, affection), a 25-region activation map based on a simplified canine atlas, and the current physiological state (heart rate, arousal index, etc.).
When you input a stimulus, the pipeline works roughly like this: StimulusMapper first tries to match a real session (using simple fuzzy matching for social stimuli), then applies the emotion increment averaged from real BOLD and EEG values, each region decays toward baseline before BOLD is injected from the matched session, special social enhancement is added for the three dog conditions, heart rate is updated to the actual measured value, and everything is stored in a memory buffer.

Terminology note: State machine and dataclasses/deques
A state machine (finite-state machine) is a computational paradigm that models system behavior as "states + transitions": at any moment the system is in one of a finite number of discrete states, and external stimuli trigger state transitions. The digital twin in this article uses a state machine to maintain a 6-dimensional emotion vector and a 25-region activation map, so that each stimulus input corresponds to a deterministic state update path. Dataclasses are syntactic sugar introduced in Python 3.7 for concisely defining data-centric classes (automatically generating __init__, __repr__, etc.), and are suitable for carrying the emotion vector and physiological state. A deque (double-ended queue) comes from the collections module, supports O(1) insertion/deletion at both ends, and is often used as a fixed-length memory buffer—exactly the lightweight structure needed to store the recent history of stimuli and brain region responses. Together, these three enable an inspectable simulation loop without introducing a scientific stack beyond NumPy.
A Simple Linear Approximation, but Traceability Is Preserved
The researcher readily admits that this is a highly simplified linear approximation, with no proper HRF convolution or biophysical neural mass modeling. But he deliberately kept it transparent, so that every number can be traced back to real measurements collected from Jackie. The goal is to "feel alive and inspectable," not "state-of-the-art accuracy."
Even so, when you input "best friend dog" and "strange stray dog," the changes in emotional state and dominant regions do match what was observed in the scanner and in real life. The researcher says this part gives him goosebumps every time.
Terminology note: HRF convolution and neural mass models
The HRF (Hemodynamic Response Function) describes the typical shape of the BOLD signal over time after neural activity occurs: it begins to rise after about 2 seconds, peaks at 5–6 seconds, then slowly falls with a slight undershoot. Standard fMRI analysis convolves assumed neural events with the HRF to predict the BOLD time series; skipping this step causes the simulated signal to mismatch the real scan in temporal shape. A neural mass model, on the other hand, uses a small number of differential equations to describe the average firing rate and inhibitory/excitatory coupling of a population of neurons, and can produce oscillatory and transient responses closer to biophysics. This article chooses to bypass both and replace them with simple linear increments. Although this sacrifices dynamical realism, it gains auditability in which every value can be traced back to Jackie's real measurements.
Community Feedback and Directions for Improvement
He especially wants feedback from the fields of animal fMRI, canine cognition, and affective computing, and also welcomes anyone who likes strange personal science projects to join the discussion. He is willing to share details such as ROI extraction, the soft EEG cap, and regression weights. At the same time, he is also seeking suggestions: how to make the region dynamics more realistic without introducing huge dependencies.

As of the time of posting, Jackie was sleeping on the couch after a long walk. She has no idea that she now has a digital twin—one that gets anxious about stray dogs and becomes super happy because of her best friend.

The code is open-sourced on GitHub: github.com/StoopwenpueNq/jackie-fmri-sim
Related articles

Build an AI Super Employee System at Zero Cost: A Full Breakdown of Automated Agent Workflows
A deep breakdown of the AI super employee system demoed on Bilibili: agent orchestration, digital human voiceovers, map and enterprise lead generation, 24/7 customer service, and legal modules. We analyze the business logic and compliance risks behind zero-cost signup to help entrepreneurs judge the real ROI of this AI digital employee system.

The Essential Difference Between Chatbots and AI Agents: Crossing from Conversation to Execution
What's the difference between a chatbot and an AI agent? Based on the MCP series on the Learn Tech channel, this article uses examples like booking flights and summarizing notes to explain: a chatbot only gives answers, while an agent actually completes tasks through a think-act-observe loop. It breaks down the four core components—model, tools, memory, and goal—as well as MCP's role as a bridge, and discusses agents' applicable boundaries and permission risks.

Free GitHub Repo: 342 Hours of AI Courses, from Math to MCP Servers
A free GitHub repo offers 342 hours of AI courses: 523 lessons across 20 phases, from math fundamentals to agent building and MCP servers. Nearly 100,000 learners have started.