Beispiel #1
0
class Test_Pads(EBL_Polygons):
    """Makes test pad structure for pads"""
    def _default_plot_sep(self):
        return False

    @private_property
    def base_name(self):
        return "Test_Pads"

    def _default_color(self):
        return "blue"

    contact_width = Float(125.0e-6).tag(unit="um", desc="width of contact")
    contact_height = Float(170.0e-6).tag(unit="um", desc="height of contact")
    bridge_gap_x = Float(20.0e-6).tag(
        unit="um", desc="horizontal gap between testpad electrodes")
    bridge_gap_y = Float(50.0e-6).tag(
        unit="um", desc="vertical gap between testpad electrodes")
    testpad_width = Float(400.0e-6).tag(unit="um",
                                        desc="overall width of testpad")
    testpad_height = Float(450.0e-6).tag(unit="um",
                                         desc="overall height of testpad")
    tp_bond_pad = Float(100.0e-6).tag(unit="um",
                                      desc="bonding area of testpad")

    @private_property
    def polylist(self):
        """makes 4 branched testpad through reflections"""
        self.verts = []
        reset_property(self, "_s_testpad_TL")
        self.verts.extend(self._s_testpad_TL)
        self.verts.extend(horiz_refl(self._s_testpad_TL))
        self.verts.extend(vert_refl(self._s_testpad_TL))
        self.verts.extend(horizvert_refl(self._s_testpad_TL))
        return self.verts

    @private_property
    def _s_testpad_TL(self):
        """returns top left part of test pad"""
        return sP([(-self.testpad_width / 2.0, -self.testpad_height / 2.0),
                   (-self.testpad_width / 2.0,
                    -self.testpad_height / 2.0 + self.tp_bond_pad),
                   (-self.contact_width / 2.0, -self.contact_height / 2.0),
                   (-self.contact_width / 2.0, -self.bridge_gap_y / 2.0),
                   (-self.bridge_gap_x / 2.0, -self.bridge_gap_y / 2.0),
                   (-self.bridge_gap_x / 2.0, -self.contact_height / 2.0),
                   (-self.testpad_width / 2.0 + self.tp_bond_pad,
                    -self.testpad_height / 2.0)])
Beispiel #2
0
class Fillet(Operation):
    """ Applies fillet operation to the first child shape.

    Attributes
    ----------

    shape: String
        The fillet shape type apply
    radius: Float
        Radius of the fillet. Must be less than the face width.
    operations: List of edges, optional
        List of edges to apply the operation to. If not given all edges will
        be used.  Used in conjunction with the `topology.edges` attribute.

    Examples
    --------

    Fillet:
        #: Fillet the first 4 edges of the box (left side)
        operations = [e for i, e in enumerate(box.topology.edges) if i < 4]
        radius = 0.1
        Box: box:
            pass

    """
    #: Reference to the implementation control
    proxy = Typed(ProxyFillet)

    #: If True, don't apply the fillet (for debugging)
    disabled = d_(Bool())

    #: Fillet shape type
    shape_type = d_(Enum('rational', 'angular', 'polynomial')).tag(
        view=True, group='Fillet')

    #: Radius of fillet
    radius = d_(Float(1, strict=False)).tag(view=True, group='Fillet')

    #: Edges to apply fillet to and parameters
    #: Leave blank to use all edges of the shape
    operations = d_(List()).tag(view=True, group='Fillet')

    @observe('shape_type', 'radius', 'operations', 'disabled')
    def _update_proxy(self, change):
        super(Fillet, self)._update_proxy(change)
Beispiel #3
0
    class Test(Atom):
        a=SProperty(cached=False)
        c=Float()
        #b=TProperty(cached=False)#.tag(blah=3)
        #_b=Value()
        d=Enum("single", "double")

        @t_property(cached=False)
        def b(self, d):
            return {"single" : 3, "double" : 4}[d]

        @a.getter
        def _get_a(self, c):
            return 2*c

        @a.setter
        def _get_c(self, a):
            return a/2
