This file is indexed.

/usr/lib/python2.7/dist-packages/stfio/stfio.py is in python-stfio 0.13.19-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.




"""
The stfio module provides functions to read/write data from/to
common electrophysiology file formats
"""


from sys import version_info
if version_info >= (2,6,0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_stfio', [dirname(__file__)])
        except ImportError:
            import _stfio
            return _stfio
        if fp is not None:
            try:
                _mod = imp.load_module('_stfio', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _stfio = swig_import_helper()
    del swig_import_helper
else:
    import _stfio
del version_info
try:
    _swig_property = property
except NameError:
    pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
    if (name == "thisown"): return self.this.own(value)
    if (name == "this"):
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name,None)
    if method: return method(self,value)
    if (not static):
        self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)

def _swig_setattr(self,class_type,name,value):
    return _swig_setattr_nondynamic(self,class_type,name,value,0)

def _swig_getattr(self,class_type,name):
    if (name == "thisown"): return self.this.own()
    method = class_type.__swig_getmethods__.get(name,None)
    if method: return method(self)
    raise AttributeError(name)

def _swig_repr(self):
    try: strthis = "proxy of " + self.this.__repr__()
    except: strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

try:
    _object = object
    _newclass = 1
except AttributeError:
    class _object : pass
    _newclass = 0


class Recording(_object):
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, Recording, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, Recording, name)
    __repr__ = _swig_repr
    def __init__(self, *args): 
        this = _stfio.new_Recording(*args)
        try: self.this.append(this)
        except: self.this = this
    __swig_destroy__ = _stfio.delete_Recording
    __del__ = lambda self : None;
    __swig_setmethods__["dt"] = _stfio.Recording_dt_set
    __swig_getmethods__["dt"] = _stfio.Recording_dt_get
    if _newclass:dt = _swig_property(_stfio.Recording_dt_get, _stfio.Recording_dt_set)
    __swig_setmethods__["file_description"] = _stfio.Recording_file_description_set
    __swig_getmethods__["file_description"] = _stfio.Recording_file_description_get
    if _newclass:file_description = _swig_property(_stfio.Recording_file_description_get, _stfio.Recording_file_description_set)
    __swig_setmethods__["time"] = _stfio.Recording_time_set
    __swig_getmethods__["time"] = _stfio.Recording_time_get
    if _newclass:time = _swig_property(_stfio.Recording_time_get, _stfio.Recording_time_set)
    __swig_setmethods__["date"] = _stfio.Recording_date_set
    __swig_getmethods__["date"] = _stfio.Recording_date_get
    if _newclass:date = _swig_property(_stfio.Recording_date_get, _stfio.Recording_date_set)
    __swig_setmethods__["comment"] = _stfio.Recording_comment_set
    __swig_getmethods__["comment"] = _stfio.Recording_comment_get
    if _newclass:comment = _swig_property(_stfio.Recording_comment_get, _stfio.Recording_comment_set)
    __swig_setmethods__["xunits"] = _stfio.Recording_xunits_set
    __swig_getmethods__["xunits"] = _stfio.Recording_xunits_get
    if _newclass:xunits = _swig_property(_stfio.Recording_xunits_get, _stfio.Recording_xunits_set)
    __swig_setmethods__["datetime"] = _stfio.Recording_datetime_set
    __swig_getmethods__["datetime"] = _stfio.Recording_datetime_get
    if _newclass:datetime = _swig_property(_stfio.Recording_datetime_get, _stfio.Recording_datetime_set)
    def __getitem__(self, *args): return _stfio.Recording___getitem__(self, *args)
    def __len__(self): return _stfio.Recording___len__(self)
    def write(self, *args):
        """
        Writes a Recording to a file.

            Arguments:
            fname  -- file name
        #ifndef TEST_MINIMAL
            ftype  -- file type (string). At present, only "hdf5" is supported.
        #else
            ftype  -- file type (string). At present, "hdf5", "gdf", "cfs" and "ibw" are supported.
        #endif // TEST_MINIMAL
            verbose-- Show info while writing

            Returns:
            True upon successful completion.
        Writes a Recording to a file.

            Arguments:
            fname  -- file name
        #ifndef TEST_MINIMAL
            ftype  -- file type (string). At present, only "hdf5" is supported.
        #else
            ftype  -- file type (string). At present, "hdf5", "gdf", "cfs" and "ibw" are supported.
        #endif // TEST_MINIMAL
            verbose-- Show info while writing

            Returns:
            True upon successful completion.
        Writes a Recording to a file.

            Arguments:
            fname  -- file name
        #ifndef TEST_MINIMAL
            ftype  -- file type (string). At present, only "hdf5" is supported.
        #else
            ftype  -- file type (string). At present, "hdf5", "gdf", "cfs" and "ibw" are supported.
        #endif // TEST_MINIMAL
            verbose-- Show info while writing

            Returns:
            True upon successful completion.
        """
        return _stfio.Recording_write(self, *args)

    def aspandas(self):
        import sys
        import numpy as np
        has_pandas = True
        try:
            import pandas as pd
        except ImportError:
            has_pandas = False
        if has_pandas:
            chnames = [ch.name for ch in self]
            channels = np.array([np.concatenate([sec for sec in ch]) for ch in self])
            date_range = pd.date_range(start=self.datetime, periods=channels.shape[1],
                                       freq='%dU' % np.round(self.dt*1e3))
            return pd.DataFrame(channels.transpose(), index=date_range, columns=chnames)
        else:
            sys.stderr.write("Pandas is not available on this system\n")
            return None

