Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
desc="basename of data file")
#: Calibration data, instance of :class:`~acoular.calib.Calib` class, optional .
calib = Trait( Calib,
desc="Calibration data")
#: Number of channels, is set automatically / read from file.
numchannels = CLong(0,
desc="number of input channels")
#: Number of time data samples, is set automatically / read from file.
numsamples = CLong(0,
desc="number of samples")
#: The time data as array of floats with dimension (numsamples, numchannels).
data = Any( transient = True,
desc="the actual time data array")
#: HDF5 file object
h5f = Instance(tables.File, transient = True)
# Checksum over first data entries of all channels
_datachecksum = Property()
# internal identifier
digest = Property( depends_on = ['basename', 'calib.digest', '_datachecksum'])
traits_view = View(
['name{File name}',
['sample_freq~{Sampling frequency}',
'numchannels~{Number of channels}',
'numsamples~{Number of samples}',
# The renderer or Plot to attach this scrollbar to. By default, this
# is just self.component.
plot = Property
# The mapper for associated with the scrollbar. By default, this is the
# mapper on **plot** that corresponds to **axis**.
mapper = Property
#------------------------------------------------------------------------
# Private traits
#------------------------------------------------------------------------
# The value of the override plot to use, if any. If None, then uses
# self.component.
_plot = Trait(None, Any)
# The value of the override mapper to use, if any. If None, then uses the
# mapper on self.component.
_mapper = Trait(None, Any)
# Stores the index (0 or 1) corresponding to self.axis
_axis_index = Trait(None, None, Int)
#----------------------------------------------------------------------
# Public methods
#----------------------------------------------------------------------
def force_data_update(self):
""" This forces the scrollbar to recompute its range bounds. This
should be used if datasources are changed out on the range, or if
# The most recently right_clicked item and its index:
right_clicked = Event
right_clicked_index = Event
# Is the list editor scrollable? This value overrides the default.
scrollable = True
# Should the selected item be edited after rebuilding the editor list:
edit = Bool(False)
# The adapter from list items to editor values:
adapter = Instance(ListStrAdapter)
# Dictionary mapping image names to QIcons
images = Any({})
# Dictionary mapping ImageResource objects to QIcons
image_resources = Any({})
# The current number of item currently in the list:
item_count = Property
# The current search string:
search = Str
#-------------------------------------------------------------------------
# Editor interface:
#-------------------------------------------------------------------------
def init(self, parent):
""" Finishes initializing the editor by creating the underlying toolkit
############################################################################
# Automatically generated filters from registry.
############################################################################
class _AutomaticFilterFactory(PipeFactory):
"""The base class for any auto-generated factory classes.
NOTE: This class requires that the `_metadata` trait be set to
the metadata object for the object for which this is a factory.
"""
# The target.
_target = Property
# The saved target that is created once and then always returned.
_saved_target = Any(None)
def _get__target(self):
"""Getter for the _target trait."""
if self._saved_target is None:
self._saved_target = self._metadata.get_callable()()
return self._saved_target
def _make_functions(namespace):
"""Make the functions for adding filters and add them to the
namespace automatically.
"""
for fil in registry.filters:
func_name = camel2enthought(fil.id)
class_name = fil.id
config = Property(Dict, depends_on=['specs'])
# Username used to connect to the DB
username = Property(Str, depends_on=['config'])
# Password used to connect to the DB
password = Property(Str, depends_on=['config'])
# hostname of the DB
hostname = Property(Str, depends_on=['config'])
# name of the database
db_name = Property(Str, depends_on=['config'])
# Chunksize
chunksize = Property(Any, depends_on=['specs'])
# Query
query = Property(Str, depends_on=['specs'])
# SQlAlchemy connection object to be used by the parser
connection = Property(Any, depends_on=['username', 'password', 'hostname',
'db_name'])
# Parser args to be used by the pandas parser
parser_args = Property(Dict, depends_on=['connection', 'specs'])
@cached_property
def _get_chunksize(self):
return self.specs.get("chunksize")
@cached_property
while True:
line = queue.get()
if line == 'EOF':
break
yield line
or a simple line-by-line filter::
def filter(line):
return processed(line)
"""
_simple = CBool
_stop = CBool
_queue = Any(transient=True)
_process = Any(transient=True)
def cmd_loop(self):
p = self._process = subprocess.Popen(self.cmd, shell=True, executable='bash', stdout=subprocess.PIPE)
while True:
line = p.stdout.readline().decode('utf-8')
self._queue.put(line)
if not line:
self.logger.debug('Process exiting (cmd_loop)')
break
def status_loop(self):
args = (self,) if self.caller else ()
def default_filter(queue, *args):
while True:
line = queue.get()
segment_number = Int(0)
### View traits
antic_font = Any
playfield_colors = Any
disassembler = Any
segment = Any(None)
highlight_color = Any((100, 200, 230))
background_color = Any((255, 255, 255))
text_color = Any((0, 0, 0))
empty_color = Any(None)
text_font_size = Int(8)
text_font_face = Str("")
text_font = Any(None)
#### Events ####
changed = Event
key_pressed = Event(KeyPressedEvent)
keep = util.PositiveFloat(0.9, allow_zero = False)
bins = util.PositiveInt(100, allow_zero = False)
min_quantile = util.PositiveFloat(0.001, allow_zero = True)
max_quantile = util.PositiveFloat(1.0, allow_zero = False)
sigma = util.PositiveFloat(1.0, allow_zero = False)
by = List(Str)
_xscale = Instance(util.IScale, transient = True)
_yscale = Instance(util.IScale, transient = True)
_xbins = Array(transient = True)
_ybins = Array(transient = True)
_keep_xbins = Dict(Any, Array, transient = True)
_keep_ybins = Dict(Any, Array, transient = True)
_histogram = Dict(Any, Array, transient = True)
def estimate(self, experiment, subset = None):
"""
Split the data set into bins and determine which ones to keep.
Parameters
----------
experiment : Experiment
The :class:`.Experiment` to use to estimate the gate parameters.
subset : Str (default = None)
If set, determine the gate parameters on only a subset of the
``experiment`` parameter.
"""
if experiment is None:
class ActionItem(ActionManagerItem):
""" An action manager item that represents an actual action. """
# 'ActionManagerItem' interface ----------------------------------------
#: The item's unique identifier ('unique' in this case means unique within
#: its group).
id = Property(Str)
# 'ActionItem' interface -----------------------------------------------
#: The action!
action = Instance(Action)
#: The toolkit specific control created for this item.
control = Any()
#: The toolkit specific Id of the control created for this item.
#
#: We have to keep the Id as well as the control because wx tool bar tools
#: are created as 'wxObjectPtr's which do not have Ids, and the Id is
#: required to manipulate the state of a tool via the tool bar 8^(
# FIXME v3: Why is this part of the public interface?
control_id = Any()
# Private interface ----------------------------------------------------
#: All of the internal instances that wrap this item.
_wrappers = List(Any)
# ------------------------------------------------------------------------
# 'ActionManagerItem' interface.
grid_range_selected = Bool
segment_parser = Any
segment_number = Int(0)
### View traits
antic_font = Any
playfield_colors = Any
disassembler = Any
segment = Any(None)
highlight_color = Any((100, 200, 230))
background_color = Any((255, 255, 255))
text_color = Any((0, 0, 0))
empty_color = Any(None)
text_font_size = Int(8)
text_font_face = Str("")
text_font = Any(None)
#### Events ####