Пример #1
0
class BRAINSDiscreteClassInputSpec(CommandLineInputSpec):
    inputVolume = File(exists="True", argstr="--inputVolume %s")
    subcorticalMask = File(exists="True", argstr="--subcorticalMask %s")
    outputVolume = traits.Either(traits.Bool, File, argstr="--outputVolume %s")
    subcorticalThreshold = traits.Float(argstr="--subcorticalThreshold %f")
    corticalThreshold = traits.Float(argstr="--corticalThreshold %f")
    csfThreshold = traits.Float(argstr="--csfThreshold %f")
Пример #2
0
class BRAINSClassPlugsInputSpec(CommandLineInputSpec):
    t1Volume = File(exists="True", argstr="--t1Volume %s")
    t2Volume = File(exists="True", argstr="--t2Volume %s")
    pdVolume = File(exists="True", argstr="--pdVolume %s")
    searchVolume = File(exists="True", argstr="--searchVolume %s")
    gmPlugs = traits.Either(traits.Bool, File, argstr="--gmPlugs %s")
    wmPlugs = traits.Either(traits.Bool, File, argstr="--wmPlugs %s")
    csfPlugs = traits.Either(traits.Bool, File, argstr="--csfPlugs %s")
    plugClassNames = traits.List("traits.Str",
                                 sep=",",
                                 argstr="--plugClassNames %s")
    t1ClassMeans = traits.List("traits.Float",
                               sep=",",
                               argstr="--t1ClassMeans %f")
    t2ClassMeans = traits.List("traits.Float",
                               sep=",",
                               argstr="--t2ClassMeans %f")
    pdClassMeans = traits.List("traits.Float",
                               sep=",",
                               argstr="--pdClassMeans %f")
    randomSeed = traits.Int(argstr="--randomSeed %d")
    numberOfPlugs = traits.Int(argstr="--numberOfPlugs %d")
    coverage = traits.Float(argstr="--coverage %f")
    permissiveness = traits.Float(argstr="--permissiveness %f")
    meanOutlier = traits.Float(argstr="--meanOutlier %f")
    varOutlier = traits.Float(argstr="--varOutlier %f")
    plugSize = traits.Float(argstr="--plugSize %f")
    partitions = traits.List("traits.Int", sep=",", argstr="--partitions %d")
    numberOfClassPlugs = traits.List("traits.Int",
                                     sep=",",
                                     argstr="--numberOfClassPlugs %d")
    bloodMode = traits.Enum("Manual", "Top", "Bottom", argstr="--bloodMode %s")
    bloodImage = traits.Enum("T1", "T2", "PD", argstr="--bloodImage %s")
    vbPlugs = File(exists="True", argstr="--vbPlugs %s")
Пример #3
0
class StripeClass(remote_traits.MaybeRemoteHasTraits):
    gain = traits.Float(-40.0)  # in (degrees per second) / degrees
    offset = traits.Float(0.0)  # in degrees per second

    traits_view = View(
        Group((Item(name='gain', label='gain [ (deg/sec) / deg ]'),
               Item(name='offset', label='offset [ deg/sec ]'))), )
Пример #4
0
class LineRC(traits.HasTraits):
    linewidth = traits.Float(0.5)
    linestyle = traits.Trait(*linestyles)
    color = Color
    marker = traits.Trait(*linemarkers)
    markerfacecolor = Color
    markeredgecolor = Color
    markeredgewidth = traits.Float(0.5)
    markersize = traits.Float(6)
    antialiased = flexible_true_trait
    data_clipping = flexible_false_trait
class gtractFastMarchingTrackingInputSpec(CommandLineInputSpec):
	inputTensorVolume = File( exists = "True",argstr = "--inputTensorVolume %s")
	inputAnisotropyVolume = File( exists = "True",argstr = "--inputAnisotropyVolume %s")
	inputCostVolume = File( exists = "True",argstr = "--inputCostVolume %s")
	inputStartingSeedsLabelMapVolume = File( exists = "True",argstr = "--inputStartingSeedsLabelMapVolume %s")
	startingSeedsLabel = traits.Int( argstr = "--startingSeedsLabel %d")
	outputTract = traits.Str( argstr = "--outputTract %s")
	writeXMLPolyDataFile = traits.Bool( argstr = "--writeXMLPolyDataFile ")
	numberOfIterations = traits.Int( argstr = "--numberOfIterations %d")
	seedThreshold = traits.Float( argstr = "--seedThreshold %f")
	trackingThreshold = traits.Float( argstr = "--trackingThreshold %f")
	costStepSize = traits.Float( argstr = "--costStepSize %f")
	maximumStepSize = traits.Float( argstr = "--maximumStepSize %f")
	minimumStepSize = traits.Float( argstr = "--minimumStepSize %f")
Пример #6
0
 class lines(TConfig):
     linewidth = T.Float(1.0)
     linestyle = T.Trait('-', '--', '-.', ':', 'steps', '', ' ', None)
     color = T.Trait('blue', mplT.ColorHandler())
     solid_joinstyle = T.Trait('round', 'miter', 'round', 'bevel')
     solid_capstyle = T.Trait('butt', 'butt', 'round', 'projecting')
     dash_joinstyle = T.Trait('round', 'miter', 'round', 'bevel')
     dash_capstyle = T.Trait('butt', 'butt', 'round', 'projecting')
     marker = T.Trait('None', 'None', 'o', '.', ',', '^', 'v', '<', '>',
                      's', '+', 'x', 'D', 'd', '1', '2', '3', '4', 'h', 'H',
                      'p', '|', '_')
     markeredgewidth = T.Float(0.5)
     markersize = T.Float(6)
     antialiased = T.true
