Package qubx :: Module data_types
[hide private]
[frames] | no frames]

Module data_types

source code

Data file structure and i/o.

This is the (qubx.tree) format of a simulation scratch file:

Sampling
SignalCount
Signals
  [] Signal
    Name
    Units
Segments
  [] Segment
    SampleCount
    Signals
      [] Signal
        Samples [(float[SampleCount])]
IdealSignals
  [] IdealSignal
    SignalIndex
    Segments
      [] Segment [f, l] {amp, sd, DwellCount, Classes, Firsts, Lasts}

Copyright 2008-2014 Research Foundation State University of New York This file is part of QUB Express.

QUB Express is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QUB Express is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License, named LICENSE.txt, in the QUB Express program directory. If not, see <http://www.gnu.org/licenses/>.

Classes [hide private]
  Segmentation
Describes how a contiguous range of samples is divided into segments.
  SigBaseline
Represents piecewise-linear baseline of one signal.
  SigIdl
Represents one idealized signal; resizes with Segmentation; stores per-segment info.
  SigOverlays
  Exclusion
Represents excluded and included regions as an idealization with class 0 and 1 resp.
  SelectionList
  SelectionLists
  IdlUpdater
Manages updates to idealization to make them undoable and to emit the OnChangeIdealization event; make sure to call done().
  StimulusRecord
Describes how to find and idealize the time course of a model variable.
  QubData
Base class for an open data file.
  SourceChunk
Describes one contiguous slice of data from the data source.
  SourceSeg
Describes one segment from the data source.
  QubData_Analog
Base class for one analog signal.
  QubData_Analog_Computed
  QubData_QDF_Analog
  QubData_QDF
One open QDF (or QSF) data file.
  QubData_Bin_Analog
  QubData_Bin
One open raw binary data file.
  QubData_LDT_Analog
  QubData_LDT
One open LDT file (classic QuB data)
  QubData_Scratch_Analog
Reads data from a qub express scratch file (simulation).
  QubData_Blank
  QubData_Scratch
One open qub express scratch file (simulation); .tree can be repeatedly re-assigned.
  TextStats
  QubDatas
A table-like collection of open files.
Functions [hide private]
 
DOWNSAMPLES_PER_PIX(Nsigseg, Nsamp) source code
 
SetReader(ext, description, create) source code
 
GetReader(ext) source code
 
Open(path, progressf=<__builtin__.function object>) source code
 
setup_segments_list(data) source code
 
SetWriter(ext, description, save) source code
 
Save(path, *args, **kw) source code
 
acceptStimType(s) source code
 
formatStimType(x) source code
 
get_segmentation_copy(segmentation, signal=0) source code
 
get_chunk_samples(chunk)
Returns a SourceChunk with samples and sampling.
source code
 
get_file_samples(file, signal, first, last, included, latency=0, skip=1, start=-1, baseline_nodes=True, group=None)
Returns a SourceChunk with samples and sampling.
source code
 
get_file_samples_filtered(file, sig, first, last, included, latency, filter_Hz, skip=1, get_samples=<__builtin__.function object>, start=-1, baseline_nodes=True, group=None) source code
 
generate_chunk_samples(chunks, main_hold=None, signal=None, maxlen=65536, get_excluded=False, downsample_w=None, downsample_Nsigseg=1, get_idl=False, get_idl_durs=False)
Yields (numpy.array(float32) of sampled data, sampling) for each chunk.
source code
 
BuildSession(base_qsf, segs_of_signal, lists, *tables) source code
 
BuildSessionIdl(qsf, segs_of_signal) source code
 
BuildSessionFits(qsf, file, segs_of_signal) source code
 
BuildSessionOverlays(qsf, file, segs_of_signal) source code
 
BuildSessionExcl(qsf, segs_of_signal) source code
 
BuildSessionBaseline(qsf, baselines) source code
 
BuildSessionTrials(qsf, trials) source code
 
Save_QDF(path, base_qsf, segs_of_signal, lists, progressf, *tables, **kw) source code
 
Save_Float32(path, base_qsf, segs_of_signal, lists, progressf, *tables, **kw) source code
 
Save_Int16(path, base_qsf, segs_of_signal, lists, progressf, *tables, **kw) source code
 
Save_TXT_Base(separator) source code
 
Save_TXT(path, base_qsf, segs_of_signal, lists, progressf, *tables, **kw) source code
 
Save_CSV(path, base_qsf, segs_of_signal, lists, progressf, *tables, **kw) source code
 
ReadSessionIdl(data, sess, addsegs=False, progressf=<__builtin__.function object>)
Fills in data.ideal (and optionally data.segmentation) from sess, a QSF tree.
source code
 
