コード例 #1
0
class Subjects(DataSet):
    """ Select Experimentor and Subject """
    
    sub, exp = get_subjects()
    
    _Experimentor = ChoiceItem("Experimentors", exp)
    _Subject = ChoiceItem("Subjects",sub )
コード例 #2
0
class DefaultParameters(DataSet):
    """
    Settings
    Instructions 'comment': <br>Plain text or
    <b>rich text</b> are both supported.
    """
    
    data_dir = DirectoryItem("Directory",'D:\\Users\\thomas\\Data\\CloudStation\\Projects\\IMUs\\Jansenberger\\data')

    _bg = BeginGroup("Time View")
    acc_limit = FloatItem("Limit [Accelerometer]", default=0.5, min=0, max=3, step=0.01, slider=True)                             
    gyr_limit = FloatItem("Limit [Gyroscope]", default=300, min=100, max=1000, step=1, slider=True)                             
    init_channel = ChoiceItem("Initial Channel", [(16, "acc"), (32, "gyr")], radio=True)
    _eg = EndGroup("Time View")

    _bcolor = BeginGroup("Traffic Light")
    color_top = ColorItem("Top", default="red")
    color_middle = ColorItem("Middle", default="#ffaa00")
    color_bottom  = ColorItem("Bottom", default="#00aa00")
    upper_thresh = FloatItem("Upper Threshold", default=0.7, min=0, max=2, step=0.01, slider=True)                             
    lower_thresh = FloatItem("Lower Threshold", default=0.3, min=0.1, max=1, step=0.01, slider=True)                             
    _ecolor = EndGroup("Colors")


    opening_view = ChoiceItem("Initial View", [(16, 'Time-View'), (32, "xy-View"), (64, 'TrafficLight-View')], radio=True)
コード例 #3
0
ファイル: _gui_tmp.py プロジェクト: BD75/mpsrad
class Controlwidget(DataSet):
    Directory = DirectoryItem("Directory", default=os.path.abspath("../data/"))

    _bt = BeginGroup("Frequency and time").set_pos(col=0)
    Frequency = FloatItem("Frequency", default=142.175,
                          unit="GHz").set_prop("display", format="%3.1f")
    IntegrationTime = FloatItem("Integration time", default=5.,
                                unit="s").set_prop("display", format="%3.1f")
    BlankTime = IntItem("Blank time", default=5, unit="ms")
    _et = EndGroup("Frequency and time")

    _bs = BeginGroup("Sweep").set_pos(col=1)
    Sweep = ChoiceItem("Sweep", ["Off", "On"], default=False)
    FrequencyStep = FloatItem("Frequency step", default=.2,
                              unit="GHz").set_prop("display", format="%3.1f")
    Offset = FloatItem("Offset", default=6.,
                       unit="GHz").set_prop("display", format="%3.1f")
    SweepStep = FloatItem("Sweep step", default=10.,
                          unit="GHz").set_prop("display", format="%3.1f")
    _es = EndGroup("Sweep")

    _bo = BeginGroup("Other").set_pos(col=2)
    Chopper = ChoiceItem("Chopper", ["Cold", "Hot", "Antenna", "Reference"],
                         default=0)
    Antenna = IntItem("Antenna offset", default=1000, unit="")
    NSpec = IntItem("Spectra per file", default=7000, unit="")
    Format = ChoiceItem("File format", ["e", "a"], default=0)
    _eo = EndGroup("Other")
コード例 #4
0
class TrackingParameters(DataSet):
    # particle contrast
    particlecontrast = ChoiceItem(_("Particle Contrast"),
                                  [(0, 'Positive'),
                                   (1, 'Negative')]).set_prop("display",
                                                              callback=None)
    # whether to remove background
    bcgRemove = ChoiceItem(_("Background remove"), [(True, 'Yes'),
                                                    (False, 'No')],
                           default=True).set_prop("display", callback=None)
    # set threshold for xy detection
    #    threshold = FloatItem(("Threshold"),
    #                          default=10., slider=False, min=0.,
    #                          max=255, step=1,).set_prop("display", callback=None)
    #    # choose threshold method
    #    bool_ThresholdMethod = ChoiceItem(_("Threshold Method"), [(-2, 'No threshold/max value'),
    #                                      (-1, 'Manual'), (0, 'Huang'), (2, 'Intermodes'),
    #                                (3, 'ReniEntropy'), (4, 'Triangle'), (5, 'Otsu'), (6, 'Yen'),
    #                                (7, 'Moments'), (8, 'IsoData'), (9, 'Peak Detection')],
    #                            default=0).set_prop("display", callback=None)
    #            #Threshold method
    #            #-1=manual
    #            #0=Huang
    #            #1=Intermodes
    #            #2=MaxEntropy
    #            #3=ReniEntropy
    #            #4=Triangle
    #            #5=Otsu
    #            #6=Yen
    #            #7=Moments
    #            #8=IsoData
    #            #9=Peak Detection
    #    #erosion and dilatation iterations
    #    it_eros = IntItem(_("Iter. erosion"),
    #                          default=1, slider=False, unit='pixels',
    #                          min=0).set_prop("display", callback=None)
    #    it_dil = IntItem(_("Iter. dilatation"),
    #                          default=4, slider=False, unit='pixels',
    #                          min=0).set_prop("display", callback=None)
    central_rec_dist = FloatItem(_("Central Rec. dist."),
                                 default=-1.7,
                                 min=-100,
                                 max=100,
                                 unit='cm').set_prop("display", callback=None)
    range_rec_dist = FloatItem(_("Range Rec. dist."),
                               default=1,
                               min=-100,
                               max=100,
                               unit='cm').set_prop("display", callback=None)
    ratio_DOF = FloatItem(_("Ratio of DOF"), default=1,
                          min=0.1).set_prop("display", callback=None)
    samplePlaneStepUM = FloatItem(_("Step size along z"), default=0,
                                  unit='um').set_prop("display", active=False)
    stackHeightUM = FloatItem(_("Stack Height"), default=0,
                              unit='um').set_prop("display", active=False)
