wiki:BlocksAndSlots

Version 1 (modified by flip, 7 years ago) (diff)

--

Blocks and Slots

When 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.

The Slots

At 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.)

The blocks are stored in an ordered dictionary that is keyed by the slot names ("raw", "prep", etc.).

Slots 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.

The 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.)

Identity Blocks

The 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.

By 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.

Non-identity Blocks

All 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.

In 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.

Attachments (2)

Download all attachments as: .zip