Beispiel #4
0
class Page(SQLModel):
    title = Str().tag(length=60)
    status = Enum("preview", "live")
    body = Str().tag(type=sa.UnicodeText())
    author = Instance(User)
    if DATABASE_URL.startswith("postgres"):
        images = List(Instance(Image))
        related = List(ForwardInstance(lambda: Page)).tag(nullable=True)
        tags = List(str)

    visits = BigInt()
    date = Instance(date)
    last_updated = Instance(datetime)
    rating = Instance(Decimal)
    ranking = Float().tag(name="order")

    # A bit verbose but provides a custom column specification
    data = Instance(object).tag(column=sa.Column("data", sa.LargeBinary()))
Beispiel #5
0
class FloatingActionButton(ImageButton):
    """ A simple control for displaying a floating button with an Image.

    """
    #: A reference to the proxy object.
    proxy = Typed(ProxyFloatingActionButton)

    #: Size of the button. Auto will resize to mini for small screens
    size = d_(Enum('normal', 'auto', 'mini'))

    #: Elevation to use
    elevation = d_(Float())

    #: Color of the ripple touch effect
    ripple_color = d_(Unicode())

    #: Show or hide the button
    show = d_(Bool(True))
Beispiel #6
0
    class tSpy(Spy):
        a = Float().tag(unit="A",
                        unit_factor=10.0,
                        label="Current",
                        no_spacer=True,
                        show_value=True)
        b = Unicode()
        c = Unicode().tag(no_spacer=True, spec="multiline")
        d = Int().tag(unit="A",
                      unit_factor=10,
                      label="Current",
                      show_value=True)
        e = Enum("arg")

        @Callable
        def g(self):
            print self
            print "ran g"
Beispiel #7
0
class FFTChannelPlot(ChannelPlot):

    time_span = d_(Float(1))
    waveform_averages = d_(Int(1))
    window = d_(Enum('hamming', 'flattop'))
    apply_calibration = d_(Bool(True))
    _x = Typed(np.ndarray)
    _buffer = Typed(SignalBuffer)

    def _default_name(self):
        return self.source_name + '_fft_plot'

    def _observe_source(self, event):
        if self.source is not None:
            self.source.add_callback(self._append_data)
            self.source.observe('fs', self._cache_x)
            self._update_buffer()
            self._cache_x()

    def _update_buffer(self, event=None):
        self._buffer = SignalBuffer(self.source.fs, self.time_span)

    def _append_data(self, data):
        self._buffer.append_data(data)
        self.update()

    def _cache_x(self, event=None):
        if self.source.fs:
            time_span = self.time_span / self.waveform_averages
            self._x = get_x_fft(self.source.fs, time_span)

    def update(self, event=None):
        if self._buffer.get_time_ub() >= self.time_span:
            data = self._buffer.get_latest(-self.time_span, 0)
            psd = util.psd(data,
                           self.source.fs,
                           self.window,
                           waveform_averages=self.waveform_averages)
            if self.apply_calibration:
                db = self.source.calibration.get_db(self._x, psd)
            else:
                db = util.db(psd)
            if self._x.shape == db.shape:
                deferred_call(self.plot.setData, self._x, db)
Beispiel #8
0
class DrawerLayout(ViewGroup):
    """ A simple control for displaying a drawer

    """
    #: List of opened drawers
    opened = d_(List(View))

    #: Drawer width
    drawer_width = d_(Int(200))

    #: Title of drawer
    title = d_(Unicode())

    #: Gravity of title
    title_gravity = d_(Int())

    #: Elevation
    drawer_elevation = d_(Float())

    #: Set lock mode
    lock_mode = d_(Enum('unlocked', 'locked_closed', 'locked_open'))

    #: Set a color to use for the scrim that obscures primary content
    #: while a drawer is open.
    scrim_color = d_(Unicode())

    #: Statusbar background color
    status_bar_background_color = d_(Unicode())

    #: A reference to the ProxyLabel object.
    proxy = Typed(ProxyDrawerLayout)

    # -------------------------------------------------------------------------
    # Observers
    # -------------------------------------------------------------------------
    @observe('opened', 'drawer_width', 'title', 'title_gravity',
             'drawer_elevation', 'drawer_lock_mode', 'scrim_color',
             'status_bar_background_color')
    def _update_proxy(self, change):
        """ An observer which sends the state change to the proxy.

        """
        # The superclass implementation is sufficient.
        super(DrawerLayout, self)._update_proxy(change)