Recording_swigregister = _stfio.Recording_swigregister
Recording_swigregister(Recording)

class Channel(_object):
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, Channel, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, Channel, name)
    __repr__ = _swig_repr
    def __init__(self, *args): 
        this = _stfio.new_Channel(*args)
        try: self.this.append(this)
        except: self.this = this
    __swig_destroy__ = _stfio.delete_Channel
    __del__ = lambda self : None;
    __swig_setmethods__["name"] = _stfio.Channel_name_set
    __swig_getmethods__["name"] = _stfio.Channel_name_get
    if _newclass:name = _swig_property(_stfio.Channel_name_get, _stfio.Channel_name_set)
    __swig_setmethods__["yunits"] = _stfio.Channel_yunits_set
    __swig_getmethods__["yunits"] = _stfio.Channel_yunits_get
    if _newclass:yunits = _swig_property(_stfio.Channel_yunits_get, _stfio.Channel_yunits_set)
    def __getitem__(self, *args): return _stfio.Channel___getitem__(self, *args)
    def __len__(self): return _stfio.Channel___len__(self)
Channel_swigregister = _stfio.Channel_swigregister
Channel_swigregister(Channel)

class Section(_object):
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, Section, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, Section, name)
    __repr__ = _swig_repr
    def __init__(self, *args): 
        this = _stfio.new_Section(*args)
        try: self.this.append(this)
        except: self.this = this
    __swig_destroy__ = _stfio.delete_Section
    __del__ = lambda self : None;
    def __getitem__(self, *args): return _stfio.Section___getitem__(self, *args)
    def __len__(self): return _stfio.Section___len__(self)
    def asarray(self):
        """Returns the section as a numpy array."""
        return _stfio.Section_asarray(self)

Section_swigregister = _stfio.Section_swigregister
Section_swigregister(Section)


def _read(*args):
  """
    _read(filename, ftype, verbose, Data) -> bool

    Reads a file and returns a recording object.
          
    Arguments:
    filename -- file name
    #ifndef TEST_MINIMAL
    ftype    -- File type
    #else
    ftype    -- File type (obsolete)
    #endif // TEST_MINIMAL
    verbose  -- Show info while reading

    Returns:
    A recording object.
    """
  return _stfio._read(*args)
import os


class StfIOException(Exception):
    """ raises Exceptions for the Stfio module """
    def __init__(self, error_msg):
        self.msg = error_msg 

    def __str__(self):
        return repr(self.msg)

filetype = {
    '.dat':'cfs',
    '.h5':'hdf5',
    '.abf':'abf',
    '.atf':'atf',
    '.axgd':'axg',
    '.axgx':'axg'}

def read(fname, ftype=None, verbose=False):
    """Reads a file and returns a Recording object.

    Arguments:
    fname  -- file name
#ifndef TEST_MINIMAL
    ftype  -- file type (string); can be one of:
              "cfs"  - CED filing system
              "hdf5" - HDF5
              "abf"  - Axon binary file
              "atf"  - Axon text file
              "axg"  - Axograph X binary file
              "heka" - HEKA binary file
              if ftype is None (default), it will be guessed from the
              extension.
#else
    ftype  -- file type (string) is obsolete.
              in the past it has been used to determine the file type.
              Now an automated file type identification is used, and this
              parameter become obsolete; eventually it will be removed.
#endif // TEST_MINIMAL
    verbose-- Show info while reading file

    Returns:
    A Recording object.
    """
    if not os.path.exists(fname):
        raise StfIOException('File %s does not exist' % fname)


    if ftype is None:
        
        ext = os.path.splitext(fname)[1]
        try:
            ftype = filetype[ext]
        except KeyError:
            raise StfIOException('Couldn\'t guess file type from extension (%s)' % ext)


    rec = Recording()
    if not _read(fname, ftype, verbose, rec):
        raise StfIOException('Error reading file')

    if verbose:
        print("")
        
    return rec


# This file is compatible with both classic and new-style classes.