Пример #7
0
 class font(TConfig):
     family = T.Trait('sans-serif', 'sans-serif', 'serif', 'cursive',
                      'fantasy', 'monospace')
     style = T.Trait('normal', 'normal', 'italic', 'oblique')
     variant = T.Trait('normal', 'normal', 'small-caps')
     weight = T.Trait('normal', 'normal', 'bold', 'bolder', 'lighter', 100,
                      200, 300, 400, 500, 600, 700, 800, 900)
     stretch = T.Trait('normal', 'ultra-condensed', 'extra-condensed',
                       'condensed', 'semi-condensed', 'normal',
                       'semi-expanded', 'expanded', 'extra-expanded',
                       'ultra-expanded', 'wider', 'narrower')
     size = T.Float(12.0)
     serif = T.ListStr([
         "Bitstream Vera Serif", "New Century Schoolbook",
         "Century Schoolbook L", "Utopia", "ITC Bookman", "Bookman",
         "Nimbus Roman No9 L", "Times New Roman", "Times", "Palatino",
         "Charter", "serif"
     ])
     sans_serif = T.ListStr([
         "Bitstream Vera Sans", "Lucida Grande", "Verdana", "Geneva",
         "Lucid", "Arial", "Helvetica", "Avant Garde", "sans-serif"
     ])
     cursive = T.ListStr(
         ["Apple Chancery", "Textile", "Zapf Chancery", "Sand", "cursive"])
     fantasy = T.ListStr([
         "Comic Sans MS", "Chicago", "Charcoal", "Impact", "Western",
         "fantasy"
     ])
     monospace = T.ListStr([
         "Bitstream Vera Sans Mono", "Andale Mono", "Nimbus Mono L",
         "Courier New", "Courier", "Fixed", "Terminal", "monospace"
     ])
Пример #8
0
class Patch(Artist, traits.HasTraits):
    linewidth = traits.Float(0.5)
    facecolor = Color
    fc = facecolor
    edgecolor = Color
    fill = flexible_true_trait

    def __init__(self,
                 edgecolor=None,
                 facecolor=None,
                 linewidth=None,
                 antialiased=None,
                 fill=1,
                 **kwargs):
        Artist.__init__(self)

        if edgecolor is None: edgecolor = rc.patch.edgecolor
        if facecolor is None: facecolor = rc.patch.facecolor
        if linewidth is None: linewidth = rc.patch.linewidth
        if antialiased is None: antialiased = rc.patch.antialiased

        self.edgecolor = edgecolor
        self.facecolor = facecolor
        self.linewidth = linewidth
        self.antialiased = antialiased
        self.fill = fill
Пример #9
0
class DicomToNrrdConverterInputSpec(CommandLineInputSpec):
    inputDicomDirectory = Directory( exists = "True",argstr = "--inputDicomDirectory %s")
    outputDirectory = traits.Either(traits.Bool, Directory, argstr = "--outputDirectory %s")
    outputVolume = traits.Str( argstr = "--outputVolume %s")
    smallGradientThreshold = traits.Float( argstr = "--smallGradientThreshold %f")
    writeProtocolGradientsFile = traits.Bool( argstr = "--writeProtocolGradientsFile ")
    useIdentityMeaseurementFrame = traits.Bool( argstr = "--useIdentityMeaseurementFrame ")
    useBMatrixGradientDirections = traits.Bool( argstr = "--useBMatrixGradientDirections ")
Пример #10
0
class JFIEmulatorClass(remote_traits.MaybeRemoteHasTraits):
    """base class of worker subclass, and also runs in GUI process"""
    max_voltage = traits.Float(4.0)
    volts_to_adc_units = traits.Float(1000)  # conversion factor

    BoardNum = traits.Int(0)
    chan_left = traits.Int(0)
    chan_right = traits.Int(1)
    min_angle = traits.Float(-45)  # in same units as sent by strokelitude
    max_angle = traits.Float(90)  # in same units as sent by strokelitude
    gain = UL.UNI4VOLTS  # works on USB 1208FS

    traits_view = View(
        Group((
            ## Item(name='max_voltage'),
            ## Item(name='volts_to_adc_units'),
        )), )
Пример #11
0
class compareTractInclusionInputSpec(CommandLineInputSpec):
	testFiber = traits.Str( argstr = "--testFiber %s")
	standardFiber = traits.Str( argstr = "--standardFiber %s")
	closeness = traits.Float( argstr = "--closeness %f")
	numberOfPoints = traits.Int( argstr = "--numberOfPoints %d")
	testForBijection = traits.Bool( argstr = "--testForBijection ")
	testForFiberCardinality = traits.Bool( argstr = "--testForFiberCardinality ")
	writeXMLPolyDataFile = traits.Bool( argstr = "--writeXMLPolyDataFile ")
Пример #12
0
class PassengerTabularAdapter(TabularAdapter):
    """An adapter for table-based views of multiple passengers."""
    columns = [('ID', 'ID'), ('Origin', 'src_station'),
               ('Destination', 'dest_station'), ('Wait Time', 'wait_time'),
               ('Ride Time', 'ride_time'), ('Walk Time', 'walk_time'),
               ('Total Time', 'total_time'), ('Trip Success', 'trip_success'),
               ('Current Location', 'loc'), ('Load Delay', 'load_delay'),
               ('Unload Delay', 'unload_delay'), ('Mass', 'mass'),
               ('Will Share', 'will_share')]

    ID_width = traits.Float(40)

    wait_time_text = traits.Property
    ride_time_text = traits.Property
    walk_time_text = traits.Property
    total_time_text = traits.Property
    load_delay_text = traits.Property
    unload_delay_text = traits.Property

    ID_tooltip = traits.Constant('Unique passenger identifier')
    src_station_tooltip = traits.Constant(
        "ID or label for the passenger's origin station.")
    dest_station_tooltip = traits.Constant(
        "ID or label for the passenger's destination station.")
    wait_time_tooltip = traits.Constant('Time spent waiting at a station')
    ride_time_tooltip = traits.Constant('Time spent riding in a vehicle')
    walk_time_tooltip = traits.Constant('Time spent walking to a station')
    total_time_tooltip = traits.Constant('Sum of time spent on trip')
    loc_tooltip = traits.Constant('ID or label for a station or vehicle')
    trip_success_tooltip = traits.Constant(
        'Passenger has sucessfully reached its destination')
    load_delay_tooltip = traits.Constant(
        'Time that passenger requires to enter a vehicle')
    unload_delay_tooltip = traits.Constant(
        'Time that passenger requires to exit a vehicle')
    mass_tooltip = traits.Constant(
        'Total passenger weight, including luggage (kg)')
    will_share_tooltip = traits.Constant(
        'Whether the passenger will share a vehicle with another passenger if they have the same origin and destination stations.'
    )

    def _get_wait_time_text(self):
        return sec_to_hms(self.item.wait_time)

    def _get_ride_time_text(self):
        return sec_to_hms(self.item.ride_time)

    def _get_walk_time_text(self):
        return sec_to_hms(self.item.walk_time)

    def _get_total_time_text(self):
        return sec_to_hms(self.item.total_time)

    def _get_load_delay_text(self):
        return sec_to_hms(self.item.load_delay)

    def _get_unload_delay_text(self):
        return sec_to_hms(self.item.unload_delay)
