-
Notifications
You must be signed in to change notification settings - Fork 5
Feather
The feather
object stores the output from the fitting routine. It is called feather
because it is a light-weight wrapper around the fit_data
struct. The name was originally temporary, but it has stuck because there are many different components within BrainTrack and the distinctive name makes it easy to remember what this particular class does.
The main role of the feather
object is to group together a series of fits. Each fit returns a fit_data
and plot_data
struct, but when performing state tracking, you get a sequence of structs that are temporally related. The feather
object stores all of these structs and encapsulates the relationship between them. The main functionality provided by the feather
class is
- A wrapper to arrays of
fit_data
andplot_data
structs - An interface for analysis routines
- A standardized way to store and exchange fit data
The feather
object incorporates a lot of helper methods. These are
- Concatenating multiple
feather
objects - Retrieving a subset of the data (which is returned as another
feather
) - Inserting
fit_data
andplot_data
The feather
class dynamically grows the arrays to provide decent performance when using feather.subrange()
or otherwise adding many points. This is a significant feature because there can be over 20000 fits contained in a single feather
. When you call feather.insert
, the internal arrays are dynamically grown in powers of 2. The actual length of the arrays is stored in feather.prealloc_size
. The amount of data contained is stored in feather.latest
. If you run feather.compress()
then the arrays are truncated so that feather.prealloc_size=feather.latest
, which saves memory once you are done adding things to the feather
.
The clouds whose data is stored in plot_data
are important to be able to plot. However, they consume quite a lot of data, which is a huge issue for fits that have over 20000 spectra. To deal with this, instead of storing the actual structs in the feather
, you can instead store the file name of a .mat
file that contains the plot_data
variable. This files are then automatically loaded by mcmc.viewer
. To use this functionality, you can simply insert a string containing the full file name of the .mat
file. Everything else works as usual.
- The file is automatically split into the parent folder and the file name itself. All of the files need to be stored in the same folder
- This folder is stored in
feather.path_prefix
. If you move the fit folder somewhere else, simply changefeather.path_prefix
appropriately. This way you don't need to change the path in all of theplot_data
strings - If
plot_data
contains strings, the methodfeather.full
iterates over the strings and loads the plot data into memory, converting thefeather
into one which stores the actual plot data. This provides better performance for visualization, but is only recommended if you have a few (e.g. < 500) spectra in the feather