PYME.contrib.gohlke.fcsfiles module

Read fluorescence correlation spectroscopy (FCS) data files.

Currently only Carl Zeiss(r) ConfoCor(r) RAW and ASCII measurement data files are supported.

Author:Christoph Gohlke
Organization:Laboratory for Fluorescence Dynamics, University of California, Irvine
Version:2013.01.18

Notes

“Carl Zeiss” and “ConfoCor” are registered trademarks of Carl Zeiss, Inc.

The API is not stable yet and is expected to change between revisions.

The use of this implementation may be subject to patent or license restrictions.

This module does not read flow cytometry standard FCS files.

class PYME.contrib.gohlke.fcsfiles.ConfoCor3Fcs(filename)

Bases: dict

Carl Zeiss ConfoCor3 ASCII data file.

No specification is available. The encoding is ‘Windows-1252’.

Examples

>>> fcs = ConfoCor3Fcs('fluorescein.fcs')
>>> fcs['FcsData']['FcsEntry'][0]['FcsDataSet']['CountRateArray'].shape
(60000, 2)

Methods

clear(() -> None.  Remove all items from D.)
close()
copy(() -> a shallow copy of D)
fromkeys(...) v defaults to None.
get((k[,d]) -> D[k] if k in D, ...)
has_key((k) -> True if D has a key k, else False)
items(() -> list of D’s (key, value) pairs, ...)
iteritems(() -> an iterator over the (key, ...)
iterkeys(() -> an iterator over the keys of D)
itervalues(...)
keys(() -> list of D’s keys)
pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised
popitem(() -> (k, v), ...) 2-tuple; but raise KeyError if D is empty.
setdefault((k[,d]) -> D.get(k,d), ...)
update(([E, ...) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values(() -> list of D’s values)
viewitems(...)
viewkeys(...)
viewvalues(...)

Read file content and parse into dictionary.

Methods

clear(() -> None.  Remove all items from D.)
close()
copy(() -> a shallow copy of D)
fromkeys(...) v defaults to None.
get((k[,d]) -> D[k] if k in D, ...)
has_key((k) -> True if D has a key k, else False)
items(() -> list of D’s (key, value) pairs, ...)
iteritems(() -> an iterator over the (key, ...)
iterkeys(() -> an iterator over the keys of D)
itervalues(...)
keys(() -> list of D’s keys)
pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised
popitem(() -> (k, v), ...) 2-tuple; but raise KeyError if D is empty.
setdefault((k[,d]) -> D.get(k,d), ...)
update(([E, ...) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values(() -> list of D’s values)
viewitems(...)
viewkeys(...)
viewvalues(...)
close()
class PYME.contrib.gohlke.fcsfiles.ConfoCor3Raw(filename)

Bases: object

Carl Zeiss ConfoCor3 raw data file.

Based on “Confocor3 Raw Data Specification. 2 May 2007. by efg, Stowers Institute for Medical Research.”

Examples

>>> fcs = ConfoCor3Raw('R1_P1_K1_Ch1.raw')
>>> fcs.filename()
'f5ee4f36488fca2f89cb6b8626111006_R1_P1_K1_Ch1.raw'
>>> fcs.frequency
20000000
>>> times = fcs.asarray()
>>> times[10858]
1199925494
>>> times, bincounts = fcs.asarray(bins=1000)
>>> times.shape
(1000,)
>>> bincounts[618]
23
>>> fcs.close()

Attributes

measurement_identifier (str) Hex form of 4 32-bit little endian integers without leading 0. It is the same for all channels of the same repetition.
measurement_position (int) Zero based measurement position.
kinetic_index (int) Zero based kinetic index.
repetition_number (int) Zero based repetition_number.
frequency (int) Sampling frequency in Hz.

Methods

asarray([count, skip]) Read data from file, perform optional binning, and return as array.
close() Close open file.
filename() Return normalized file name from file content.

Read file header.

Methods

asarray([count, skip]) Read data from file, perform optional binning, and return as array.
close() Close open file.
filename() Return normalized file name from file content.
asarray(count=-1, skip=0, **kwargs)

Read data from file, perform optional binning, and return as array.

Parameters:

count : int (optional)

Number of data words to process. Default: -1 (all words).

skip : int (optional)

Number of data words to skip at beginning of stream. Default: 0.

kwargs : dict

Optional argument to the fcs_bincount function, specifying size or number of bins.

Returns:

times : ndarray

The lower range of the bins in units of seconds, or, if binsize is 0, the times of the events in detector clock units.

bincounts : ndarray

The number of events in each bin.

close()

Close open file.

filename()

Return normalized file name from file content.

class PYME.contrib.gohlke.fcsfiles.ConfoCor2Raw(filename)

Bases: object

Carl Zeiss ConfoCor2 raw data file.

The LSM 510 META - ConfoCor 2 system: an integrated imaging and spectroscopic platform for single-molecule detection. Weisshart K, Jungel V, and Briddon SJ. Curr Pharm Biotechnol. 2004 Apr;5(2):135-54.

ConfoCor 2 - Description of the Raw Data Format. 03.05.01. www.zeiss.at/C12567BE00472A5C/EmbedTitelIntern/RawData/$File/RawData.pdf

Carl Zeiss Advanced Imaging Microscopy claims a patent on the file format and data compression scheme.

Examples

>>> fcs = ConfoCor2Raw('Sample488.011')
>>> fcs.frequency
20000000
>>> ch0, ch1 = fcs.asarray()
>>> ch1[4812432]
999999833
>>> times, ch0, ch1 = fcs.asarray(bins=1000)
>>> times.shape
(1000,)
>>> ch1[428]
10095
>>> fcs.close()

Attributes

frequency (int) Sampling frequency in Hz.

Methods

asarray([count, skip]) Read data from file, perform optional binning, and return as arrays.
close() Close open file.

Read file content and parse into a dictionary.

Methods

asarray([count, skip]) Read data from file, perform optional binning, and return as arrays.
close() Close open file.
asarray(count=-1, skip=0, **kwargs)

Read data from file, perform optional binning, and return as arrays.

Parameters:

count : int (optional)

Number of data words to process. Default: -1 (all words).

skip : int (optional)

Number of data words to skip at beginning of stream. Default: 0.

kwargs : dict

Optional argument to the fcs_bincount function, specifying size or number of bins.

Returns:

times : ndarray

If binning, the lower range of the bins in units of seconds. Otherwise (default), the times of the events in detector clock units for each channel.

Bincounts : ndarray

If binning, the number of events in each bin for each channel.

close()

Close open file.