-
Notifications
You must be signed in to change notification settings - Fork 5
Project structure
Romesh Abeysuriya edited this page Sep 23, 2015
·
7 revisions
This page provides an overview of the software structure of BrainTrak
Having read about the theory, you should have an idea of some of the essential components in fitting. To perform fitting, we need (as a minimum) the following components:
- A set of spectra (data)
- A model consisting of a function that takes in parameters and returns a predicted spectrum
- A function that compares the spectrum to the data to compute chisq
- A function that computes the probability based on chisq and the prior
- A function that implements the MCMC random walk
- A function that selects the best fit from the random walk
- A function that incrementally updates the priors and records successive fits
- A set of analysis routines to display the model results
The overall structure of the fitting system looks like this
Model + Data -> mcmc.fit -> feather -> analysis
The BrainTrack project provides these key building blocks
- A Model specifies the equations and how to calculate a power spectrum from parameters
- A fitting function that takes in a model and an experimental power spectrum, and runs a random walk over the parameters to find the most likely parameter values
- An object to store the results which implements analysis and plotting methods
Fitting a series of power spectra is accomplished by writing wrappers that use these building blocks. For example
-
fit_single
shows how to fit a single power spectrum -
fit_several
fits a series of power spectra with incremental priors but without caring about how many artifacts were removed -
fit_cluster
does the same but does care about how many artifacts were removed. This function also implements sophisticated restart behaviour