Пример #13
0
class N4ITKInputSpec(CommandLineInputSpec):
    inputImageName = File(exists="True", argstr="--inputimage %s")
    maskImageName = File(exists="True", argstr="--maskimage %s")
    outputImageName = traits.Either(traits.Bool,
                                    File,
                                    argstr="--outputimage %s")
    outputBiasFieldName = traits.Either(traits.Bool,
                                        File,
                                        argstr="--outputbiasfield %s")
    Force2D = traits.Bool(argstr="--force2D ")
    numberOfIterations = traits.List("traits.Int",
                                     sep=",",
                                     argstr="--iterations %d")
    convergenceThreshold = traits.Float(argstr="--convergencethreshold %f")
    initialMeshResolution = traits.List("traits.Float",
                                        sep=",",
                                        argstr="--meshresolution %f")
    splineDistance = traits.Float(argstr="--splinedistance %f")
    shrinkFactor = traits.Int(argstr="--shrinkfactor %d")
    bsplineOrder = traits.Int(argstr="--bsplineorder %d")
    weightImageName = File(exists="True", argstr="--weightimage %s")
    alpha = traits.Float(argstr="--bsplinealpha %f")
    beta = traits.Float(argstr="--bsplinebeta %f")
    histogramSharpening = traits.List("traits.Float",
                                      sep=",",
                                      argstr="--histogramsharpening %f")
    biasFieldFullWidthAtHalfMaximum = traits.Float(
        argstr="--biasFieldFullWidthAtHalfMaximum %f")
    weinerFilterNoise = traits.Float(argstr="--weinerFilterNoise %f")
    numberOfHistogramBins = traits.Int(argstr="--numberOfHistogramBins %d")
Пример #14
0
 class subplot(TConfig):
     """The figure subplot parameters.  All dimensions are fraction
     of the figure width or height"""
     left = T.Float(0.125)
     right = T.Float(0.9)
     bottom = T.Float(0.1)
     top = T.Float(0.9)
     wspace = T.Float(0.2)
     hspace = T.Float(0.2)
Пример #15
0
    class figure(TConfig):
        figsize = T.List(T.Float, [8, 6], maxlen=2, minlen=2)
        dpi = T.Float(80)
        facecolor = T.Trait('0.75', mplT.ColorHandler())
        edgecolor = T.Trait('white', mplT.ColorHandler())

        class subplot(TConfig):
            """The figure subplot parameters.  All dimensions are fraction
            of the figure width or height"""
            left = T.Float(0.125)
            right = T.Float(0.9)
            bottom = T.Float(0.1)
            top = T.Float(0.9)
            wspace = T.Float(0.2)
            hspace = T.Float(0.2)
Пример #16
0
class BRAINSClassifyInputSpec(CommandLineInputSpec):
    t1Volume = File(exists="True", argstr="--t1Volume %s")
    t2Volume = File(exists="True", argstr="--t2Volume %s")
    pdVolume = File(exists="True", argstr="--pdVolume %s")
    gmPlugs = File(exists="True", argstr="--gmPlugs %s")
    wmPlugs = traits.Either(traits.Bool, File, argstr="--wmPlugs %s")
    csfPlugs = File(exists="True", argstr="--csfPlugs %s")
    bloodPlugs = File(exists="True", argstr="--bloodPlugs %s")
    BrainVolume = File(exists="True", argstr="--BrainVolume %s")
    classVolume = traits.Either(traits.Bool, File, argstr="--classVolume %s")
    grossTrim = traits.Float(argstr="--grossTrim %f")
    spatialTrim = traits.Float(argstr="--spatialTrim %f")
    x = traits.Bool(argstr="--x ")
    y = traits.Bool(argstr="--y ")
    z = traits.Bool(argstr="--z ")
    xx = traits.Bool(argstr="--xx ")
    yy = traits.Bool(argstr="--yy ")
    zz = traits.Bool(argstr="--zz ")
    xy = traits.Bool(argstr="--xy ")
    xz = traits.Bool(argstr="--xz ")
    yz = traits.Bool(argstr="--yz ")
    histogramEqualize = traits.Bool(argstr="--histogramEqualize ")
    generateSeperateImages = traits.Bool(argstr="--generateSeperateImages ")
    excludeVolume = File(exists="True", argstr="--excludeVolume %s")
Пример #17
0
    class axes(TConfig):
        hold = T.Trait(True, mplT.BoolHandler())
        facecolor = T.Trait('white', mplT.ColorHandler())
        edgecolor = T.Trait('black', mplT.ColorHandler())
        linewidth = T.Float(1.0)
        grid = T.Trait(False, mplT.BoolHandler())
        polargrid = T.Trait(True, mplT.BoolHandler())
        titlesize = T.Trait('large', 'xx-small', 'x-small', 'small', 'medium',
                            'large', 'x-large', 'xx-large', T.Float)
        labelsize = T.Trait('medium', 'xx-small', 'x-small', 'small', 'medium',
                            'large', 'x-large', 'xx-large', T.Float)
        labelcolor = T.Trait('black', mplT.ColorHandler())
        axisbelow = T.false

        class formatter(TConfig):
            limits = T.List(T.Float, [-7, 7], minlen=2, maxlen=2)
Пример #18
0
 class legend(TConfig):
     isaxes = T.true
     numpoints = T.Int(3)
     fontsize = T.Trait('medium', 'xx-small', 'x-small', 'small', 'medium',
                        'large', 'x-large', 'xx-large', T.Float)
     pad = T.Float(0.2)
     markerscale = T.Float(1.0)
     labelsep = T.Float(0.01)
     handlelen = T.Float(0.05)
     handletextsep = T.Float(0.02)
     axespad = T.Float(0.02)
     shadow = T.false
Пример #19
0
 class legend(TConfig):
     loc = T.Trait('upper right', 'best', 'upper right', 'upper left',
                   'lower left', 'lower right', 'right', 'center left',
                   'center right', 'lower center', 'upper center', 'center')
     isaxes = T.true
     numpoints = T.Int(3)
     fontsize = T.Trait('medium', 'xx-small', 'x-small', 'small', 'medium',
                        'large', 'x-large', 'xx-large', T.Float)
     pad = T.Float(0.2)
     markerscale = T.Float(1.0)
     labelsep = T.Float(0.01)
     handlelen = T.Float(0.05)
     handletextsep = T.Float(0.02)
     axespad = T.Float(0.02)
     shadow = T.false