コード例 #5
0
class FitParam(DataSet):
    _prop = GetAttrProp("fittype")
    fittype = ChoiceItem("Fit type", [("chebyshev", "Chebyshev"),
                                      ("spline", "Spline")],
                         default="chebyshev").set_prop("display", store=_prop)
    k = IntItem(_("Spline degree"),
                help=_("Spline deg"),
                min=1,
                max=5,
                default=3).set_prop(
                    "display", active=FuncProp(
                        _prop, lambda x: x == 'spline')).set_pos(col=1,
                                                                 colspan=2)
    s = IntItem(_("Spline Smooth"),
                help=_("Spline smooth"),
                min=0,
                default=30000).set_prop("display",
                                        active=FuncProp(
                                            _prop,
                                            lambda x: x == 'spline')).set_pos(
                                                col=1, colspan=3)
    deg = IntItem(_("Chebyshev degree"),
                  help=_("Chebyshev deg"),
                  min=0,
                  default=90).set_prop(
                      "display",
                      active=FuncProp(_prop,
                                      lambda x: x == 'chebyshev')).set_pos(
                                          col=1, colspan=2)
コード例 #6
0
def old_params_to_guidata(oldparams):
    """
    This convert old OpenElectrophy parameters style
    to guidata.DataSet style.
    This util for neo.io wich style use this API:
    params is a tuple of all parameters with this king
    
        [
            (paramname1  ,  dictParam1  ),
            (paramname2  ,  dictParam2  ),
            (paramname3  ,  dictParam3  ),
            
        ]
        
        dictParam can contains this keys:
        
            - default : the default param
            - type : out type
            - label : name to display
            - widgettype
            - allownone : None is lineedit give a NoneType
            - possible: for a combobox choose list
    """

    if sys.version_info > (3, ):
        unicode = str
    else:
        pass

    _convert = {
        int: IntItem,
        float: FloatItem,
        str: StringItem,
        unicode: StringItem,
        bool: BoolItem,
    }

    items = {}
    for name, dictparam in oldparams:
        if 'label' in dictparam:
            label = dictparam['label']
        else:
            label = name
        if 'value' in dictparam:
            default = dictparam['value']
        else:
            default = None
        if 'type' in dictparam:
            classitem = _convert[dictparam['type']]
        else:
            classitem = _convert[type(default)]

        if 'possible' in dictparam:
            classitem = ChoiceItem
            items[name] = ChoiceItem(label, dictparam['possible'])
        else:
            items[name] = classitem(label, default=default)

    Parameters = type('Parameters', (DataSet, ), items)
    return Parameters
コード例 #7
0
class AutoFitParam(DataSet):
    xmin = FloatItem("xmin")
    xmax = FloatItem("xmax")
    method = ChoiceItem(
        _("Method"),
        [
            ("simplex", "Simplex"),
            ("powel", "Powel"),
            ("bfgs", "BFGS"),
            ("l_bfgs_b", "L-BFGS-B"),
            ("cg", _("Conjugate Gradient")),
            ("lq", _("Least squares")),
        ],
        default="lq",
    )
    err_norm = StringItem(
        "enorm",
        default=2.0,
        help=_("for simplex, powel, cg and bfgs norm used "
               "by the error function"),
    )
    xtol = FloatItem("xtol",
                     default=0.0001,
                     help=_("for simplex, powel, least squares"))
    ftol = FloatItem("ftol",
                     default=0.0001,
                     help=_("for simplex, powel, least squares"))
    gtol = FloatItem("gtol", default=0.0001, help=_("for cg, bfgs"))
    norm = StringItem("norm",
                      default="inf",
                      help=_("for cg, bfgs. inf is max, -inf is min"))
コード例 #8
0
ファイル: callbacks.py プロジェクト: 201910835/FingerBeam
class TestParameters(DataSet):
    def cb_example(self, item, value):
        print("\nitem: ", item, "\nvalue:", value)
        if self.results is None:
            self.results = ''
        self.results += str(value) + '\n'
        print("results:", self.results)

    def update_x1plusx2(self, item, value):
        print("\nitem: ", item, "\nvalue:", value)
        if self.x1 is not None and self.x2 is not None:
            self.x1plusx2 = self.x1 + self.x2
        else:
            self.x1plusx2 = None

    string = StringItem("String",
                        default="foobar").set_prop("display",
                                                   callback=cb_example)
    x1 = FloatItem("x1").set_prop("display", callback=update_x1plusx2)
    x2 = FloatItem("x2").set_prop("display", callback=update_x1plusx2)
    x1plusx2 = FloatItem("x1+x2").set_prop("display", active=False)
    color = ColorItem("Color", default="red").set_prop("display",
                                                       callback=cb_example)
    choice = ChoiceItem("Single choice", [(16, "first choice"),
                                          (32, "second choice"),
                                          (64, "third choice")],
                        default=64).set_pos(col=1, colspan=2).set_prop(
                            "display", callback=cb_example)
    results = TextItem("Results")
