Changes between Initial Version and Version 1 of BlocksAndSlots


Ignore:
Timestamp:
Jan 23, 2013, 4:17:22 PM (8 years ago)
Author:
flip
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BlocksAndSlots

    v1 v1  
     1= Blocks and Slots =
     2
     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.
     4
     5== The Slots ==
     6
     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.)
     8
     9The blocks are stored in an ordered dictionary that is keyed by the slot names ("raw", "prep", etc.).
     10
     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.
     12
     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.)
     14
     15== Identity Blocks ==
     16
     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.
     18
     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.
     20
     21== Non-identity Blocks ==
     22
     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.
     24
     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.