Beispiel #9
0
class PointCalibration(Calibration):

    frequency = Typed(np.ndarray).tag(metadata=True)
    sensitivity = Typed(np.ndarray).tag(metadata=True)
    fixed_gain = Float(0).tag(metadata=True)

    def __init__(self, frequency, sensitivity, fixed_gain=0, source=None):
        if np.isscalar(frequency):
            frequency = [frequency]
        if np.isscalar(sensitivity):
            sensitivity = [sensitivity]
        self.frequency = np.array(frequency)
        self.sensitivity = np.array(sensitivity)
        self.fixed_gain = fixed_gain
        if source is not None:
            self.source = Path(source)

    def get_sens(self, frequency):
        if np.iterable(frequency):
            return np.array([self._get_sens(f) for f in frequency])
        else:
            return self._get_sens(frequency)

    def _get_sens(self, frequency):
        try:
            i = np.flatnonzero(np.equal(self.frequency, frequency))[0]
        except IndexError:
            log.debug('Calibrated frequencies are %r', self.frequency)
            m = 'Frequency {} not calibrated'.format(frequency)
            raise CalibrationError(m)
        return self.sensitivity[i]-self.fixed_gain


    @classmethod
    def from_psi_chirp(cls, folder, output_gain=None, **kwargs):
        filename = os.path.join(folder, 'chirp_sensitivity.csv')
        sensitivity = pd.io.parsers.read_csv(filename)
        if output_gain is None:
            output_gain = sensitivity.loc[:, 'hw_ao_chirp_level'].max()
        m = sensitivity['hw_ao_chirp_level'] == output_gain
        mic_freq = sensitivity.loc[m, 'frequency'].values
        mic_sens = sensitivity.loc[m, 'sens'].values
        source = 'psi_chirp', folder, output_gain
        return cls(mic_freq, mic_sens, source=source, **kwargs)
class Fig2e(Slave):
    """ Fig. 2e, cross section through the zoomed-in fluxmap ("zcs" for "zoomed cross section")"""
    S11_offset = Float(-31.12).tag(
        desc=
        "Background S11 value, chosen to put the flat part of the detuned S11 (panel a) curve at 0dB"
    )
    data = Dict()
    det_freq = Coerced(ndarray, [0], coercer=array).tag(plot=True)
    det_S11 = Coerced(ndarray, [0], coercer=array).tag(plot=True,
                                                       xdata="det_freq")
    det_phase = Coerced(ndarray, [0], coercer=array).tag(plot=True,
                                                         xdata="det_freq")
    S11 = Coerced(ndarray, [0], coercer=array).tag(plot=True, xdata="det_freq")
    freq = Coerced(ndarray, [0], coercer=array).tag(plot=True,
                                                    xdata="det_freq")
    phase = Coerced(ndarray, [0], coercer=array).tag(plot=True,
                                                     xdata="det_freq")
    yoko = Coerced(ndarray, [0], coercer=array).tag(plot=True,
                                                    xdata="det_freq")
Beispiel #11
0
class DisplayText(DisplayItem):
    """ Add text to the 3d display.

    """
    #: Reference to the implementation control
    proxy = Typed(ProxyDisplayText)

    #: Text to display
    text = d_(Str())

    #: Font size
    size = d_(Float(12))

    #: Font family
    font = d_(Str())

    @observe('text', 'size', 'font')
    def _update_proxy(self, change):
        super()._update_proxy(change)
