Changes between Initial Version and Version 1 of BlocksAndSlots

Jan 23, 2013, 4:17:22 PM (8 years ago)



  • BlocksAndSlots

    v1 v1  
     1= Blocks and Slots =
     3When Analysis manipulates a single FID, that FID is contained inside a dataset. Each dataset contains blocks that represent processing steps. This document describes how Analysis stores those blocks internally while running. It assumes a basic working knowledge of Python, or at least some object-oriented programming experience.
     5== The Slots ==
     7At present, there are four ''slots'' in the blocks container. Their names are raw, prep, spectral and fit. (At some point, a fifth slot for spatial processing will probably be added between prep and spectral.)
     9The blocks are stored in an ordered dictionary that is keyed by the slot names ("raw", "prep", etc.).
     11Slots are never empty. If a slot doesn't need to do anything (this is often the case with prep), it's populated with an identity version of the block that simply returns whatever data is handed to it.
     13The raw slot is somewhat of an exception to the rule above. It's always populated, but it never contains an identity instance because there is no BlockRawIdentity class. (See below.)
     15== Identity Blocks ==
     17The simplest version of each block is the ''identity'' block. Blocks are transformative (except for raw, which is just an inert container) and identity blocks are named for the identity transform in mathematics. Since the raw block is never transformative, there is no BlockRawIdentity.
     19By default, a new dataset starts with a BlockRaw object in the first slot and identity blocks in all other slots (BlockPrepIdentity, BlockSpectralIdentity, etc.). In practice, BlockSpectralIdentity is always replaced with BlockSpectral. (This mirrors what happens in Analysis' GUI -- there is always a spectral tab.) The practical upshot is that it's perfectly fine (even common) to have a mix of identity and non-identity blocks in a dataset.
     21== Non-identity Blocks ==
     23All blocks in a given slot must subclass (derive from) the identity class for that slot. For instance, BlockPrepFidsum inherits from BlockPrepIdentity. The identity class (in combination with the base Block class) describes the minimum implementation for a block of that type.
     25In addition, deriving from a particular identity class allows other code in Analysis to know in which slot a block instance resides by using `isinstance()`. Remember that `isinstance(A, B)` returns True if A is of class B or a subclass thereof.