ReadSessionFits(data, sess, progressf=<__builtin__.function object>) source code
 
ReadSessionOverlays(data, sess, progressf=<__builtin__.function object>) source code
 
ReadSessionExcl(data, sess, progressf=<__builtin__.function object>) source code
 
ReadSessionBaseline(data, sess, progressf=<__builtin__.function object>) source code
 
ReadSessionTrials(data, sess, progressf=<__builtin__.function object>) source code
 
read_signal_overlay(samples, data, overlay, analog, sel_index) source code
 
parse_computed_signal(expr, source_names) source code
 
read_with_latency(read, first, last, latency, skip, iseg, segfirst, seglast) source code
 
OpenQDF(path, progressf) source code
 
OpenQSF(path, progressf) source code
 
float_decimal_comma(s) source code
 
OpenTXT(path, progressf) source code
 
OpenDWT(path, progressf) source code
Variables [hide private]
  DOWNSAMPLE_ALL_LOGCOUNT = 2.0
  DOWNSAMPLE_LOGSLOPE = 3.0
  SAVEBUFLEN = 262144
  Readers = {'.acquire': {'pattern': '*.acquire', 'create': <cla...
  Writers = {'.csv': {'pattern': '*.csv', 'ext': '.csv', 'save':...
  STIM_TYPES = (0, 1, 2)
  STIM_LABELS = ('Constant', 'Signal', 'Expression')
  COPY_ROWS_ALL = 0
  COPY_ROWS_CHECKED = 3
  COPY_ROWS_CRITERIA = 2
  COPY_ROWS_GROUP = 1
  DATASOURCE_FILE = 0
  DATASOURCE_LIST = 2
  DATASOURCE_SCREEN = 1
  STIM_TYPE_CONST = 0
  STIM_TYPE_EXPR = 2
  STIM_TYPE_SIGNAL = 1
  __package__ = 'qubx'
  e = 2.71828182846
  pi = 3.14159265359
  rdbk = 'Expired.'
  rdbreak = 'supporting'
  rdname = 'qubfast.txt'
Function Details [hide private]

generate_chunk_samples(chunks, main_hold=None, signal=None, maxlen=65536, get_excluded=False, downsample_w=None, downsample_Nsigseg=1, get_idl=False, get_idl_durs=False)

source code 

Yields (numpy.array(float32) of sampled data, sampling) for each chunk.

Parameters:
  • chunks - list of SourceChunk
  • main_hold - qubx.task.GTK_Main_Hold if in a worker thread, or None in the main thread
  • signal - signal index, or None to use the chunk.signal
  • maxlen - chunks longer than this will be yielded in pieces; can be None: unlimited
  • get_excluded - if True, gets data for chunks with .included==False
  • downsample_w - width of screen in pixels, if you want to maybe skip some for speed
  • downsample_Nsigseg - total number of segments*signals being processed, to help decide how many points to skip
  • get_idl - if True, sets chunk.firsts, chunk.lasts, chunk.classes
  • get_idl_durs - if True and get_idl, sets chunk.durations

Variables Details [hide private]

Readers

Value:
{'.acquire': {'pattern': '*.acquire', 'create': <class 'qubx.data_acqu\
ire.QubData_ACQ'>, 'ext': '.acquire', 'description': 'Acquire files'},
 '.csv': {'pattern': '*.csv', 'create': <function OpenTXT at 0x7fd1298\
320c8>, 'ext': '.csv', 'description': 'Comma-separated files'},
 '.dat': {'pattern': '*.dat', 'create': <function QubData_PUL_Open at \
0x7fd121749b18>, 'ext': '.dat', 'description': 'DAT files'},
 '.dwt': {'pattern': '*.dwt', 'create': <function OpenDWT at 0x7fd1298\
32140>, 'ext': '.dwt', 'description': 'QuB idealized data'},
...

Writers

Value:
{'.csv': {'pattern': '*.csv', 'ext': '.csv', 'save': <function Save at\
 0x7fd12982e8c0>, 'description': 'Comma-separated ext files'},
 '.float32': {'pattern': '*.float32', 'ext': '.float32', 'save': <func\
tion Save_Float32 at 0x7fd12982e6e0>, 'description': 'Raw binary (floa\
t32)'},
 '.int16': {'pattern': '*.int16', 'ext': '.int16', 'save': <function S\
ave_Int16 at 0x7fd12982e758>, 'description': 'Raw binary (int16)'},
 '.qdf': {'pattern': '*.qdf', 'ext': '.qdf', 'save': <function Save_QD\
...