How to use the traits.api.Float function in traits

To help you get started, we’ve selected a few traits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github acoular / acoular / acoular / environments.py View on Github external
field with non-uniform velocities that depend on the location. The
    algorithm for the calculation uses a ray-tracing approach that bases on
    rays cast from every microphone position in multiple directions and traced
    backwards in time. The result is interpolated within a tetrahedal grid
    spanned between these rays.
    """
    #: The flow field, must be of type :class:`~acoular.environments.FlowField`.
    ff = Trait(FlowField, 
        desc="flow field")

    #: Number of rays used per solid angle :math:`\Omega`, defaults to 200.
    N = Int(200, 
        desc="number of rays per Om")

    #: The maximum solid angle used in the algorithm, defaults to :math:`\pi`.
    Om = Float(pi, 
        desc="maximum solid angle")

    # internal identifier
    digest = Property(
        depends_on=['ff.digest', 'N', 'Om'], 
        )

    traits_view = View(
            [
                ['ff{Flow field}', 'N{Max. number of rays}', 'Om{Max. solid angle }'], 
                '|[General Flow]'
            ]
        )

    @cached_property
    def _get_digest( self ):
github NMGRL / pychron / pychron / envisage / browser / recent_view.py View on Github external
from pychron.core.helpers.traitsui_shortcuts import okcancel_view
from pychron.core.pychron_traits import BorderHGroup
from pychron.persistence_loggable import PersistenceMixin
from pychron.pychron_constants import ANALYSIS_TYPES, NULL_STR

PREFIX = {'Last Day': 24, 'Last Week': 24 * 7, 'Last Month': 24 * 30}


class RecentView(HasTraits, PersistenceMixin):
    mass_spectrometers = List(dump=True)
    available_mass_spectrometers = List
    use_mass_spectrometers = Bool

    nhours = Float(dump=True)
    ndays = Float(dump=True)

    presets = Enum(NULL_STR, 'Last Day', 'Last Week', 'Last Month', dump=True)

    analysis_types = List(ANALYSIS_TYPES, dump=True)
    available_analysis_types = List(ANALYSIS_TYPES)

    persistence_name = 'recent_view'

    def traits_view(self):
        v = okcancel_view(VGroup(HGroup(BorderHGroup(UItem('presets', ),
                                                     label='Presets'),
                                        BorderHGroup(Item('ndays', label='Days',
                                                          tooltip='Number of days. Set Presets to --- to enable',
                                                          enabled_when='presets=="---"'),
                                                     UItem('nhours',
                                                           tooltip='Number of hours. Set Presets to --- to enable',
github acoular / acoular / acoular / sources.py View on Github external
# Microphone locations.
    # Deprecated! Use :attr:`mics` trait instead.
    mpos = Property()
    
    def _get_mpos(self):
        return self.mics
    
    def _set_mpos(self, mpos):
        warn("Deprecated use of 'mpos' trait. ", Warning, stacklevel = 2)
        self.mics = mpos

    # --- End of backwards compatibility traits --------------------------------------
        
    #: Start time of the signal in seconds, defaults to 0 s.
    start_t = Float(0.0,
        desc="signal start time")
    
    #: Start time of the data aquisition at microphones in seconds, 
    #: defaults to 0 s.
    start = Float(0.0,
        desc="sample start time")

    
    #: Number of samples is set automatically / 
    #: depends on :attr:`signal`.
    numsamples = Delegate('signal')
    
    #: Sampling frequency of the signal; is set automatically / 
    #: depends on :attr:`signal`.
    sample_freq = Delegate('signal')
github NMGRL / pychron / pychron / hardware / newport / newport_axis.py View on Github external
proportional_gain = Float(enter_set=True, auto_set=False)
    integral_gain = Float(enter_set=True, auto_set=False)
    derivative_gain = Float(enter_set=True, auto_set=False)
    integral_saturation_level = Float(enter_set=True, auto_set=False)

    velocity_feed_forward_gain = Float(enter_set=True, auto_set=False)
    acceleration_feed_forward_gain = Float(enter_set=True, auto_set=False)

    maximum_following_error_threshold = Float(enter_set=True, auto_set=False)
    position_deadband = Float(enter_set=True, auto_set=False)

    update_interval = Float(enter_set=True, auto_set=False)

    reduce_motor_torque_time = Float(enter_set=True, auto_set=False)
    reduce_motor_torque_percent = Float(enter_set=True, auto_set=False)

    slave_axis = Int(enter_set=True, auto_set=False)
    master_slave_reduction_ratio = Float(enter_set=True, auto_set=False)
    master_slave_jog_velocity_update = Float(enter_set=True, auto_set=False)
    master_slave_jog_velocity_scaling_coefficients = Str(enter_set=True, auto_set=False)

    backlash_compensation = Float(enter_set=True, auto_set=False)
    linear_compensation = Float(enter_set=True, auto_set=False)

    amplifier_io_configuration = Property(depends_on='_amplifier_io_configuration')
    _amplifier_io_configuration = Int
    feedback_configuration = Property(depends_on='_feedback_configuration')
    _feedback_configuration = Int
    estop_configuration = Property(depends_on='_estop_configuration')
    _estop_configuration = Int
    following_error_configuration = Property(depends_on='_following_error_configuration')
github enthought / traitsui / traitsui / table_column.py View on Github external
#: The tooltip to display when the mouse is over the column:
    tooltip = Str

    #: The width of the column (< 0.0: Default, 0.0..1.0: fraction of total table
    #: width, > 1.0: absolute width in pixels):
    width = Float(-1.0)

    #: The width of the column while it is being edited (< 0.0: Default,
    #: 0.0..1.0: fraction of total table width, > 1.0: absolute width in
    #: pixels):
    edit_width = Float(-1.0)

    #: The height of the column cell's row while it is being edited
    #: (< 0.0: Default, 0.0..1.0: fraction of total table height,
    #: > 1.0: absolute height in pixels):
    edit_height = Float(-1.0)

    #: The resize mode for this column.  This takes precedence over other settings
    #: (like **width**, above).
    #:   "interactive": column can be resized by users or programmatically
    #:   "fixed": users cannot resize the column, but it can be set programmatically
    #:   "stretch": the column will be resized to fill the available space
    #:   "resize_to_contents": column will be sized to fit the contents, but then cannot be resized
    resize_mode = Enum("interactive", "fixed", "stretch", "resize_to_contents")

    #: The view (if any) to display when clicking a non-editable cell:
    view = AView

    #: Optional maximum value a numeric cell value can have:
    maximum = Float(trait_value=True)

    # -------------------------------------------------------------------------
github NMGRL / pychron / pychron / hardware / newport / newport_axis.py View on Github external
home_search_low_speed = Float(enter_set=True, auto_set=False)

    maximum_acceleration_deceleration = Float(enter_set=True, auto_set=False)

    estop_deceleration = Float(enter_set=True, auto_set=False)
    jerk_rate = Float(enter_set=True, auto_set=False)

    proportional_gain = Float(enter_set=True, auto_set=False)
    integral_gain = Float(enter_set=True, auto_set=False)
    derivative_gain = Float(enter_set=True, auto_set=False)
    integral_saturation_level = Float(enter_set=True, auto_set=False)

    velocity_feed_forward_gain = Float(enter_set=True, auto_set=False)
    acceleration_feed_forward_gain = Float(enter_set=True, auto_set=False)

    maximum_following_error_threshold = Float(enter_set=True, auto_set=False)
    position_deadband = Float(enter_set=True, auto_set=False)

    update_interval = Float(enter_set=True, auto_set=False)

    reduce_motor_torque_time = Float(enter_set=True, auto_set=False)
    reduce_motor_torque_percent = Float(enter_set=True, auto_set=False)

    slave_axis = Int(enter_set=True, auto_set=False)
    master_slave_reduction_ratio = Float(enter_set=True, auto_set=False)
    master_slave_jog_velocity_update = Float(enter_set=True, auto_set=False)
    master_slave_jog_velocity_scaling_coefficients = Str(enter_set=True, auto_set=False)

    backlash_compensation = Float(enter_set=True, auto_set=False)
    linear_compensation = Float(enter_set=True, auto_set=False)

    amplifier_io_configuration = Property(depends_on='_amplifier_io_configuration')
github nipy / dipy / dipy / tracking / interfaces.py View on Github external
smoothing_kernel_type = T.Enum(None, all_kernels.keys())
    smoothing_kernel = T.Instance(T.HasTraits)

    @T.on_trait_change('smoothing_kernel_type')
    def set_smoothing_kernel(self):
        if self.smoothing_kernel_type is not None:
            kernel_factory = all_kernels[self.smoothing_kernel_type]
            self.smoothing_kernel = kernel_factory()
        else:
            self.smoothing_kernel = None

    interpolator = T.Enum('NearestNeighbor', all_interpolators.keys())
    model_type = T.Enum('SlowAdcOpdf', all_shmodels.keys())
    sh_order = T.Int(4)
    Lambda = T.Float(0, desc="Smoothing on the odf")
    sphere_coverage = T.Int(5)
    min_peak_spacing = T.Range(0., 1, np.sqrt(.5), desc="as a dot product")
    min_relative_peak = T.Range(0., 1, .25)

    probabilistic = T.Bool(False, label='Probabilistic (Residual Bootstrap)')
    bootstrap_input = T.Bool(False)
    bootstrap_vector = T.Array(dtype='int', value=[])

    # integrator = Enum('Boundry', all_integrators.keys())
    seed_largest_peak = T.Bool(False, desc="Ignore sub-peaks and start follow "
                                           "the largest peak at each seed")
    start_direction = T.Array(dtype='float', shape=(3,), value=[0, 0, 1],
                              desc="Prefered direction from seeds when "
                                   "multiple directions are available. "
                                   "(Mostly) doesn't matter when 'seed "
                                   "largest peak' and 'track two directions' "
github hyperspy / hyperspy / hyperspy / gui / egerton_quantification.py View on Github external
"Note: Various settings can be configured in "
    "the \"Advanced settings\" section. Hover the "
    "mouse over each parameter for a description of what "
    "it does."

    "\n")


class SpikesRemoval(SpanSelectorInSignal1D):
    interpolator_kind = t.Enum(
        'Linear',
        'Spline',
        default='Linear',
        desc="the type of interpolation to use when\n"
             "replacing the signal where a spike has been replaced")
    threshold = t.Float(desc="the derivative magnitude threshold above\n"
                        "which to find spikes")
    click_to_show_instructions = t.Button()
    show_derivative_histogram = t.Button()
    spline_order = t.Range(1, 10, 3,
                           desc="the order of the spline used to\n"
                           "connect the reconstructed data")
    interpolator = None
    default_spike_width = t.Int(5,
                                desc="the width over which to do the interpolation\n"
                                "when removing a spike (this can be "
                                "adjusted for each\nspike by clicking "
                                     "and dragging on the display during\n"
                                     "spike replacement)")
    index = t.Int(0)
    add_noise = t.Bool(True,
                       desc="whether to add noise to the interpolated\nportion"
github NMGRL / pychron / pychron / mv / degas / degasser.py View on Github external
output = (self.Kp * error) + (self.Ki * self._integral_err) + (self.Kd * derivative)
        self._prev_err = error
        return min(self.max_output, max(self.min_output, output))
    def traits_view(self):
        v = View(
               Item('Kp'),
               Item('Ki'),
               Item('Kd'),
               )
        return v
class Degasser(MachineVisionManager, ExecuteMixin):
    _period = 0.05
    crop_width = Int(5)
    crop_height = Int(5)

    _test_lumens = Float(100)
    _test_duration = Int(10)
    _test_graph = Instance(StackedGraph)
    _test_image = Instance(TestImage)
    _testing = False

    pid = Instance(PID, ())

    def degas(self, lumens, duration):
        '''
            degas for duration trying to maintain
            lumens
        '''
        if self.laser_manager:

            self.laser_manager.fiber_light.power_off()
github enthought / chaco / chaco / tools / legend_highlighter.py View on Github external
renderers = legend.plots[label_name]
        return _ensure_list(renderers)
    except (ValueError, KeyError):
        return []


class LegendHighlighter(LegendTool):
    """ A tool for legends that allows clicking on the legend to show
    or hide certain plots.
    """

    #: Which mousebutton to use to move the legend
    drag_button = "right"

    #: What to divide the alpha value by when plot is not selected
    dim_factor = Float(3.0)

    #: How much to scale the line when it is selected or deselected
    line_scale = Float(2.0)

    # The currently selected renderers
    _selected_renderers = List

    def normal_left_down(self, event):
        if (not self.component.visible or
                not self.component.is_in(event.x, event.y)):
            return

        plots = get_hit_plots(self.component, event)
        if event.shift_down:
            # User in multi-select mode by using [shift] key.
            for plot in plots: