/usr/share/pyshared/neuroshare/SegmentEntity.py is in python-neuroshare 0.8.5-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 | from Entity import *
class SegmentSource(object):
def __init__(self, segment, source_id, info):
self._segment = segment
self._source_id = source_id
self._info = info
@property
def segment(self):
return self._segment
@property
def id(self):
return self._source_id
@property
def metadata_raw(self):
return self._info
@property
def min_value(self):
return self._info['MinVal']
@property
def max_value(self):
return self._info['MaxVal']
@property
def resolution(self):
return self._info['Resolution']
@property
def sub_sample_shift(self):
return self._info['SubSampleShift']
@property
def location_x(self):
return self._info['LocationX']
@property
def location_y(self):
return self._info['LocationY']
@property
def location_z(self):
return self._info['LocationZ']
@property
def location_user(self):
return self._info['LocationUser']
@property
def high_freq_corner(self):
return self._info['HighFreqOrder']
@property
def high_freq_order(self):
return self._info['HighFreqOrder']
@property
def high_filter_type(self):
return self._info['HighFilterType']
@property
def low_freq_corner(self):
return self._info['LowFreqOrder']
@property
def low_freq_order(self):
return self._info['LowFreqOrder']
@property
def low_filter_type(self):
return self._info['LowFilterType']
@property
def probe_info(self):
return self._info['ProbeInfo']
class SourcesBag(object):
def __init__(self, segment, infos):
self._infos = infos
self._segment = segment
def __getitem__(self, key):
source_id = int (key)
source_info = self._infos[source_id]
return SegmentSource (self._segment, source_id, source_info)
def __iter__(self):
for x in range(0, len (self._infos)):
yield self[x]
class SegmentEntity(Entity):
def __init__(self, nsfile, eid, info):
from copy import copy
self._source_infos = info['SourceInfos']
pure_info = copy(info)
del pure_info['SourceInfos']
super(SegmentEntity,self).__init__(eid, nsfile, pure_info)
@property
def max_sample_count(self):
return self._info['MaxSampleCount']
@property
def source_count(self):
return self._info['SourceCount']
@property
def sources(self):
return SourcesBag(self, self._source_infos)
def get_data (self, index):
lib = self.file.library
data = lib._get_segment_data (self, index)
return data
|