Package empro :: Package toolkit :: Module citifile :: Class CitiFile
[frames] | no frames]

Class CitiFile

source code

    UserDict.UserDict --+    
                        |    
UserDict.IterableUserDict --+
                            |
                           CitiFile

Class to hold the content of a CITI file in memory as EMPro DataSets.

Instance Methods
reads a CITI file from disk
__init__(path)
CitiFile(name='DATA') -> an empty instance with a name CitiFile({'S[1,1]': DataSet, 'S[1,2]': DataSet, ...}, name='DATA'): -> a CitiFile made from a dictionary of EMPro DataSets.
source code
 
__setitem__(self, key, dataset) source code
 
getVarName(self) source code
 
write(self, path)
Write the CITI file to disk
source code
 
writeAdsDataSet(self, path)
Write the data to disk as a Ads DataSet (".ds") file
source code
 
asMatrix(self, dataName=None)
self.asMatrix('S') -> DataSetMatrix CITI files often have data series of the form 'S[i,j]' or 'PORTZ[i]' that form a matrix of data series.
source code
 
getPermutatedCiti(self, pdict)
Returns a CitiFile datastructure with the mapping pdict performed on the indices self : input CitiFile datastructure pdict : mapping to be performed on the indices of the form { fromIndex : toIndex, ...
source code
 
fromkeys(iterable, value=None) source code

Inherited from UserDict.IterableUserDict: __iter__

Inherited from UserDict.UserDict: __cmp__, __contains__, __delitem__, __getitem__, __len__, __repr__, clear, copy, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Class Variables

Inherited from UserDict.UserDict: __hash__

Properties
  var
The independent variable of the CITI file as a EMPro DataSet.
  size
length of the independent variable or dimension
Method Details

__init__(path)
(Constructor)

source code 
CitiFile(name='DATA') -> an empty instance with a name
CitiFile({'S[1,1]': DataSet, 'S[1,2]': DataSet, ...}, name='DATA'): ->
        a CitiFile made from a dictionary of EMPro DataSets.  The keys
        of the dictionary shall be strings and shall be valid names for
        data series in a CITI file. The values of the dictionary shall
        be one-dimensional EMPro datasets, and their dimension shall be
        identical. This dimension will be used as the independent
        variable of the CITI file.
CitiFile(matrix) -> a CitiFile from a matrix where matrix is a
        L{empro.toolkit.dataset.DataSetMatrix} instance.

Returns: reads a CITI file from disk
Overrides: UserDict.UserDict.__init__

__setitem__(self, key, dataset)
(Index assignment operator)

source code 
Overrides: UserDict.UserDict.__setitem__

asMatrix(self, dataName=None)

source code 

self.asMatrix('S') -> DataSetMatrix CITI files often have data series of the form 'S[i,j]' or 'PORTZ[i]' that form a matrix of data series. Using this function you can get them as a DataSetMatrix in one call. The dataName argument is the name without the brackets like 'S' or 'PORTZ'. If dataName is None, it tries to guess it, if only one dataName is possible.

getPermutatedCiti(self, pdict)

source code 

Returns a CitiFile datastructure with the mapping pdict performed on the indices self : input CitiFile datastructure pdict : mapping to be performed on the indices of the form { fromIndex : toIndex, ... } E.g. : self.getPermutatedCiti({1:2, 2:3, 3:1}) -> CitiFile citiOut.data['S[2,2]'] = self.data['S[1,1]'] citiOut.data['S[2,1]'] = self.data['S[1,3]'] citiOut.data['S[3,3]'] = self.data['S[2,2]'] citiOut.data['S[1,1]'] = self.data['S[3,3]'] citiOut.data['S[4,4]'] = self.data['S[4,4]'] # Indices not listed in the mapping are mapped to themselves citiOut.data['S[4,1]'] = self.data['S[4,3]'] # Indices not listed in the mapping are mapped to themselves ...

fromkeys(iterable, value=None)

source code 
Overrides: UserDict.UserDict.fromkeys

Property Details

var

The independent variable of the CITI file as a EMPro DataSet. This is also the dimension of all data DataSets.

Get Method:
internal.var(self) - The independent variable of the CITI file as a EMPro DataSet.

size

length of the independent variable or dimension

Get Method:
internal.size(self) - length of the independent variable or dimension