Пример #20
0
 class distiller(TConfig):
     use = T.Trait(None, None, 'ghostscript', 'xpdf', False)
     resolution = T.Float(6000)
Пример #21
0
 class savefig(TConfig):
     dpi = T.Float(100)
     facecolor = T.Trait('white', mplT.ColorHandler())
     edgecolor = T.Trait('white', mplT.ColorHandler())
     orientation = T.Trait('portrait', 'portrait', 'landscape')
Пример #22
0
class DeviceAnalogInState(traits.HasTraits):
    """encapsulate all (relevant) analog input state on the device

    Making these variables a member of their own HasTraits class means
    that updates to the device can be treated in an atomic way.
    """
    # Analog input state
    AIN0_enabled = traits.Bool(False)
    AIN0_name = traits.String("AIN0")
    AIN1_enabled = traits.Bool(False)
    AIN1_name = traits.String("AIN1")
    AIN2_enabled = traits.Bool(True)
    AIN2_name = traits.String("AIN2")
    AIN3_enabled = traits.Bool(False)
    AIN3_name = traits.String("AIN3")
    trigger_device = traits.Instance('DeviceModel',transient=True)

    adc_prescaler = traits.Trait(128.0,{
        128.0:0x07,64.0: 0x06,
        # According to Atmel's at90usb1287 manual, faster than this is
        # too fast to get good measurements with 8MHz crystal.
        ## '32': 0x05,'16': 0x04,'8': 0x03,
        ## '4': 0x02,'2': 0x00, # also 0x01
        })
    downsample_bits = traits.Range(low=0,high=2**5-1,value=0)
    AIN_running = traits.Bool(False)
    sample_rate_total = traits.Property(label='Sample rate (Hz), all channels',
                                        depends_on=['adc_prescaler',
                                                    'trigger_device',
                                                    'downsample_bits'])
    sample_rate_chan = traits.Property(label='each channel',
                                       depends_on=['sample_rate_total',
                                                   'AIN0_enabled','AIN1_enabled',
                                                   'AIN2_enabled','AIN3_enabled',])

    # but useful when plotting/saving data
    Vcc = traits.Float(3.3)

    traits_view = View(Group(Group(Item('AIN_running'),
                                   Item(
        'Vcc',
        tooltip=('This does not set Vcc on the AT90USBKEY. Use to record the '
                 'value of Vcc. (default = 3.3V)')),
                                   orientation='horizontal'),
                                   Group(Item('AIN0_enabled',padding=0),
                                         Item('AIN0_name',padding=0),
                                         Item('AIN1_enabled',padding=0),
                                         Item('AIN1_name',padding=0),
                                         padding=0,
                                         orientation='horizontal'),
                                   Group(Item('AIN2_enabled',padding=0),
                                         Item('AIN2_name',padding=0),
                                         Item('AIN3_enabled',padding=0),
                                         Item('AIN3_name',padding=0),
                                         padding=0,
                                         orientation='horizontal'),
                             Group(Item('adc_prescaler'),
                                   Item('downsample_bits'),
                                   orientation='horizontal'),
                             Group(Item('sample_rate_total',
                                        #show_label=False,
                                        style='readonly',
                                        ),
                                   Item('sample_rate_chan',
                                        #show_label=False,
                                        style='readonly',
                                        ),
                                   orientation='horizontal'),
                             ))

    @traits.cached_property
    def _get_sample_rate_total(self):
        if self.trigger_device is not None:
            input_frequency = self.trigger_device.FOSC/self.adc_prescaler
        else:
            input_frequency = 100*1e3 # fake value
        # from USBKEY datasheet:
        if input_frequency < 50*1e3:
            warnings.warn('ADC sample frequency is too slow to get good sampling')
        if input_frequency > 200*1e3:
            warnings.warn('ADC sample frequency is too fast to get good sampling')
        #print 'input_frequency %.1f (kHz)'%(input_frequency/1000.0,)
        clock_cycles_per_sample = 13.0
        clock_adc = input_frequency/clock_cycles_per_sample
        downsample_factor = self.downsample_bits+1
        downsampled_clock_adc = clock_adc/downsample_factor
        return downsampled_clock_adc

    @traits.cached_property
    def _get_sample_rate_chan(self):
        n_chan = sum(map(int,[self.AIN0_enabled,self.AIN1_enabled,
                              self.AIN2_enabled,self.AIN3_enabled]))
        if n_chan == 0:
            return 0.0
        rate = self.sample_rate_total/float(n_chan)
        return rate
Пример #23
0
	inputTemplateModel = File( exists = "True",argstr = "--inputTemplateModel %s")
	inputLLSModel = File( exists = "True",argstr = "--inputLLSModel %s")
	inputEPCAModelMat = File( exists = "True",argstr = "--inputEPCAModelMat %s")
	inputEPCAModelTxt = File( exists = "True",argstr = "--inputEPCAModelTxt %s")
	inputVolume = File( exists = "True",argstr = "--inputVolume %s")
	outputVolume = traits.Either(traits.Bool, File, argstr = "--outputVolume %s")
	outputResampledVolume = traits.Either(traits.Bool, File, argstr = "--outputResampledVolume %s")
	outputTransform = traits.Either(traits.Bool, File, argstr = "--outputTransform %s")
	outputLandmarksInInputSpace = traits.Either(traits.Bool, File, argstr = "--outputLandmarksInInputSpace %s")
	outputLandmarksInACPCAlignedSpace = traits.Either(traits.Bool, File, argstr = "--outputLandmarksInACPCAlignedSpace %s")
	inputLandmarksPaired = File( exists = "True",argstr = "--inputLandmarksPaired %s")
	outputLandmarksPaired = traits.Either(traits.Bool, File, argstr = "--outputLandmarksPaired %s")
	outputMRML = traits.Either(traits.Bool, File, argstr = "--outputMRML %s")
	outputVerificationScript = traits.Either(traits.Bool, File, argstr = "--outputVerificationScript %s")
	mspQualityLevel = traits.Int( argstr = "--mspQualityLevel %d")
	otsuPercentileThreshold = traits.Float( argstr = "--otsuPercentileThreshold %f")
	acLowerBound = traits.Float( argstr = "--acLowerBound %f")
	cutOutHeadInOutputVolume = traits.Bool( argstr = "--cutOutHeadInOutputVolume ")
	outputUntransformedClippedVolume = traits.Either(traits.Bool, File, argstr = "--outputUntransformedClippedVolume %s")
	rescaleIntensities = traits.Bool( argstr = "--rescaleIntensities ")
	trimRescaledIntensities = traits.Float( argstr = "--trimRescaledIntensities %f")
	rescaleIntensitiesOutputRange = traits.List("traits.Int", sep = ",",argstr = "--rescaleIntensitiesOutputRange %d")
	backgroundFillValueString = traits.Str( argstr = "--BackgroundFillValue %s")
	interpolationMode = traits.Enum("NearestNeighbor","Linear","ResampleInPlace","BSpline","WindowedSinc", argstr = "--interpolationMode %s")
	forceACPoint = traits.List("traits.Float", sep = ",",argstr = "--forceACPoint %f")
	forcePCPoint = traits.List("traits.Float", sep = ",",argstr = "--forcePCPoint %f")
	forceVN4Point = traits.List("traits.Float", sep = ",",argstr = "--forceVN4Point %f")
	forceRPPoint = traits.List("traits.Float", sep = ",",argstr = "--forceRPPoint %f")
	inputLandmarksEMSP = File( exists = "True",argstr = "--inputLandmarksEMSP %s")
	forceHoughEyeDetectorReportFailure = traits.Bool( argstr = "--forceHoughEyeDetectorReportFailure ")
	radiusMPJ = traits.Float( argstr = "--rmpj %f")
