Package qubx :: Module ideal :: Class Idealization
[hide private]
[frames] | no frames]

Class Idealization

source code

object --+
         |
        Idealization
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, sampling)
Creates a new zero-length Idealization.
source code
 
__del__(self) source code
 
__getitem__(self, key)
Returns the class at sample key.
source code
 
get_sampling(self)
Returns sampling, usually in milliseconds.
source code
 
set_sampling(self, sampling)
Sets sampling, usually in milliseconds.
source code
 
get_seg_count(self)
Returns the number of segments.
source code
 
get_seg_first(self, i)
Returns the first sample index in segment i.
source code
 
get_seg_last(self, i)
Returns the last sample index in segment i.
source code
 
count_dwells(self, f, l, fragments)
Returns the numer of dwells between sample f and sample l, inclusive.
source code
 
get_dwells_into(self, f, l, fragments, firsts, lasts, classes, durations)
Copies the dwells between samples f and l, inclusive, into numpy arrays.
source code
 
get_dwells(self, f, l, fragments, get_durations=False)
Returns the dwells between samples f and l, inclusive, as numpy arrays
source code
 
count_dwells_and_gaps(self, f, l)
Returns the numer of dwells between sample f and sample l, inclusive.
source code
 
get_dwells_and_gaps_into(self, f, l, firsts, lasts, classes, durations)
Copies the dwells between samples f and l, inclusive, into numpy arrays; cls=-1 between events.
source code
 
get_dwells_and_gaps(self, f, l, get_durations=False)
Returns the dwells between samples f and l, inclusive, as numpy arrays
source code
 
set_dwells(self, count, firsts, lasts, classes)
Writes dwells to the idealization.
source code
 
sample_dwells(self, f, l, amps, Nsample, lows, highs, class_bits=None)
Renders the dwells between samples f and l, inclusive, into resampled arrays lo and hi, suitable for display.
source code
 
sample_dwells_std(self, f, l, amps, stds, Nsample, lows, highs)
Renders the dwells between samples f and l, inclusive, into resampled arrays lo and hi, suitable for display.
source code
 
count_dwells_excluding(self, exclusion, excl_class, f, l)
Returns the numer of dwells between sample f and sample l, inclusive; unlike count_dwells, counts each un-idealized region as a dwell (of class -1).
source code
 
get_dwells_excluding_into(self, exclusion, excl_class, f, l, firsts, lasts, classes, durations=None)
Copies the dwells between samples f and l, inclusive, into numpy arrays; unlike get_dwells_into, outputs un-idealized regions as class -1.
source code
 
get_dwells_excluding(self, exclusion, excl_class, f, l, get_durations=False)
Returns the dwells between samples f and l, inclusive, as numpy arrays; unlike get_dwells, outputs un-idealized regions as class -1.
source code
 
set_dwell(self, f, l, c)
Overwrites the idealization between samples f and l, inclusive, with class c.
source code
 
clear(self)
Clears all segments' idealization to class -1.
source code
 
add_seg(self, f, l)
Adds a segment, with inclusive sample bounds.
source code
 
erase(self, f, l)
Clears all dwells (or fragments) between samples f and l inclusive, by setting them to class -1.
source code
 
join(self, f, l)
Extends the class at sample f through to sample l.
source code
 
begin(self)
Returns an IdlIter pointing to the first (partial) dwell.
source code
 
end(self)
Returns an IdlIter pointing past the last (partial) dwell.
source code
 
find(self, f)
Returns an IdlIter pointing to the (partial) dwell at sample f.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  sampling

Inherited from object: __class__

Method Details [hide private]

__init__(self, sampling)
(Constructor)

source code 

Creates a new zero-length Idealization.

Parameters:
  • sampling - shortest measured duration, usually in milliseconds
Overrides: object.__init__

count_dwells(self, f, l, fragments)

source code 

Returns the numer of dwells between sample f and sample l, inclusive. If (not fragments): doesn't count dwells which extend beyond the bounds.

get_dwells_into(self, f, l, fragments, firsts, lasts, classes, durations)

source code 

Copies the dwells between samples f and l, inclusive, into numpy arrays.

Parameters:
  • classes (numpy.array(dtype=int32))
  • durations (numpy.array(dtype=float32) or None)
  • firsts (numpy.array(dtype=int32))
  • lasts (numpy.array(dtype=int32))

get_dwells(self, f, l, fragments, get_durations=False)

source code 

Returns the dwells between samples f and l, inclusive, as numpy arrays

Returns:
firsts, lasts, classes[, durations]

get_dwells_and_gaps_into(self, f, l, firsts, lasts, classes, durations)

source code 

Copies the dwells between samples f and l, inclusive, into numpy arrays; cls=-1 between events.

Parameters:
  • classes (numpy.array(dtype=int32))
  • durations (numpy.array(dtype=float32) or None)
  • firsts (numpy.array(dtype=int32))
  • lasts (numpy.array(dtype=int32))

get_dwells_and_gaps(self, f, l, get_durations=False)

source code 

Returns the dwells between samples f and l, inclusive, as numpy arrays

Returns:
firsts, lasts, classes[, durations]

sample_dwells(self, f, l, amps, Nsample, lows, highs, class_bits=None)

source code 

Renders the dwells between samples f and l, inclusive, into resampled arrays lo and hi, suitable for display. Samples with no dwells (all class < 0) are not modified, so if you fill lo or hi with a sentry value, you can skip blank samples. class_bits[i] & (1 << c) if class c occurs during sample i

sample_dwells_std(self, f, l, amps, stds, Nsample, lows, highs)

source code 

Renders the dwells between samples f and l, inclusive, into resampled arrays lo and hi, suitable for display. Samples with no dwells (all class < 0) are not modified, so if you fill lo or hi with a sentry value, you can skip blank samples.

count_dwells_excluding(self, exclusion, excl_class, f, l)

source code 

Returns the numer of dwells between sample f and sample l, inclusive; unlike count_dwells, counts each un-idealized region as a dwell (of class -1).

Parameters:
  • exclusion - an Idealization with the same segmentation
  • excl_class - class in exclusion marking where to overwrite output with class -2

get_dwells_excluding_into(self, exclusion, excl_class, f, l, firsts, lasts, classes, durations=None)

source code 

Copies the dwells between samples f and l, inclusive, into numpy arrays; unlike get_dwells_into, outputs un-idealized regions as class -1.

Parameters:
  • exclusion - an Idealization with the same segmentation
  • excl_class - class in exclusion marking where to overwrite output with class -2
  • classes (numpy.array(dtype=int32))
  • durations (numpy.array(dtype=float32) or None)
  • firsts (numpy.array(dtype=int32))
  • lasts (numpy.array(dtype=int32))

get_dwells_excluding(self, exclusion, excl_class, f, l, get_durations=False)

source code 

Returns the dwells between samples f and l, inclusive, as numpy arrays; unlike get_dwells, outputs un-idealized regions as class -1.

Parameters:
  • exclusion - an Idealization with the same segmentation
  • excl_class - class in exclusion marking where to overwrite output with class -2
Returns:
firsts, lasts, classes[, durations]

add_seg(self, f, l)

source code 

Adds a segment, with inclusive sample bounds. For best results, use f = total sample count so far; l = f+seg_length-1.


Property Details [hide private]

sampling

Get Method:
unreachable(self)
Set Method:
unreachable(self, x)