コード例 #9
0
ファイル: gui.py プロジェクト: thelegend831/ZephyrApp
class AppSettings( DataSet ):

    serialports = list_serial_ports()
    ports = []
    for s in serialports:
        # windows port is only a number
        if isinstance(s,int):
            port = s
            label = 'COM%d' % (port+1)
        else:
            port = label = s
        ports.append( (port, '%s' % label) )

    use_virtual_serial = BoolItem(u"Enable virtual serial",
                               help=u"If enabled, data from the testdata directory are used.",
                               default=False)
    # 'ports' must be a tuble, like (0,'COM1') for windows
    serialport = ChoiceItem("Serial Port", ports)

    bh_packets = MultipleChoiceItem("Enable BioHarness Packets",
                                  ["RR Data", "Breathing", "ECG", "Summary Packets",
                                   "Accelerometer (not implemented yet)"],
                                       [0,1]).vertical(1).set_pos(col=0)
    timedsession = ChoiceItem("Timed Session",
                              [(5, "5 minutes"), (10, "10 minutes"),
                               (15, "15 minutes"), (20, "20 minutes"),
                               (30, "30 minutes")]
                            )

    g1 = BeginGroup("Data Storage")
    # Database storage:
    enable_database = BoolItem(u"Enable InfluxDB storage",
                       help=u"If disabled, the following parameters will be ignored",
                       default=False).set_prop("display", store=DataStorage_database)
    db_url = StringItem(u"URL", notempty=True).set_prop("display", active=DataStorage_database)
    db_port = StringItem(u"Port", notempty=True).set_prop("display", active=DataStorage_database)
    db_user = StringItem(u"User", notempty=True).set_prop("display", active=DataStorage_database)
    db_pwd = StringItem(u"Password", notempty=True).set_prop("display", active=DataStorage_database)
    db_dbname = StringItem(u"Database", notempty=True).set_prop("display", active=DataStorage_database)

    # Files storage
    enable_files = BoolItem(u"Enable files storage",
                               help=u"If disabled, the following parameters will be ignored",
                               default=False).set_prop("display", store=DataStorage_files)
    directory_storage = DirectoryItem("Directory").set_prop("display", active=DataStorage_files)

    _g1 = EndGroup("Data Storage")
コード例 #10
0
class TestParameters(DataSet):
    """
    DataSet test
    The following text is the DataSet 'comment': <br>Plain text or
    <b>rich text<sup>2</sup></b> are both supported,
    as well as special characters (α, β, γ, δ, ...)
    """
    files = SubDataSetItem("files")
    string = StringItem("String")
    text = TextItem("Text")
    _bg = BeginGroup("A sub group")
    float_slider = FloatItem("Float (with slider)",
                             default=0.5,
                             min=0,
                             max=1,
                             step=0.01,
                             slider=True)
    fl1 = FloatItem("Current",
                    default=10.,
                    min=1,
                    max=30,
                    unit="mA",
                    help="Threshold current")
    fl2 = FloatItem("Float (col=1)",
                    default=1.,
                    min=1,
                    max=1,
                    help="Help on float item").set_pos(col=1)
    fl3 = FloatItem("Not checked float").set_prop('data', check_value=False)
    bool1 = BoolItem("Boolean option without label")
    bool2 = BoolItem("Boolean option with label", "Label").set_pos(col=1,
                                                                   colspan=2)
    color = ColorItem("Color", default="red")
    choice = ChoiceItem("Single choice",
                        [(16, "first choice"), (32, "second choice"),
                         (64, "third choice")]).set_pos(col=1, colspan=2)
    _eg = EndGroup("A sub group")
    floatarray = FloatArrayItem("Float array",
                                default=np.ones((50, 5), float),
                                format=" %.2e ").set_pos(col=1)
    g0 = BeginTabGroup("group")
    mchoice1 = MultipleChoiceItem(
        "MC type 1",
        ["first choice", "second choice", "third choice"]).vertical(2)
    mchoice2 = ImageChoiceItem("MC type 2",
                               [("rect", "first choice", "gif.png" ),
                                ("ell", "second choice", "txt.png" ),
                                ("qcq", "third choice", "file.png" )]
                               ).set_pos(col=1) \
                                .set_prop("display", icon="file.png")
    mchoice3 = MultipleChoiceItem("MC type 3",
                                  [str(i) for i in range(10)]).horizontal(2)
    eg0 = EndTabGroup("group")
    integer_slider = IntItem("Integer (with slider)",
                             default=5,
                             min=0,
                             max=100,
                             slider=True)
    integer = IntItem("Integer", default=5, min=3, max=6).set_pos(col=1)
コード例 #11
0
class Test(DataSet):
    _prop = GetAttrProp("choice")
    choice = ChoiceItem('Choice', choices).set_prop("display", store=_prop)
    x1 = FloatItem('x1')
    x2 = FloatItem('x2').set_prop("display",
                                  active=FuncProp(_prop, lambda x: x == 'B'))
    x3 = FloatItem('x3').set_prop("display",
                                  active=FuncProp(_prop, lambda x: x == 'C'))
コード例 #12
0
class FilterParam(DataSet):
    name = ChoiceItem(_("Filter algorithm"), (
        ("gaussian_filter", _("gaussian filter")),
        ("uniform_filter", _("uniform filter")),
        ("minimum_filter", _("minimum filter")),
        ("median_filter", _("median filter")),
        ("maximum_filter", _("maximum filter")),
    ))
    size = IntItem(_("Size or sigma"), min=1, default=5)
コード例 #13
0
class RemoteParameters(ActivableDataSet):  #Sequence parameters
    #read database to know default directory
    db = SqliteDB.DBReader()
    directoryPath = DirectoryItem("Seq. dir.", default=db.DefaultDirectory)
    first_holo_seq = IntItem(_("First hologram"), default=0, min=0)
    #last holo seq is defined with framesNumberProp that is modified when a new directory is choose
    last_holo_seq = IntItem(_("Last hologram"), default=framesNumberprop)
    saveAllStack = ChoiceItem(_("Save All stacks"), [(True, 'Yes'),
                                                     (False, 'False')],
                              default=False)
コード例 #14
0
ファイル: gui.py プロジェクト: zanppa/motor-sim
class AnotherDataSet(DataSet):
    """
    Example 2
    <b>Simple dataset example</b>
    """
    param0 = ChoiceItem("Choice", ['deazdazk', 'aeazee', '87575757'])
    param1 = FloatItem("Foobar 1", default=0, min=0)
    a_group = BeginGroup("A group")
    param2 = FloatItem("Foobar 2", default=.93)
    param3 = FloatItem("Foobar 3", default=123)
    _a_group = EndGroup("A group")