Пример #24
0
 class major(TConfig):
     size = T.Float(4)
     pad = T.Float(4)
Пример #25
0
class QuadMeshSmoothingInputSpec(CommandLineInputSpec):
    inputSurface = traits.Str( argstr = "----inputSurface %s")
    numberOfIterations = traits.Int( argstr = "--numberOfIterations %d")
    relaxationFactor = traits.Float( argstr = "--relaxationFactor %f")
    delaunayConforming = traits.Bool( argstr = "----delaunayConforming ")
    outputSurface = traits.Str( argstr = "----outputSurface %s")
Пример #26
0
 class minor(TConfig):
     size = T.Float(2)
     pad = T.Float(4)
Пример #27
0
class DataAxis(t.HasTraits):
    name = t.Str()
    units = t.Str()
    scale = t.Float()
    offset = t.Float()
    size = t.Int()
    index_in_array = t.Int()
    low_value = t.Float()
    high_value = t.Float()
    value = t.Range('low_value', 'high_value')
    low_index = t.Int(0)
    high_index = t.Int()
    slice = t.Instance(slice)
    slice_bool = t.Bool(False)

    index = t.Range('low_index', 'high_index')
    axis = t.Array()

    def __init__(self,
                 size,
                 index_in_array,
                 name='',
                 scale=1.,
                 offset=0.,
                 units='undefined',
                 slice_bool=False):
        super(DataAxis, self).__init__()

        self.name = name
        self.units = units
        self.scale = scale
        self.offset = offset
        self.size = size
        self.high_index = self.size - 1
        self.low_index = 0
        self.index = 0
        self.index_in_array = index_in_array
        self.update_axis()

        self.on_trait_change(self.update_axis, ['scale', 'offset', 'size'])
        self.on_trait_change(self.update_value, 'index')
        self.on_trait_change(self.set_index_from_value, 'value')
        self.on_trait_change(self._update_slice, 'slice_bool')
        self.on_trait_change(self.update_index_bounds, 'size')
        self.slice_bool = slice_bool

    def __repr__(self):
        if self.name is not None:
            return self.name + ' index: ' + str(self.index_in_array)

    def update_index_bounds(self):
        self.high_index = self.size - 1

    def update_axis(self):
        self.axis = generate_axis(self.offset, self.scale, self.size)
        self.low_value, self.high_value = self.axis.min(), self.axis.max()


#        self.update_value()

    def _update_slice(self, value):
        if value is True:
            self.slice = slice(None)
        else:
            self.slice = None

    def get_axis_dictionary(self):
        adict = {
            'name': self.name,
            'scale': self.scale,
            'offset': self.offset,
            'size': self.size,
            'units': self.units,
            'index_in_array': self.index_in_array,
            'slice_bool': self.slice_bool
        }
        return adict

    def update_value(self):
        self.value = self.axis[self.index]

    def value2index(self, value):
        """Return the closest index to the given value if between the limits,
        otherwise it will return either the upper or lower limits

        Parameters
        ----------
        value : float

        Returns
        -------
        int
        """
        if value is None:
            return None
        else:
            index = int(round((value - self.offset) / \
            self.scale))
            if self.size > index >= 0:
                return index
            elif index < 0:
                messages.warning("The given value is below the axis limits")
                return 0
            else:
                messages.warning("The given value is above the axis limits")
                return int(self.size - 1)

    def index2value(self, index):
        return self.axis[index]

    def set_index_from_value(self, value):
        self.index = self.value2index(value)
        # If the value is above the limits we must correct the value
        self.value = self.index2value(self.index)

    def calibrate(self, value_tuple, index_tuple, modify_calibration=True):
        scale = (value_tuple[1] - value_tuple[0]) /\
        (index_tuple[1] - index_tuple[0])
        offset = value_tuple[0] - scale * index_tuple[0]
        if modify_calibration is True:
            self.offset = offset
            self.scale = scale
        else:
            return offset, scale

    traits_view = \
    tui.View(
        tui.Group(
            tui.Group(
                tui.Item(name = 'name'),
                tui.Item(name = 'size', style = 'readonly'),
                tui.Item(name = 'index_in_array', style = 'readonly'),
                tui.Item(name = 'index'),
                tui.Item(name = 'value', style = 'readonly'),
                tui.Item(name = 'units'),
                tui.Item(name = 'slice_bool', label = 'slice'),
            show_border = True,),
            tui.Group(
                tui.Item(name = 'scale'),
                tui.Item(name = 'offset'),
            label = 'Calibration',
            show_border = True,),
        label = "Data Axis properties",
        show_border = True,),
    )
Пример #28
0
 class grid(TConfig):
     color = T.Trait('black', mplT.ColorHandler())
     linestyle = T.Trait(':', '-', '--', '-.', ':', 'steps', '', ' ')
     linewidth = T.Float(0.5)