Beispiel #12
0
class Fillet(LocalOperation):
    """ Applies fillet to the first child shape"""
    #: Reference to the implementation control
    proxy = Typed(ProxyFillet)

    #: Fillet shape type
    shape = d_(Enum('rational', 'angular', 'polynomial')).tag(view=True,
                                                              group='Fillet')

    #: Radius of fillet
    radius = d_(Float(1, strict=False)).tag(view=True, group='Fillet')

    #: Edges to apply fillet to
    #: Leave blank to use all edges of the shape
    edges = d_(ContainerList(object)).tag(view=True, group='Fillet')

    @observe('shape', 'radius', 'edges')
    def _update_proxy(self, change):
        super(Fillet, self)._update_proxy(change)
Beispiel #13
0
class Edge(LogicalChannel):
    '''
    Defines an arc/directed edge between qubit vertices. If a device supports bi-directional
    connectivity, that is represented with two independent Edges.

    An Edge is also effectively an abstract channel, so it carries the same properties as a 
    Qubit channel.
    '''
    # allow unicode in source and target so that we can store a label or an object
    source = Instance((unicode, Qubit))
    target = Instance((unicode, Qubit))
    pulseParams = Dict(
        default={
            'length': 20e-9,
            'amp': 1.0,
            'phase': 0.0,
            'shapeFun': PulseShapes.gaussian,
            'cutoff': 2,
            'dragScaling': 0,
            'sigma': 5e-9,
            'riseFall': 20e-9
        })
    gateChan = Instance((unicode, LogicalMarkerChannel))
    frequency = Float(0.0).tag(
        desc='modulation frequency of the channel (can be positive or negative)'
    )

    def __init__(self, **kwargs):
        super(Edge, self).__init__(**kwargs)
        if self.gateChan is None:
            self.gateChan = LogicalMarkerChannel(label=kwargs['label'] +
                                                 '-gate')

    def isforward(self, source, target):
        ''' Test whether (source, target) matches the directionality of the edge. '''
        nodes = (self.source, self.target)
        if (source not in nodes) or (target not in nodes):
            raise ValueError('One of {0} is not a node in the edge'.format(
                (source, target)))
        if (self.source, self.target) == (source, target):
            return True
        else:
            return False
Beispiel #14
0
class ThruSections(Operation):
    """ An operation that extrudes a shape by means of going through a series
     of profile sections along a spline or path.  
    
    Attributes
    ----------
    
    solid: Bool
        If True, build a solid otherwise build a shell.
    ruled: Bool
        If False, smooth out the surfaces using approximation
    precision: Float, optional
        The precision to use for approximation.
        
    Examples
    --------
    
    See examples/thru_sections.enaml
        
    """
    #: Reference to the implementation control
    proxy = Typed(ProxyThruSections)

    #: isSolid is set to true if the construction algorithm is required
    #: to build a solid or to false if it is required to build a shell
    #: (the default value),
    solid = d_(Bool(False)).tag(view=True, group='Through Sections')

    #: ruled is set to true if the faces generated between the edges
    #: of two consecutive wires are ruled surfaces or to false
    #: (the default value)
    #: if they are smoothed out by approximation
    ruled = d_(Bool(False)).tag(view=True, group='Through Sections')

    #: pres3d defines the precision criterion used by the approximation
    #:  algorithm;
    #: the default value is 1.0e-6. Use AddWire and AddVertex to define
    #: the successive sections of the shell or solid to be built.
    precision = d_(Float(1e-6)).tag(view=True, group='Through Sections')

    @observe('solid', 'ruled', 'precision')
    def _update_proxy(self, change):
        super(ThruSections, self)._update_proxy(change)