コード例 #15
0
class OtherDataSet(DataSet):
    title = StringItem("Title", default="Title")
    icon = ChoiceItem(
        "Icon",
        (
            ("python.png", "Python"),
            ("guidata.svg", "guidata"),
            ("settings.png", "Settings"),
        ),
    )
    opacity = FloatItem("Opacity", default=1.0, min=0.1, max=1)
コード例 #16
0
    class cSet(DataSet):
        _bg1 = BeginGroup("Source 1").set_pos(0)
        tab1 = ChoiceItem("Tab", ['a'])
        data1 = ChoiceItem("Data", ['a'])
        _eg1 = EndGroup("")

        _bg2 = BeginGroup("Source 2").set_pos(1)
        tab2 = ChoiceItem("Tab", ['a'])
        data2 = ChoiceItem("Data", ['a'])
        _eg2 = EndGroup("")

        _bg3 = BeginGroup("Operation").set_pos(2)
        function = ChoiceItem("Function", [('y1-y2', 'y1-y2'),
                                           ('y1+y2', 'y1+y2'),
                                           ('y1/y2', 'y1/y2'),
                                           ('custom', 'f(x,y1,y2)')])
        custom = StringItem("f(x,y1,y2):")
        _eg3 = EndGroup("")

        text = TextItem("").set_pos(3)
コード例 #17
0
    class HKset(DataSet):
        _bc = BeginGroup("Cryostat").set_pos(col=0)
        Cold_Load = FloatItem("Cold Load", default=1.,
                              unit="K").set_prop("display", format="%4.2f")
        Hot_Load = FloatItem("Hot Load", default=1.,
                             unit="K").set_prop("display", format="%4.2f")
        HEMT = FloatItem("HEMT", default=1., unit="K").set_prop("display",
                                                                format="%4.2f")
        _ec = EndGroup("Cryostat")
        _bfa = BeginGroup("CTS Filters").set_pos(col=1)
        T3_A = FloatItem("CTS1 A", default=1.,
                         unit="K").set_prop("display", format="%4.2f")
        T3_B = FloatItem("CTS1 B", default=1.,
                         unit="K").set_prop("display", format="%4.2f")
        T2_A = FloatItem("CTS2 A", default=1.,
                         unit="K").set_prop("display", format="%4.2f")
        T2_B = FloatItem("CTS2 B", default=1.,
                         unit="K").set_prop("display", format="%4.2f")
        _efa = EndGroup("CTS Filters")
        _bfb = BeginGroup("Other").set_pos(col=2)
        T6_A = FloatItem("T6 A", default=1., unit="K").set_prop("display",
                                                                format="%4.2f")
        T6_B = FloatItem("T6 B", default=1., unit="K").set_prop("display",
                                                                format="%4.2f")
        T7_A = FloatItem("T7 A", default=1., unit="K").set_prop("display",
                                                                format="%4.2f")
        T7_B = FloatItem("T7 B", default=1., unit="K").set_prop("display",
                                                                format="%4.2f")
        _efb = EndGroup("Other")

        choice = [(-2, "short circuit"), (-1, "no sensor"), (0, "Pirani"),
                  (1, "Pirani/Cathode")]

        _bp = BeginGroup("Pressure").set_pos(col=3)
        P1_Dewar = FloatItem("P1 Dewar", default=0.,
                             unit="mbar").set_prop("display", format="%4.2f")
        P1_Ident = ChoiceItem("P1 Ident.", choice, default=-1)
        P2_Pump = FloatItem("P2 Pump", default=0.,
                            unit="mbar").set_prop("display", format="%4.2f")
        P2_Ident = ChoiceItem("P2 Ident.", choice, default=-1)
        _ep = EndGroup("Pressure")
コード例 #18
0
ファイル: display_board.py プロジェクト: xeldridge18/cs3420
class ChooseMove(dt.DataSet):
    """c4o5x5
    Player N, select your move:
    """ #need to make N change with player number
    move_set = [((0, 0), 'A1'), ((0, 1), "A2"), ((0, 2), "A3"), ((0, 3), "A4"),
                ((0, 4), "A5"), ((1, 0), 'B1'), ((1, 1), "B2"), ((1, 2), "B3"),
                ((1, 3), "B4"), ((1, 4), "B5"), ((2, 0), 'C1'), ((2, 1), "C2"),
                ((2, 2), "C3"), ((2, 3), "C4"), ((2, 4), "C5"), ((3, 0), 'D1'),
                ((3, 1), "D2"), ((3, 2), "D3"), ((3, 3), "D4"), ((3, 4), "D5"),
                ((4, 0), 'E1'), ((4, 1), "E2"), ((4, 2), "E3"), ((4, 3), "E4"),
                ((4, 4), "E5")]
    Move = ChoiceItem("Single choice 1", move_set)
コード例 #19
0
ファイル: Model.py プロジェクト: MaxPPika/GUI_CSVReader
 class CsvParam(DataSet):
     _indexprop = GetAttrProp("indextype")
     indextype = ChoiceItem(
         "Index Column", (("A", "None"), ("B", "Input value below")),
         help="If None, no need to input index column").set_prop(
             "display", store=_indexprop)
     indexCol = IntItem("", default=0, min=0,
                        help="first column is 0").set_prop(
                            "display",
                            active=FuncProp(_indexprop,
                                            lambda x: x == 'B'))
     _headerprop = GetAttrProp("headertype")
     headertype = ChoiceItem(
         "Header Row", (("A", "None"), ("B", "Input value below")),
         help="If None, no need to input index column").set_prop(
             "display", store=_headerprop)
     headerRow = IntItem("", default=0, min=0,
                         help="first column is 0").set_prop(
                             "display",
                             active=FuncProp(_headerprop,
                                             lambda x: x == 'B'))