Пример #29
0
 class patch(TConfig):
     linewidth = T.Float(1.0)
     facecolor = T.Trait('blue', mplT.ColorHandler())
     edgecolor = T.Trait('black', mplT.ColorHandler())
     antialiased = T.true
Пример #30
0
class DeviceModel(traits.HasTraits):
    """Represent the trigger device in the host computer, and push any state

    We keep a local copy of the state of the device in memory on the
    host computer, and any state changes to the device to through this
    class, also allowing us to update our copy of the state.

    """
    # Private runtime details
    _libusb_handle = traits.Any(None,transient=True)
    _lock = traits.Any(None,transient=True) # lock access to the handle
    real_device = traits.Bool(False,transient=True) # real USB device present
    FOSC = traits.Float(8000000.0,transient=True)

    ignore_version_mismatch = traits.Bool(False, transient=True)

    # A couple properties
    frames_per_second = RemoteFpsFloat
    frames_per_second_actual = traits.Property(depends_on='_t3_state')
    timer3_top = traits.Property(depends_on='_t3_state')

    # Timer 3 state:
    _t3_state = traits.Instance(DeviceTimer3State) # atomic updates

    # LEDs state
    _led_state = traits.Int

    led1 = traits.Property(depends_on='_led_state')
    led2 = traits.Property(depends_on='_led_state')
    led3 = traits.Property(depends_on='_led_state')
    led4 = traits.Property(depends_on='_led_state')

    # Event would be fine for these, but use Button to get nice editor
    reset_framecount_A = traits.Button
    reset_AIN_overflow = traits.Button
    do_single_frame_pulse = traits.Button

    ext_trig1 = traits.Button
    ext_trig2 = traits.Button
    ext_trig3 = traits.Button

    # Analog input state:
    _ain_state = traits.Instance(DeviceAnalogInState) # atomic updates
    Vcc = traits.Property(depends_on='_ain_state')

    AIN_running = traits.Property(depends_on='_ain_state')
    enabled_channels = traits.Property(depends_on='_ain_state')
    enabled_channel_names = traits.Property(depends_on='_ain_state')

    # The view:
    traits_view = View(Group( Group(Item('frames_per_second',
                                         label='frame rate',
                                         ),
                                    Item('frames_per_second_actual',
                                         show_label=False,
                                         style='readonly',
                                         ),
                                    orientation='horizontal',),
                              Group(Item('ext_trig1',show_label=False),
                                    Item('ext_trig2',show_label=False),
                                    Item('ext_trig3',show_label=False),
                                    orientation='horizontal'),
                              Item('_ain_state',show_label=False,
                                   style='custom'),
                              Item('reset_AIN_overflow',show_label=False),
                              ))

    def __init__(self,*a,**k):
        super(DeviceModel,self).__init__(*a,**k)
        self._t3_state = DeviceTimer3State()
        self._ain_state = DeviceAnalogInState(trigger_device=self)

    def __new__(cls,*args,**kwargs):
        """Set the transient object state

        This must be done outside of __init__, because instances can
        get created without calling __init__. In particular, when
        being loaded from a pickle.
        """
        self = super(DeviceModel, cls).__new__(cls,*args,**kwargs)
        self._lock = threading.Lock()
        self._open_device()
        # force the USBKEY's state to our idea of its state
        self.__led_state_changed()
        self.__t3_state_changed()
        self.__ain_state_changed()
        self.reset_AIN_overflow = True # reset ain overflow

        #self.rand_pulse_enable()
        #self.rand_pulse_disable()
        #self.set_aout_values(300,250)

        return self

    def _set_led_mask(self,led_mask,value):
        if value:
            self._led_state = self._led_state | led_mask
        else:
            self._led_state = self._led_state & ~led_mask

    def __led_state_changed(self):
        buf = ctypes.create_string_buffer(2)
        buf[0] = chr(CAMTRIG_SET_LED_STATE)
        buf[1] = chr(self._led_state)
        self._send_buf(buf)

    @traits.cached_property
    def _get_led1(self):
        return bool(self._led_state & LEDS_LED1)
    def _set_led1(self,value):
        self._set_led_mask(LEDS_LED1,value)

    @traits.cached_property
    def _get_led2(self):
        return bool(self._led_state & LEDS_LED2)
    def _set_led2(self,value):
        self._set_led_mask(LEDS_LED2,value)

    @traits.cached_property
    def _get_led3(self):
        return bool(self._led_state & LEDS_LED3)
    def _set_led3(self,value):
        self._set_led_mask(LEDS_LED3,value)

    @traits.cached_property
    def _get_led4(self):
        return bool(self._led_state & LEDS_LED4)
    def _set_led4(self,value):
        self._set_led_mask(LEDS_LED4,value)

    @traits.cached_property
    def _get_Vcc(self):
        return self._ain_state.Vcc

    @traits.cached_property
    def _get_AIN_running(self):
        return self._ain_state.AIN_running

    @traits.cached_property
    def _get_enabled_channels(self):
        result = []
        if self._ain_state.AIN0_enabled:
            result.append(0)
        if self._ain_state.AIN1_enabled:
            result.append(1)
        if self._ain_state.AIN2_enabled:
            result.append(2)
        if self._ain_state.AIN3_enabled:
            result.append(3)
        return result

    @traits.cached_property
    def _get_enabled_channel_names(self):
        result = []
        if self._ain_state.AIN0_enabled:
            result.append(self._ain_state.AIN0_name)
        if self._ain_state.AIN1_enabled:
            result.append(self._ain_state.AIN1_name)
        if self._ain_state.AIN2_enabled:
            result.append(self._ain_state.AIN2_name)
        if self._ain_state.AIN3_enabled:
            result.append(self._ain_state.AIN3_name)
        return result

    @traits.cached_property
    def _get_timer3_top(self):
        return self._t3_state.timer3_top

    @traits.cached_property
    def _get_frames_per_second_actual(self):
        if self._t3_state.timer3_CS==0:
            return 0
        return self.FOSC/self._t3_state.timer3_CS/self._t3_state.timer3_top

    def set_frames_per_second_approximate(self,value):
        """Set the framerate as close as possible to the desired value"""
        new_t3_state = DeviceTimer3State()
        if value==0:
            new_t3_state.timer3_CS=0
        else:
            # For all possible clock select values
            CSs = np.array([1.0,8.0,64.0,256.0,1024.0])
            # find the value of top that to gives the desired framerate
            best_top = np.clip(np.round(self.FOSC/CSs/value),0,2**16-1).astype(np.int)
            # and find the what the framerate would be at that top value
            best_rate = self.FOSC/CSs/best_top
            # and choose the best one.
            idx = np.argmin(abs(best_rate-value))
            expected_rate = best_rate[idx]
            new_t3_state.timer3_CS = CSs[idx]
            new_t3_state.timer3_top = best_top[idx]

            ideal_ocr3a = 0.02 * new_t3_state.timer3_top # 2% duty cycle
            ocr3a = int(np.round(ideal_ocr3a))
            if ocr3a==0:
                ocr3a=1
            if ocr3a >= new_t3_state.timer3_top:
                ocr3a-=1
                if ocr3a <= 0:
                    raise ValueError('impossible combination for ocr3a')
            new_t3_state.ocr3a = ocr3a
        self._t3_state = new_t3_state # atomic update

    def get_framestamp(self,full_output=False):
        """Get the framestamp and the value of PORTC

        The framestamp includes fraction of IFI until next frame.

        The inter-frame counter counts up from 0 to self.timer3_top
        between frame ticks.
        """
        if not self.real_device:
            now = time.time()
            if full_output:
                framecount = now//1
                tcnt3 = now%1.0
                results = now, framecount, tcnt3
            else:
                results = now
            return results
        buf = ctypes.create_string_buffer(1)
        buf[0] = chr(CAMTRIG_GET_FRAMESTAMP_NOW)
        self._send_buf(buf)
        data = self._read_buf()
        if data is None:
            raise NoDataError('no data available from device')
        framecount = 0
        for i in range(8):
            framecount += ord(data[i]) << (i*8)
        tcnt3 = ord(data[8]) + (ord(data[9]) << 8)
        frac = tcnt3/float(self._t3_state.timer3_top)
        if frac>1:
            print('In ttriger.DeviceModel.get_framestamp(): '
                  'large fractional value in framestamp. resetting')
            frac=1
        framestamp = framecount+frac
        # WBD  
        #if full_output:
        #    results = framestamp, framecount, tcnt3
        #else:
        #    results = framestamp
        pulse_width = ord(data[10])
        if full_output:
            results = framestamp, pulse_width, framecount, tcnt3
        else:
            results = framestamp, pulse_width

        return results

    def get_analog_input_buffer_rawLE(self):
        if not self.real_device:
            outbuf = np.array([],dtype='<u2') # unsigned 2 byte little endian
            return outbuf
        EP_LEN = 256
        INPUT_BUFFER = ctypes.create_string_buffer(EP_LEN)

        bufs = []
        got_bytes = False
        timeout = 50 # msec

        cnt = 0 # Count number of times endpoint has been read
        min_cnt = 2 # Minimum number of times end point should be read

        while 1:
            # keep pumping until no more data
            try:
                with self._lock:
                    n_bytes = usb.bulk_read(self._libusb_handle, (ENDPOINT_DIR_IN|ANALOG_EPNUM), INPUT_BUFFER, timeout)
            except usb.USBNoDataAvailableError:
                break
            cnt += 1
            n_elements = n_bytes//2
            buf = np.fromstring(INPUT_BUFFER.raw,dtype='<u2') # unsigned 2 byte little endian
            buf = buf[:n_elements]
            bufs.append(buf)
            if (n_bytes < EP_LEN) and (cnt >= min_cnt):
                break # don't bother waiting for data to dribble in

        if len(bufs):
            outbuf = np.hstack(bufs)
        else:
            outbuf = np.array([],dtype='<u2') # unsigned 2 byte little endian
        return outbuf

    def __t3_state_changed(self):
        # A value was assigned to self._t3_state.
        # 1. Send its contents to device
        self._send_t3_state()
        # 2. Ensure updates to it also get sent to device
        if self._t3_state is None:
            return
        self._t3_state.on_trait_change(self._send_t3_state)

    def _send_t3_state(self):
        """ensure our concept of the device's state is correct by setting it"""
        t3 = self._t3_state # shorthand
        if t3 is None:
            return
        buf = ctypes.create_string_buffer(10)
        buf[0] = chr(CAMTRIG_NEW_TIMER3_DATA)

        buf[1] = chr(t3.ocr3a//0x100)
        buf[2] = chr(t3.ocr3a%0x100)
        buf[3] = chr(t3.ocr3b//0x100)
        buf[4] = chr(t3.ocr3b%0x100)

        buf[5] = chr(t3.ocr3c//0x100)
        buf[6] = chr(t3.ocr3c%0x100)
        buf[7] = chr(t3.timer3_top//0x100) # icr3a
        buf[8] = chr(t3.timer3_top%0x100)  # icr3a

        buf[9] = chr(t3.timer3_CS_)
        self._send_buf(buf)

    def __ain_state_changed(self):
        # A value was assigned to self._ain_state.
        # 1. Send its contents to device
        self._send_ain_state()
        # 2. Ensure updates to it also get sent to device
        if self._ain_state is None:
            return
        self._ain_state.on_trait_change(self._send_ain_state)

    def _send_ain_state(self):
        """ensure our concept of the device's state is correct by setting it"""
        ain_state = self._ain_state # shorthand
        if ain_state is None:
            return
        if ain_state.AIN_running:
            # analog_cmd_flags
            channel_list = 0
            if ain_state.AIN0_enabled:
                channel_list |= ENABLE_ADC_CHAN0
            if ain_state.AIN1_enabled:
                channel_list |= ENABLE_ADC_CHAN1
            if ain_state.AIN2_enabled:
                channel_list |= ENABLE_ADC_CHAN2
            if ain_state.AIN3_enabled:
                channel_list |= ENABLE_ADC_CHAN3
            analog_cmd_flags = ADC_START_STREAMING | channel_list
            analog_sample_bits = ain_state.adc_prescaler_ | (ain_state.downsample_bits<<3)
        else:
            analog_cmd_flags = ADC_STOP_STREAMING
            analog_sample_bits = 0

        buf = ctypes.create_string_buffer(3)
        buf[0] = chr(CAMTRIG_AIN_SERVICE)
        buf[1] = chr(analog_cmd_flags)
        buf[2] = chr(analog_sample_bits)
        self._send_buf(buf)

    def enter_dfu_mode(self):
        buf = ctypes.create_string_buffer(1)
        buf[0] = chr(CAMTRIG_ENTER_DFU)
        self._send_buf(buf)

    def _do_single_frame_pulse_fired(self):
        buf = ctypes.create_string_buffer(1)
        buf[0] = chr(CAMTRIG_DO_TRIG_ONCE)
        self._send_buf(buf)

    def _ext_trig1_fired(self):
        buf = ctypes.create_string_buffer(2)
        buf[0] = chr(CAMTRIG_SET_EXT_TRIG)
        buf[1] = chr(EXT_TRIG1)
        self._send_buf(buf)

    def _ext_trig2_fired(self):
        buf = ctypes.create_string_buffer(2)
        buf[0] = chr(CAMTRIG_SET_EXT_TRIG)
        buf[1] = chr(EXT_TRIG2)
        self._send_buf(buf)

    def _ext_trig3_fired(self):
        buf = ctypes.create_string_buffer(2)
        buf[0] = chr(CAMTRIG_SET_EXT_TRIG)
        buf[1] = chr(EXT_TRIG3)
        self._send_buf(buf)

    def _reset_framecount_A_fired(self):
        buf = ctypes.create_string_buffer(1)
        buf[0] = chr(CAMTRIG_RESET_FRAMECOUNT_A)
        self._send_buf(buf)

    def _reset_AIN_overflow_fired(self):
        buf = ctypes.create_string_buffer(3)
        buf[0] = chr(CAMTRIG_AIN_SERVICE)
        buf[1] = chr(ADC_RESET_AIN)
        # 3rd byte doesn't matter
        self._send_buf(buf)

    # WBD - functions for enabling and disabling random pulses
    # --------------------------------------------------------
    def rand_pulse_enable(self):
        buf = ctypes.create_string_buffer(2)
        buf[0] = chr(CAMTRIG_RAND_PULSE)
        buf[1] = chr(RAND_PULSE_ENABLE)
        self._send_buf(buf)

    def rand_pulse_disable(self):
        buf = ctypes.create_string_buffer(2)
        buf[0] = chr(CAMTRIG_RAND_PULSE)
        buf[1] = chr(RAND_PULSE_DISABLE)
        self._send_buf(buf)

    # WBD - function for setting analog output values
    # -------------------------------------------------------
    def set_aout_values(self,val0, val1):
        buf = ctypes.create_string_buffer(5)
        buf[0] = chr(CAMTRIG_SET_AOUT)
        buf[1] = chr(val0//0x100)
        buf[2] = chr(val0%0x100)
        buf[3] = chr(val1//0x100) 
        buf[4] = chr(val1%0x100) 
        self._send_buf(buf)

    # WBD - get pulse width from frame count
    # -------------------------------------------------------
    def get_width_from_framecnt(self,framecnt):
        buf = ctypes.create_string_buffer(5)
        buf[0] = chr(CAMTRIG_GET_PULSE_WIDTH)
        for i in range(1,5):
            buf[i] = chr((framecnt >> ((i-1)*8)) & 0b11111111)
        self._send_buf(buf)
        data = self._read_buf()
        val = ord(data[0])
        return val

    # WBD - modified read_buf functions for multiple epnum in buffers
    # ---------------------------------------------------------------
    def _read_buf(self):
        if not self.real_device:
            return None
        buf = ctypes.create_string_buffer(16)
        timeout = 1000
        epnum = (ENDPOINT_DIR_IN|CAMTRIG_EPNUM)
        with self._lock:
            try:
                val = usb.bulk_read(self._libusb_handle, epnum, buf, timeout)
            except usb.USBNoDataAvailableError:
                return None
        return buf
    # ---------------------------------------------------------------

    def _send_buf(self,buf):
        if not self.real_device:
            return
        with self._lock:
            val = usb.bulk_write(self._libusb_handle, 0x06, buf, 9999)

    def _open_device(self):
        require_trigger = int(os.environ.get('REQUIRE_TRIGGER','1'))
        if require_trigger:

            usb.init()
            if not usb.get_busses():
                usb.find_busses()
                usb.find_devices()

            busses = usb.get_busses()

            found = False
            for bus in busses:
                for dev in bus.devices:
                    debug('idVendor: 0x%04x idProduct: 0x%04x'%
                          (dev.descriptor.idVendor,dev.descriptor.idProduct))
                    if (dev.descriptor.idVendor == 0x1781 and
                        dev.descriptor.idProduct == 0x0BAF):
                        found = True
                        break
                if found:
                    break
            if not found:
                raise RuntimeError("Cannot find device. (Perhaps run with "
                                   "environment variable REQUIRE_TRIGGER=0.)")
        else:
            self.real_device = False
            return
        with self._lock:
            self._libusb_handle = usb.open(dev)

            manufacturer = usb.get_string_simple(self._libusb_handle,dev.descriptor.iManufacturer)
            product = usb.get_string_simple(self._libusb_handle,dev.descriptor.iProduct)
            serial = usb.get_string_simple(self._libusb_handle,dev.descriptor.iSerialNumber)

            assert manufacturer == 'Strawman', 'Wrong manufacturer: %s'%manufacturer
            valid_product = 'Camera Trigger 1.0'
            if product == valid_product:
                self.FOSC = 8000000.0
            elif product.startswith('Camera Trigger 1.01'):
                osc_re = r'Camera Trigger 1.01 \(F_CPU = (.*)\)\w*'
                match = re.search(osc_re,product)
                fosc_str = match.groups()[0]
                if fosc_str.endswith('UL'):
                    fosc_str = fosc_str[:-2]
                self.FOSC = float(fosc_str)
            else:
                errmsg = 'Expected product "%s", but you have "%s"'%(
                    valid_product,product)
                if self.ignore_version_mismatch:
                    print 'WARNING:',errmsg
                    self.FOSC = 8000000.0
                    print ' assuming FOSC=',self.FOSC
                else:
                    raise ValueError(errmsg)

            interface_nr = 0
            if hasattr(usb,'get_driver_np'):
                # non-portable libusb extension
                name = usb.get_driver_np(self._libusb_handle,interface_nr)
                if name != '':
                    usb.detach_kernel_driver_np(self._libusb_handle,interface_nr)

            if dev.descriptor.bNumConfigurations > 1:
                debug("WARNING: more than one configuration, choosing first")

            config = dev.config[0]
            usb.set_configuration(self._libusb_handle, config.bConfigurationValue)
            usb.claim_interface(self._libusb_handle, interface_nr)
        self.real_device = True