Beispiel #15
0
class Fillet(LocalOperation):
    """ Applies fillet operation to the first child shape. 
    
    Attributes
    ----------
    
    shape: String
        The fillet shape type apply
    radius: Float
        Radius of the fillet. Must be less than the face width.
    edges: List of edges, optional
        List of edges to apply the operation to. If not given all edges will
        be used.  Used in conjunction with the `shape_edges` attribute. 
    
    Examples
    --------
    
    Fillet:
        #: Fillet the first 4 edges of the box (left side) 
        edges = [e for i, e in enumerate(box.shape_edges) if i < 4]
        radius = 0.1
        Box: box:
            pass
        
    """
    #: Reference to the implementation control
    proxy = Typed(ProxyFillet)

    #: Fillet shape type
    shape = d_(Enum('rational', 'angular', 'polynomial')).tag(view=True,
                                                              group='Fillet')

    #: Radius of fillet
    radius = d_(Float(1, strict=False)).tag(view=True, group='Fillet')

    #: Edges to apply fillet to
    #: Leave blank to use all edges of the shape
    edges = d_(ContainerList(object)).tag(view=True, group='Fillet')

    @observe('shape', 'radius', 'edges')
    def _update_proxy(self, change):
        super(Fillet, self)._update_proxy(change)
Beispiel #16
0
class Parabola(Edge):
    """ Creates a Parabola with its local coordinate system given by the
    `position` and `direction` and it's focal length `focal_length`.

    Attributes
    ----------

    focal_length: Float
        The focal length of the parabola.

    Notes
    -----
    The XDirection of A2 defines the axis of symmetry of the parabola.
    The YDirection of A2 is parallel to the directrix of the parabola.
    The Location point of A2 is the vertex of the parabola
    Raises ConstructionError if Focal < 0.0 Raised if Focal < 0.0.

    Examples
    ---------

    Wire:
        Parabola:
            focal_length = 10


    """
    proxy = Typed(ProxyParabola)

    #: Focal length of the parabola
    focal_length = d_(Float(1, strict=False)).tag(view=True)

    @property
    def start(self):
        return coerce_point(self.proxy.curve.StartPoint())

    @property
    def end(self):
        return coerce_point(self.proxy.curve.EndPoint())

    @observe('focal_length')
    def _update_proxy(self, change):
        super()._update_proxy(change)
Beispiel #17
0
class Revol(Shape):
    """ A Revol creates a shape by revolving a profile about an axis.
    
    Attributes
    ----------
        
    shape: Shape
        Shape to revolve. If not given, the first child will be used.
    angle: Float
        Angle to revolve (in radians) the base profile.
    copy:  Bool
        Make a copy of the referenced shape.
            
    Examples
    --------
    
    # This creates a cone of radius 4 and height 5.
    
    Revol:
        Wire:
            Segment:
                Looper:
                    iterable = [(0,0,0), (0,2,5),  (0,5,0), (0,0,0)]
                    Point:
                        position = loop_item
            
    """
    #: Proxy shape
    proxy = Typed(ProxyRevol)
    
    #: Shape to build prism from
    shape = d_(Instance(Shape)).tag(view=True)
    
    #: Angle to revolve
    angle = d_(Float(0, strict=False)).tag(view=True)
    
    #: Copy the surface
    copy = d_(Bool(False)).tag(view=True)
    
    @observe('shape', 'angle', 'copy')
    def _update_proxy(self, change):
        super(Revol, self)._update_proxy(change)
Beispiel #18
0
class PiezoChannel(Prop):
    version = '2014.04.06'
    setServo = Typed(BoolProp)
    setPosition = Typed(FloatProp)
    readAxis = Str()
    readServo = Member()
    readPosition = Float()

    def __init__(self, name, experiment, description=''):
        super(PiezoChannel, self).__init__(name, experiment, description)
        self.readServo = False
        self.setServo = BoolProp('setServo', self.experiment, '', 'False')
        self.setPosition = FloatProp('setPosition', self.experiment, '', '0')
        self.readAxis = ''
        self.readServo = False
        self.readPosition = float('nan')
        self.properties += [
            'version', 'setServo', 'setPosition', 'readAxis', 'readServo',
            'readPosition'
        ]
Beispiel #19
0
class SleepTask(SimpleTask):
    """Simply sleeps for the specified amount of time. Wait for any parallel
    operation before execution.
    """

    time = Float().tag(pref=True)

    def __init__(self, **kwargs):
        super(SleepTask, self).__init__(**kwargs)
        self.make_wait()

    def process(self):
        """
        """
        sleep(self.time)

    def check(self, *args, **kwargs):
        """
        """
        return True, {}
Beispiel #20
0
class Revol(Shape):
    #: Proxy shape
    proxy = Typed(ProxyRevol)

    #: Shape to build prism from
    shape = d_(Instance(Shape)).tag(view=True)

    #: Angle to revolve
    angle = d_(Float(0, strict=False)).tag(view=True)

    #: Copy the surface
    copy = d_(Bool(False)).tag(view=True)

    @observe(
        'shape',
        'angle',
        'copy',
    )
    def _update_proxy(self, change):
        super(Revol, self)._update_proxy(change)
class Fig2a(Slave):
    plot_all = Bool(False)
    """ Fig. 2a, the IDT background trace with qubit off resonance ("det" for "detuned")."""
    S11_offset = Float(-31.12).tag(
        desc=
        "Background S11 value, chosen to put the flat part of the detuned S11 (panel a) curve at 0dB"
    )
    det_freq = Coerced(ndarray, [0],
                       coercer=array).tag(plot=True,
                                          plot_label='Frequency (GHz)')
    det_S11 = Coerced(ndarray, [0], coercer=array).tag(
        plot=True, xdata="det_freq", plot_label='S11 with qubit detuned (dB)')
    det_S11_avg = Coerced(ndarray, [0], coercer=array).tag(
        plot=True, xdata="det_freq", plot_label='S11 with qubit detuned (dB)')

    def __init__(self, **kwargs):
        super(Fig2a, self).__init__(**kwargs)
        for key in self.members().keys():
            if self.get_tag(key, 'plot', self.plot_all):
                self.boss.plottables.append(key)
Beispiel #22
0
class ApplyMagFieldAndDropTask(InstrumentTask):
    """Use a supraconducting magnet to apply a magnetic field. Parallel task.

    """
    # Target magnetic field (dynamically evaluated)
    field = Unicode().tag(pref=True,
                          feval=validators.SkipLoop(types=numbers.Real))

    # Rate at which to sweep the field.
    rate = Float(0.01).tag(pref=True)

    parallel = set_default({'activated': True, 'pool': 'instr'})
    database_entries = set_default({'field': 0.01})

    def check_for_interruption(self):
        """Check if the user required an interruption.

        """
        return self.root.should_stop.is_set()

    def perform(self, target_value=None):
        """Apply the specified magnetic field.

        """
        # make ready
        if (self.driver.owner != self.name
                or not self.driver.check_connection()):
            self.driver.owner = self.name

        driver = self.driver
        if driver.heater_state == 'Off':
            raise ValueError(cleandoc(''' Switch heater must be on'''))

        if target_value is None:
            target_value = self.format_and_eval_string(self.field)

        driver.field_sweep_rate = self.rate
        driver.target_field = target_value
        driver.activity = 'To set point'

        self.write_in_database('field', target_value)
Beispiel #23
0
class InterpCalibration(Calibration):
    '''
    Use when calibration is not flat (i.e., uniform) across frequency.

    Parameters
    ----------
    frequency : array-like, Hz
        Calibrated frequencies (in Hz)
    sensitivity : array-like, dB(V/Pa)
        Sensitivity at calibrated frequency in dB(V/Pa) assuming 1 Vrms and 0 dB
        gain.  If you have sensitivity in V/Pa, just pass it in as
        20*np.log10(sens).
    fixed_gain : float
        Fixed gain of the input or output.  The sensitivity is calculated using
        a gain of 0 dB, so if the input (e.g. a microphone preamp) or output
        (e.g. a speaker amplifier) adds a fixed gain, this needs to be factored
        into the calculation.

        For input calibrations, the gain must be negative (e.g. if the
        microphone amplifier is set to 40 dB gain, then provide -40 as the
        value).
    '''

    frequency = Typed(np.ndarray).tag(metadata=True)
    sensitivity = Typed(np.ndarray).tag(metadata=True)
    fixed_gain = Float(0).tag(metadata=True)
    _interp = Callable()

    def __init__(self, frequency, sensitivity, fixed_gain=0, source=None):
        self.frequency = np.asarray(frequency)
        self.sensitivity = np.asarray(sensitivity)
        self.fixed_gain = fixed_gain
        self._interp = interp1d(frequency, sensitivity, 'linear',
                                bounds_error=False)
        if source is not None:
            self.source = Path(source)

    def get_sens(self, frequency):
        # Since sensitivity is in dB(V/Pa), subtracting fixed_gain from
        # sensitivity will *increase* the sensitivity of the system.
        return self._interp(frequency)-self.fixed_gain
Beispiel #24
0
class SubWaferCoord(Atom):
    wafer_type = Enum("Full")
    diameter = Float(4).tag(unit="in", desc="wafer diameter in inches")
    chip_size = Int(5000).tag(desc="size of chip in microns", unit=" um")
    gap_size = Int(5000).tag(desc="gap from center of wafer", unit=" um")

    bad_coord_type = Enum("quarter wafer", "full wafer", "none")

    randomize = Enum(True, False)

    Px = Int(4000)
    Py = Int(40000)
    Qx = Int(40000)
    Qy = Int(4000)

    @cached_property
    def x_offset(self):
        return 0

    @cached_property
    def y_offset(self):
        return 0

    @cached_property
    def N_chips(self):
        return 1

    @cached_property
    def step_size(self):
        return 0

    @property
    def GLM(self):
        return [self.Px, self.Py, self.Qx, self.Qy]

    @cached_property
    def view_window(self):
        with imports():
            from taref.ebl.wafer_coords_e import WaferCoordsView
        view = WaferCoordsView(wc=self)
        return view
Beispiel #25
0
class ScatterFormat(LineFormat):
    clt=Typed(PathCollection)

    marker = Enum(*markers_tuple)
    marker_size = Float(1.0).tag(former="s")

    facecolor=Enum(*colors_tuple[1:]).tag(former="facecolor")
    edgecolor=Enum(*colors_tuple[1:]).tag(former="edgecolor")

    @plot_observe("facecolor", "edgecolor", update_legend=True)
    def scatter_update(self, change):
        self.plot_set(change["name"])

    @plot_observe("marker_size", update_legend=True)
    def marker_size_update(self, change):
        self.clt.set_sizes([self.marker_size])

    @plot_observe("marker", update_legend=True)
    def marker_update(self, change):
        self.scatter_plot()

    def _default_plot_type(self):
        return "scatter"

    def scatter_plot(self, *args, **kwargs):
        kwargs=process_kwargs(self, kwargs)
        self.remove_collection()
        if len(args)==1:
            self.ydata=args[0]
            self.xdata=arange(len(self.ydata))
        elif len(args)==2:
            self.xdata=args[0]
            self.ydata=args[1]
        self.clt=self.plotter.axes.scatter(self.xdata, self.ydata, **kwargs)
        self.do_autolim()

    @transformation
    def scatter2line(self):
        lf=Line2DFormat(plot_name=self.plot_name, plotter=self.plotter)
        lf.line_plot(self.xdata, self.ydata)
        return lf
Beispiel #26
0
class Offset(Operation):
    #: Reference to the implementation control
    proxy = Typed(ProxyOffset)

    #: Offset
    offset = d_(Float(1, strict=False)).tag(view=True, group='Offset')

    #: Offset mode
    offset_mode = d_(Enum('skin', 'pipe', 'recto_verso')).tag(view=True,
                                                              group='Offset')

    #: Intersection
    intersection = d_(Bool(False)).tag(view=True, group='Offset')

    #: Join type
    join_type = d_(Enum('arc', 'tangent', 'intersection')).tag(view=True,
                                                               group='Offset')

    @observe('offset', 'offset_mode', 'intersection', 'join_type')
    def _update_proxy(self, change):
        super(Offset, self)._update_proxy(change)
Beispiel #27
0
class Lyzer(Agent):
    base_name="lyzer"
    fridge_atten=Float(60)
    fridge_gain=Float(40)

    @tag_property()
    def net_loss(self):
        return self.fridge_gain-self.fridge_atten+self.rt_gain-self.rt_atten


    rd_hdf=Typed(Read_HDF5)
    save_folder=Typed(Folder)

    save_file=Typed(Save_TXT)
    save_code=Typed(Save_TXT)

    read_data=Callable().tag(sub=True)


    def _default_save_folder(self):
        return Folder(base_dir="/Users/thomasaref/Dropbox/Current stuff/test_data/tex_processed", main_dir="overall")

    def _default_save_file(self):
        return Save_TXT(folder=self.save_folder, file_name="file_names", file_suffix=".txt", fixed_mode=True, write_mode="a")

    def _default_save_code(self):
        return Save_TXT(folder=self.save_file.folder, file_name=self.save_file.file_name+"_code", file_suffix=".py", fixed_mode=True)

    def save_plots(self, pl_list):
        names="\n".join([pl.fig_name for pl in pl_list])
        #self.save_file.file_name=self.name+"_file_names"
        self.save_file.save(names, write_mode="w", flush_buffer=True)
        for pl in pl_list:
            pl.savefig(self.save_folder.dir_path_d, pl.fig_name)

    rt_atten=Float(40)
    rt_gain=Float(23*2)

    offset=Float(-0.035)
    flux_factor=Float(0.2925)

    def _default_offset(self):
        return self.qdt.offset

    def _default_flux_factor(self):
        return self.qdt.flux_factor

    comment=Unicode().tag(read_only=True, spec="multiline")
Beispiel #28
0
class ThruSections(Operation):
    #: Reference to the implementation control
    proxy = Typed(ProxyThruSections)

    #: isSolid is set to true if the construction algorithm is required
    #: to build a solid or to false if it is required to build a shell (the default value),
    solid = d_(Bool(False)).tag(view=True, group='Through Sections')

    #: ruled is set to true if the faces generated between the edges
    #: of two consecutive wires are ruled surfaces or to false (the default value)
    #: if they are smoothed out by approximation
    ruled = d_(Bool(False)).tag(view=True, group='Through Sections')

    #: pres3d defines the precision criterion used by the approximation algorithm;
    #: the default value is 1.0e-6. Use AddWire and AddVertex to define
    #: the successive sections of the shell or solid to be built.
    precision = d_(Float(1e-6)).tag(view=True, group='Through Sections')

    @observe('solid', 'ruled', 'precision')
    def _update_proxy(self, change):
        super(ThruSections, self)._update_proxy(change)
Beispiel #29
0
class Qubit(LogicalChannel):
    '''
    The main class for generating qubit pulses.  Effectively a logical "QuadratureChannel".
    '''
    pulse_params = Dict(
        default={
            'length': 20e-9,
            'piAmp': 1.0,
            'pi2Amp': 0.5,
            'shape_fun': PulseShapes.gaussian,
            'cutoff': 2,
            'drag_scaling': 0,
            'sigma': 5e-9
        })
    gate_chan = Instance((str, LogicalMarkerChannel))
    frequency = Float(0.0).tag(
        desc='modulation frequency of the channel (can be positive or negative)'
    )

    def __init__(self, **kwargs):
        super(Qubit, self).__init__(**kwargs)
Beispiel #30
0
class HttpResponse(Atom):
    """ The response object returned to an AsyncHttpClient fetch callback.
    It is based on the the tornado HttpResponse object.
    
    """

    #: Request that created this response
    request = Instance(HttpRequest)

    #: Numeric HTTP status code
    code = Int()

    #: Reason phrase for the status code
    reason = Unicode()

    #: Response headers list of strings
    headers = List()

    #: Result success
    ok = Bool()

    #: Response body
    #: Note: if a streaming_callback is given to the request
    #: then this is NOT used and will be empty
    body = Unicode()

    #: Size
    content_length = Int()

    #: Error message
    error = Instance(HttpError)

    #: Response headers
    headers = List()

    #: Progress
    progress = Int()

    #: Done time
    request_time = Float()