コード例 #20
0
class ExampleDataSet(ActivableDataSet):
    """
    Example
    <b>Activable dataset example</b>
    """
    enable = BoolItem(
        "Enable parameter set",
        help="If disabled, the following parameters will be ignored",
        default=False)
    param0 = ChoiceItem("Param 0", ['choice #1', 'choice #2', 'choice #3'])
    param1 = FloatItem("Param 1", default=0, min=0)
    param2 = FloatItem("Param 2", default=.93)
    color = ColorItem("Color", default="red")
コード例 #21
0
class ProcessParameters(DataSet):  #Process buttons
    #reconstruct only the stack without tracking procedure
    def _construct_stack_change(self, item, value, parent):
        if self.construct_stack_change_cb is not None:
            self.construct_stack_change_cb()

    def set_construct_stack_change_cb(self, cb):
        self.construct_stack_change_cb = cb

    construct_stack = ButtonItem("Compute only stacks",
                                 callback=_construct_stack_change)
    construct_stack_change_cb = None

    #Tracking mode choice
    def _trackingMode_change(self, item, value):
        if self.trackingMode_change_cb is not None:
            self.trackingMode_change_cb()

    def set_trackingMode_change_cb(self, cb):
        self.trackingMode_change_cb = cb

    trackingMode = ChoiceItem(_("Tracking Mode"), [(0, 'Automatic'),
                                                   (1, 'Single Particle'),
                                                   (2, 'Loop on Particles')],
                              default=1).set_prop(
                                  "display", callback=_trackingMode_change)
    trackingMode_change_cb = None

    #perform tracking according to tracking mode
    def _tracking_change(self, item, value, parent):
        if self.tracking_change_cb is not None:
            self.tracking_change_cb()

    def set_tracking_change_cb(self, cb):
        self.tracking_change_cb = cb

    tracking_perform = ButtonItem("Perform tracking",
                                  callback=_tracking_change)
    tracking_change_cb = None

    #tracking from text file (only in automatic)
    def _particle_tracking_change(self, item, value, parent):
        if self.particle_tracking_change_cb is not None:
            self.particle_tracking_change_cb()

    def set_particle_tracking_change_cb(self, cb):
        self.particle_tracking_change_cb = cb

    particle_tracking_perform = ButtonItem("Part. tracking from coord.",
                                           callback=_particle_tracking_change)
    particle_tracking_change_cb = None
コード例 #22
0
class ParticuleChoice(DataSet):  #Particule choice dataset
    #Has to be independent of any other dataset for unknown error when we want to change dynamically the choices
    choices = ChoicesVariable(
    )  #defined from Class ChoiceVariable used to modify dynamically the list

    def _particulechoice_change(self, item, value):
        if self.particulechoice_change_cb is not None:
            self.particulechoice_change_cb()

    def set_particulechoice_change_cb(self, cb):
        self.particulechoice_change_cb = cb

    particulechoice = ChoiceItem(_("Particle Choice"), choices).set_prop(
        "display", callback=_particulechoice_change)
    particulechoice_change_cb = None
コード例 #23
0
class RemoteParameters(ActivableDataSet):  #Sequence parameters
    # read database to know default directory
    db = SqliteDB.DBReader()
    directoryPath = DirectoryItem("Seq. dir.", default=db.DefaultDirectory)
    first_holo_seq = IntItem(_("First hologram"), default=0, min=0)
    # last holo seq is defined with framesNumberProp that is modified when a
    # new directory is choose
    last_holo_seq = IntItem(_("Last hologram"), default=0, min=0)
    #    saveAllStack = ChoiceItem(_("Save All stacks"), [(True, 'Yes'),
    #                              (False, 'False')], default=False)
    #create list of choice from database
    db = SqliteDB.DBReader()
    choice = db.choiceItemDB()
    MODB = ChoiceItem(_("Magnification"), choice).set_prop("display",
                                                           callback=None)
コード例 #24
0
ファイル: gui.py プロジェクト: zanppa/motor-sim
class ExampleMultiGroupDataSet(DataSet):
    param0 = ChoiceItem("Choice", ['deazdazk', 'aeazee', '87575757'])
    param1 = FloatItem("Foobar 1", default=0, min=0)
    t_group = BeginTabGroup("T group")
    a_group = BeginGroup("A group")
    param2 = FloatItem("Foobar 2", default=.93)
    dir1 = DirectoryItem("Directory 1")
    file1 = FileOpenItem("File 1")
    _a_group = EndGroup("A group")
    b_group = BeginGroup("B group")
    param3 = FloatItem("Foobar 3", default=123)
    _b_group = EndGroup("B group")
    c_group = BeginGroup("C group")
    param4 = FloatItem("Foobar 4", default=250)
    _c_group = EndGroup("C group")
    _t_group = EndTabGroup("T group")
コード例 #25
0
class TaurusTrendParam(DataSet):
    model = StringItem("Model", default="")
    maxBufferSize = IntItem("Buffer Size", default=16384)
    useArchiving = BoolItem("Use Archiving", default=False)
    stackMode = ChoiceItem("Stack Mode", [("datetime", "Absolute Time"),
                                          ("timedelta", "Relative Time"),
                                          ("event", "Event")],
                           default="datetime")

    def update_param(self, curve):
        self.model.update_param(curve.taurusparam.model)
        self.maxBufferSize.update_param(curve.taurusparam.maxBufferSize)
        self.stackMode.update_param(curve.taurusparam.stackMode)

    def update_curve(self, curve):
        curve.setModel(self.model)
        curve.setBufferSize(self.maxBufferSize)
コード例 #26
0
class TestParameters(DataSet):
    """
    DataSet test
    The following text is the DataSet 'comment': <br>Plain text or
    <b>rich text<sup>2</sup></b> are both supported,
    as well as special characters (α, β, γ, δ, ...)
    """
    dir = DirectoryItem("Directory", TEMPDIR)
    fname = FileOpenItem("Open file", ("csv", "eta"), FILE_CSV.name)
    fnames = FilesOpenItem("Open files", "csv", FILE_CSV.name)
    fname_s = FileSaveItem("Save file", "eta", FILE_ETA.name)
    string = StringItem("String")
    text = TextItem("Text")
    float_slider = FloatItem("Float (with slider)",
                             default=0.5,
                             min=0,
                             max=1,
                             step=0.01,
                             slider=True)
    integer = IntItem("Integer", default=5, min=3, max=16,
                      slider=True).set_pos(col=1)
    dtime = DateTimeItem("Date/time", default=datetime.datetime(2010, 10, 10))
    date = DateItem("Date", default=datetime.date(2010, 10, 10)).set_pos(col=1)
    bool1 = BoolItem("Boolean option without label")
    bool2 = BoolItem("Boolean option with label", "Label")
    _bg = BeginGroup("A sub group")
    color = ColorItem("Color", default="red")
    choice = ChoiceItem("Single choice 1", [('16', "first choice"),
                                            ('32', "second choice"),
                                            ('64', "third choice")])
    mchoice2 = ImageChoiceItem("Single choice 2",
                               [("rect", "first choice", "gif.png"),
                                ("ell", "second choice", "txt.png"),
                                ("qcq", "third choice", "file.png")])
    _eg = EndGroup("A sub group")
    floatarray = FloatArrayItem("Float array",
                                default=np.ones((50, 5), float),
                                format=" %.2e ").set_pos(col=1)
    mchoice3 = MultipleChoiceItem("MC type 1",
                                  [str(i) for i in range(12)]).horizontal(4)
    mchoice1 = MultipleChoiceItem(
        "MC type 2", ["first choice", "second choice", "third choice"
                      ]).vertical(1).set_pos(col=1)
コード例 #27
0
class DHMParameters(DataSet):
    #Magnification button
    def _MODB_change(self, item, value):
        if self.MODB_change_cb is not None:
            self.MODB_change_cb()

    def set_MODB_change_cb(self, cb):
        self.MODB_change_cb = cb

    #create list of choice from database
    db = SqliteDB.DBReader()
    choice = db.choiceItemDB()
    MODB = ChoiceItem(_("Magnification"),
                      choice).set_prop("display", callback=_MODB_change)
    MODB_change_cb = None

    #Save Parameters buttons definition and associated events
    def _saveParamsToFile_change(self, item, value, parent):
        if self.saveParamsToFile_change_cb is not None:
            self.saveParamsToFile_change_cb()

    def set_saveParamsToFile_change_cb(self, cb):
        self.saveParamsToFile_change_cb = cb

    saveParamsToFile = ButtonItem("Save Parameters to file",
                                  callback=_saveParamsToFile_change)
    saveParamsToFile_change_cb = None

    #Load Parameters buttons definition and associated events
    def _loadParamsFromFile_change(self, item, value, parent):
        if self.loadParamsFromFile_change_cb is not None:
            self.loadParamsFromFile_change_cb()

    def set_loadParamsFromFile_change_cb(self, cb):
        self.loadParamsFromFile_change_cb = cb

    loadParamsFromFile = ButtonItem("Load Saved Parameters",
                                    callback=_loadParamsFromFile_change)
    loadParamsFromFile_change_cb = None
コード例 #28
0
ファイル: fitJL.py プロジェクト: yangwc123/MTRSimulation
class AutoFitParam(DataSet):
    xmin = FloatItem("xmin")
    xmax = FloatItem("xmax")
    method = ChoiceItem(_("Method"), [
        ("simplex", "Simplex"),
        ("powel", "Powel"),
        ("bfgs", "BFGS"),
        ("l_bfgs_b", "L-BFGS-B"),
        ("cg", _("Conjugate Gradient")),
        ("ncg", _("Newton Conjugate Gradient")),
        ("lq", _("Least squares")),
    ],
                        default="lq")
    maxfun = IntItem(
        "maxfun",
        default=20000,
        help=
        _("Maximum of function evaluation. for simplex, powel, least squares, cg, bfgs, l_bfgs_b"
          ))
    maxiter = IntItem(
        "maxiter",
        default=20000,
        help=
        _("Maximum of iterations. for simplex, powel, least squares, cg, bfgs, l_bfgs_b"
          ))
    err_norm = StringItem("enorm",
                          default='2.0',
                          help=_("for simplex, powel, cg and bfgs norm used "
                                 "by the error function"))
    xtol = FloatItem("xtol",
                     default=0.0001,
                     help=_("for simplex, powel, least squares"))
    ftol = FloatItem("ftol",
                     default=0.0001,
                     help=_("for simplex, powel, least squares"))
    gtol = FloatItem("gtol", default=0.0001, help=_("for cg, bfgs"))
    norm = StringItem("norm",
                      default="inf",
                      help=_("for cg, bfgs. inf is max, -inf is min"))
コード例 #29
0
class ReconstructionParameters(ActivableDataSet):  #Preprocessing Parameters

    #events associated to different parameters
    def _threshold_change(self, item, value):
        if self.threshold_change_cb is not None:
            self.threshold_change_cb()

    def set_threshold_change_cb(self, cb):
        self.threshold_change_cb = cb

    def _unwrap_change(self, item, value):
        if self.unwrap_change_cb is not None:
            self.unwrap_change_cb()

    def set_unwrap_change_cb(self, cb):
        self.unwrap_change_cb = cb

    def _use_filter_size_aberration_change(self, item, value):
        if self.use_filter_size_aberration_change_cb is not None:
            self.use_filter_size_aberration_change_cb()

    def set_use_filter_size_aberration_change_cb(self, cb):
        self.use_filter_size_aberration_change_cb = cb

    def _use_filter_amplitude_change(self, item, value):
        if self.use_filter_amplitude_change_cb is not None:
            self.use_filter_amplitude_change_cb()

    def set_use_filter_amplitude_change_cb(self, cb):
        self.use_filter_amplitude_change_cb = cb

    def _filter_size_aberration_change(self, item, value):
        if self.filter_size_aberration_change_cb is not None:
            self.filter_size_aberration_change_cb()

    def set_filter_size_aberration_change_cb(self, cb):
        self.filter_size_aberration_change_cb = cb

    def _bool_deriv_change(self, item, value):
        if self.bool_deriv_change_cb is not None:
            self.bool_deriv_change_cb()

    def set_bool_deriv_change_cb(self, cb):
        self.bool_deriv_change_cb = cb

    def _XYImport_change(self, item, value):
        if self.XYImport_change_cb is not None:
            self.XYImport_change_cb()

    def set_XYImport_change_cb(self, cb):
        self.XYImport_change_cb = cb

    def _bool_ThresholdMethod_change(self, item, value):
        if self.bool_ThresholdMethod_change_cb is not None:
            self.bool_ThresholdMethod_change_cb()

    def set_bool_ThresholdMethod_change_cb(self, cb):
        self.bool_ThresholdMethod_change_cb = cb

    def _particlecontrast_change(self, item, value):
        if self.particlecontrast_change_cb is not None:
            self.particlecontrast_change_cb()

    def set_particlecontrast_change_cb(self, cb):
        self.particlecontrast_change_cb = cb

    def _it_eros_change(self, item, value):
        if self.it_eros_change_cb is not None:
            self.it_eros_change_cb()

    def set_it_eros_change_cb(self, cb):
        self.it_eros_change_cb = cb

    def _it_dil_change(self, item, value):
        if self.it_dil_change_cb is not None:
            self.it_dil_change_cb()

    def set_it_dil_change_cb(self, cb):
        self.it_dil_change_cb = cb

    def _XYImportFilePath_change(self, item, value):
        if self.XYImportFilePath_change_cb is not None:
            self.XYImportFilePath_change_cb()

    def set_XYImportFilePath_change_cb(self, cb):
        self.XYImportFilePath_change_cb = cb

    #Initialization of buttons in different groups
    unwrap = ChoiceItem(_("Unwrap"), [(True, 'Yes'), (False, 'False')],
                        default=False).set_prop("display",
                                                callback=_unwrap_change)
    unwrap_change_cb = None
    #Group Filtering
    Filtering_group = BeginGroup("Filtering")
    use_filter_size_aberration = ChoiceItem(
        _("Use uniform filter for aberration compensation"),
        [(True, 'Yes'), (False, 'False')],
        default=False).set_prop("display",
                                callback=_use_filter_size_aberration_change)
    use_filter_size_aberration_change_cb = None
    filter_size_aberration = IntItem(
        _("Filter size (aberr. compens.)"),
        default=100,
        slider=False,
        unit='pixels',
        min=1,
        max=300).set_prop("display", callback=_filter_size_aberration_change)
    filter_size_aberration_change_cb = None

    use_filter_amplitude = ChoiceItem(
        _("Use amplitude Filter"), [(False, 'No'), (True, 'Yes')],
        default=False).set_prop("display",
                                callback=_use_filter_amplitude_change)
    use_filter_amplitude_change_cb = None

    def _adjust_aberration_change(self, item, value, parent):
        if self.adjust_aberration_change_cb is not None:
            self.adjust_aberration_change_cb()

    def set_adjust_aberration_change_cb(self, cb):
        self.adjust_aberration_change_cb = cb

    aberration_perform = ButtonItem("Adjust Filtering",
                                    callback=_adjust_aberration_change)
    adjust_aberration_change_cb = None

    def _bcgRemove_change(self, item, value):
        if self.bcgRemove_change_cb is not None:
            self.bcgRemove_change_cb()

    def set_bcgRemove_change_cb(self, cb):
        self.bcgRemove_change_cb = cb

    def _bcgCompute_change(self, item, value, parent):
        if self.bcgCompute_change_cb is not None:
            self.bcgCompute_change_cb()

    def set_bcgCompute_change_cb(self, cb):
        self.bcgCompute_change_cb = cb

    _Filtering_group = EndGroup("Filtering")

    Filtering_group = BeginGroup("Background")
    bcgRemove = ChoiceItem(_("Background remove"), [(True, 'Yes'),
                                                    (False, 'False')],
                           default=False).set_prop("display",
                                                   callback=_bcgRemove_change)
    bcgRemove_change_cb = None

    bcgCompute = ButtonItem("Compute Background", callback=_bcgCompute_change)
    bcgCompute_change_cb = None

    _Filtering_group = EndGroup("Background")

    #Import xy (enable/disable importation of file or detection parameters)
    propImport = GetAttrProp(
        "XYImport")  # to enable/disable Import XY File path if True or False

    XYImport = ChoiceItem(_("Import XY Position"), [(False, 'No'),
                                                    (True, 'Yes')],
                          default=False).set_prop("display",
                                                  callback=_XYImport_change,
                                                  store=propImport)
    XYImport_change_cb = None

    XYImportFilePath = FileOpenItem(
        "File Path",
        formats='txt',
        default=r'D:\Mesures\3DTracking_Donner\15.05.03_46.68\Sequence_import_xy'
    ).set_prop("display",
               active=FuncProp(propImport, lambda x: x == True),
               callback=_XYImportFilePath_change)
    XYImportFilePath_change_cb = None

    #Group Detection parameters
    Detection_group = BeginGroup("Detection XY").set_prop(
        "display", active=FuncProp(propImport, lambda x: x == False))
    bool_deriv = ChoiceItem(_("Derive"), [(True, 'Yes'), (False, 'No')],
                            default=False).set_prop(
                                "display", callback=_bool_deriv_change)
    bool_deriv_change_cb = None
    particlecontrast = ChoiceItem(_("Particle Contrast"),
                                  [(0, 'Positive'), (1, 'Negative')]).set_prop(
                                      "display",
                                      callback=_particlecontrast_change)
    particlecontrast_change_cb = None
    threshold = FloatItem(
        ("Threshold"),
        default=10.,
        slider=False,
        min=0.,
        max=255,
        step=1,
    ).set_prop("display", callback=_threshold_change)
    threshold_change_cb = None
    bool_ThresholdMethod = ChoiceItem(
        _("Threshold Method"), [(-2, 'No threshold/max value'), (-1, 'Manual'),
                                (0, 'Huang'), (2, 'Intermodes'),
                                (3, 'ReniEntropy'), (4, 'Triangle'),
                                (5, 'Otsu'), (6, 'Yen'), (7, 'Moments'),
                                (8, 'IsoData'), (9, 'Peak Detection')],
        default=0).set_prop("display", callback=_bool_ThresholdMethod_change)
    bool_ThresholdMethod_change_cb = None
    #Threshold method
    #-1=manual
    #0=Huang
    #1=Intermodes
    #2=MaxEntropy
    #3=ReniEntropy
    #4=Triangle
    #5=Otsu
    #6=Yen
    #7=Moments
    #8=IsoData
    #9=Peak Detection

    #erosion and dilatation iterations
    it_eros = IntItem(_("Iter. erosion"),
                      default=1,
                      slider=False,
                      unit='pixels',
                      min=0).set_prop("display", callback=_it_eros_change)
    it_eros_change_cb = None
    it_dil = IntItem(_("Iter. dilatation"),
                     default=4,
                     slider=False,
                     unit='pixels',
                     min=0).set_prop("display", callback=_it_dil_change)
    it_dil_change_cb = None

    def _adjust_detection_change(self, item, value, parent):
        if self.adjust_detection_change_cb is not None:
            self.adjust_detection_change_cb()

    def set_adjust_detection_change_cb(self, cb):
        self.adjust_detection_change_cb = cb

    detection_perform = ButtonItem("Adjust Detection",
                                   callback=_adjust_detection_change)
    adjust_detection_change_cb = None
    _Detection_group = EndGroup("Detection XY")
コード例 #30
0
class HolderParameters(DataSet):  #Focus parameters
    #Define central rec dis button and associated event when changed
    def _central_rec_dist_change(self, item, value):
        if self.central_rec_dist_change_cb is not None:
            self.central_rec_dist_change_cb()

    def set_central_rec_dist_change_cb(self, cb):
        self.central_rec_dist_change_cb = cb

    central_rec_dist = FloatItem(_("Central Rec. dist."),
                                 default=-1.3,
                                 min=-100.,
                                 max=100,
                                 unit='cm').set_prop(
                                     "display",
                                     callback=_central_rec_dist_change)
    central_rec_dist_change_cb = None

    def _range_rec_dist_change(self, item, value):
        if self.range_rec_dist_change_cb is not None:
            self.range_rec_dist_change_cb()

    def set_range_rec_dist_change_cb(self, cb):
        self.range_rec_dist_change_cb = cb

    range_rec_dist = FloatItem(_("Range Rec. dist."),
                               default=1,
                               min=-100.,
                               max=100,
                               unit='cm').set_prop(
                                   "display", callback=_range_rec_dist_change)
    range_rec_dist_change_cb = None

    def _ratio_DOF_change(self, item, value):
        if self.ratio_DOF_change_cb is not None:
            self.ratio_DOF_change_cb()

    def set_ratio_DOF_change_cb(self, cb):
        self.ratio_DOF_change_cb = cb

    ratio_DOF = FloatItem(_("Ratio of DOF"), default=1,
                          min=0.1).set_prop("display",
                                            callback=_ratio_DOF_change)
    ratio_DOF_change_cb = None

    samplePlaneStepUM = FloatItem(_("Step size in sample plane"),
                                  default=0,
                                  unit='um').set_prop("display", active=False)
    stackHeightUM = FloatItem(_("Stack Height"), default=0,
                              unit='um').set_prop("display", active=False)

    #Define roi sample button and associated event
    def _roi_sample_change(self, item, value):
        if self.roi_sample_change_cb is not None:
            self.roi_sample_change_cb()

    def set_roi_sample_change_cb(self, cb):
        self.roi_sample_change_cb = cb

    roi_sample = IntItem(_("ROI size (to find focus)"),
                         default=30,
                         min=1,
                         unit='pixels').set_prop("display",
                                                 callback=_roi_sample_change)
    roi_sample_change_cb = None

    #Define default focus method and associated event when changed
    def _focusMethod_change(self, item, value):
        if self.focusMethod_change_cb is not None:
            self.focusMethod_change_cb()

    def set_focusMethod_change_cb(self, cb):
        self.focusMethod_change_cb = cb

    focusMethod = ChoiceItem(_("Focus Method"), [
        (0, 'Min amp std'), (1, 'Absolute Min Amp'), (2, 'Absolute Max Phase'),
        (3, 'Integral Density'), (4, 'Max phase(valuePos-mean)'),
        (5, 'Max std dev'), (6, 'Skewness'), (7, 'Max std from Sobel'),
        (8, 'Max std from Sobel on phase image')
    ]).set_prop("display", callback=_focusMethod_change)
    focusMethod_change_cb = None

    #Event to adjust the focus detection an init of button
    def _adjust_focus_change(self, item, value, parent):
        if self.adjust_focus_change_cb is not None:
            self.adjust_focus_change_cb()

    def set_adjust_focus_change_cb(self, cb):
        self.adjust_focus_change_cb = cb

    focus_perform = ButtonItem("Adjust Focus Detection",
                               callback=_adjust_focus_change)
    adjust_focus_change_cb = None