コード例 #1
0
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=0.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")
コード例 #2
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)
コード例 #3
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)
コード例 #4
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
コード例 #5
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"))
コード例 #6
0
ファイル: all_features.py プロジェクト: 201910835/FingerBeam
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")
    choice1 = ChoiceItem("Single choice (radio)", [(16, "first choice"),
                                                   (32, "second choice"),
                                                   (64, "third choice")],
                         radio=True).set_pos(col=1, colspan=2)
    choice2 = ChoiceItem("Single choice (combo)",
                         [(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=-50,
                             max=100,
                             slider=True)
    integer = IntItem("Integer", default=5, min=3, max=6).set_pos(col=1)
コード例 #7
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")
コード例 #8
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
コード例 #9
0
class ImageParamNew(ImageParam):
    _hide_data = True
    _hide_size = False
    type = ChoiceItem(_("Type"),
                      (("rand", _("random")), ("zeros", _("zeros"))))
コード例 #10
0
class ImageParam(DataSet):
    #_hide_data = False
    #_hide_size = True
    #title = StringItem(_("Title"), default=_("Untitled")).set_prop("display", hide=True)
    #data = FloatArrayItem(_("Settings")).set_prop("display",
    #                                          hide=GetAttrProp("_hide_data"))
    _prop = GetAttrProp("otype")
    otype = StringItem("Type of data",
                       default="Unknown").set_prop("display",
                                                   store=_prop)  #, hide=True)
    title = StringItem(_("Title"), default=_("Untitled")).set_prop("display",
                                                                   hide=True)
    _bg = BeginGroup("Range setting")
    #feed = ChoiceItem("Feed", [(1, "1"), (2, "2"), (3, "3")]).set_prop("display", active=False)
    #section = ChoiceItem("Section", [("Ch0", "0"), ("Ch1", "1"), ("Ch2", "2"),
    #                                 ("Ch3", "3")]).set_pos(col=1, colspan=2)
    #polar = ChoiceItem("Polar", [(16, "first choice"), (32, "second choice"),
    #                     (64, "third choice")]).set_pos(col=2, colspan=2)
    #_prop = GetAttrProp("otype")
    #otype = ChoiceItem("Type of data", [("On/Off: off source", "On/Off: off source"), ("OTF", "OTF"), ("Unknown", "Unknown")], default="Unknown").set_prop("display", store=_prop, hide=True)
    #otype = StringItem("Type of data", default="Unknown").set_prop("display", store=_prop)#, hide=True)
    rangei = IntItem(
        _("num. samples begin"),
        help=
        _("Select a number of samples at the begin of the data to use for the computation"
          ),
        min=0,
        default=0).set_prop("display",
                            active=FuncProp(
                                _prop, lambda x: x == 'OTF' or x == 'Unknown'))
    ranges = IntItem(
        _("num. samples end"),
        help=
        _("Select a number of sameples at the end of the data to use for the computation"
          ),
        min=0,
        default=0).set_prop(
            "display",
            active=FuncProp(_prop,
                            lambda x: x == 'OTF' or x == 'Unknown')).set_pos(
                                col=1, colspan=2)
    rall = BoolItem(_("All"), default=True).set_pos(col=2, colspan=2).set_prop(
        "display",
        active=FuncProp(_prop, lambda x: x == 'OTF' or x == 'Unknown'),
        hide=True)
    excluded = IntItem(
        _("Excluded samples"),
        help=
        _("Select a number of samples to exclude from the computation at the begining and end of the data symmetrically"
          ),
        min=0,
        default=0).set_prop("display",
                            active=FuncProp(
                                _prop, lambda x: x == 'OTF' or x == 'Unknown'))
    eall = BoolItem(_("All"),
                    default=True).set_pos(col=1, colspan=2).set_prop("display",
                                                                     hide=True)
    _eg = EndGroup("Range setting")

    _bg2 = BeginGroup("Fit Range")
    frangei = IntItem(
        _("intitial freq sample"),
        help=_("Select the first freq sample to use for the fit computation"),
        min=0,
        default=0)
    franges = IntItem(
        _("last freq sample"),
        help=
        _("Select the last freq sample to use for the fit computation (if 0 take max)"
          ),
        min=0,
        default=0).set_pos(col=1, colspan=1)
    _eg2 = EndGroup("Fit Range")
    #selected = BoolItem(_("Selected"), default=True)
    selected = ChoiceItem("Selected", [(True, "Yes"), (False, "No")],
                          default=True).set_prop("display", hide=True)
コード例 #11
0
class DSParam(DataSet):
    feed = ChoiceItem("Feed", cfeeds, default=cfeeds.default)
    section = ChoiceItem("Section", csections,
                         default=csections.default).set_pos(col=1, colspan=1)
    polar = ChoiceItem("Polarization", cpolars,
                       default=cpolars.default).set_pos(col=2, colspan=1)
コード例 #12
0
ファイル: gui.py プロジェクト: zanppa/motor-sim
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., min=.1, max=1)
コード例 #13
0
class ScanningParam(DataSet):
    """Store the parameters describing a scanning probe measurement."""

    filename = FileOpenItem(_('File name'), ('*'),
                            default='',
                            help=_('Raw file name'))

    type = ChoiceItem(
        _('Type of data'), [('topo', _('Topography')),
                            ('ivcurve', _('IV curve')), ('ivmap', _('IV map')),
                            ('didvcurve', _('dIdV curve')),
                            ('didvmap', _('dIdV map')),
                            ('topofft', _('FFT of topography')),
                            ('ivmapfft', _('FFT of IV map')),
                            ('didvmapfft', _('FFT of dIdV map')),
                            ('unknowncurve', _('Curve unknown')),
                            ('unknownimage', _('Image unknown')),
                            ('unknownmap', _('Map unknown')),
                            ('unknown', _('Unknown'))],
        default='topo',
        help=
        'Type of data, determine default color of plots and possible calculation of the data type.'
    )

    direction = StringItem(
        'Direction of mesurement',
        # Possible value, 'up-fwd', 'up-bwd', 'down-fwd', 'down-bwd',
        #                 'fwd', 'bwd', 'up-fwd mirrored', …
        default='',
        help='Direction of measurement for mirrored axis data.')

    current = FloatItem(
        'Tunnel current',
        unit='A',
        default=0,
        help='Tunnel current for the measured data, or start condition\
            for spectra.')
    vgap = FloatItem(
        'Gap voltage',
        unit='V',
        default=0,
        help='Gap voltage for the measured data, or start condition for\
            spectra.')

    unit = StringItem("Data physical unit", default='')

    creation_date = StringItem("Measurement data", default='')

    comment = TextItem('Comment', default='')

    processing = TextItem(
        'Processing',
        default='',
        help='List all processing steps that occured on this data.')

    t = BeginTabGroup("Axis")
    axis1 = AxisParamItem('First Axis')  # for all type of measurement
    axis2 = AxisParamItem('Second Axis')  # for topography and 3D map
    axis3 = AxisParamItem('Third Axis')  # for 3D map only
    _t = EndTabGroup("Axis")

    metadata = DictItem("Metadata", default={})

    def copy(self):
        """Return a copy of the object"""
        return deepcopy(self)

    def __getitem__(self, key):
        try:
            return getattr(self, key)
        except AttributeError:
            raise KeyError, _("They are no such attributes %s.") % key

    def __setitem__(self, key, value):
        setattr(self, key, value)
コード例 #14
0
class Processing(DataSet):
    def __init__(self, *args, **kwargs):
        super(Processing, self).__init__(*args, **kwargs)
        self.loadSettings()

    def __del__(self, *args, **kwargs):
        #super(Processing, self).__del__(*args, **kwargs)
        self.saveSettings()

    def hi(self, calling_obj, c, d):
        #We can access the classes variables when we want ...
        if self.choice == '1':
            self.saveSettings()
            cmd = str.format('\"Offset {} BW {}\"', self.offset,
                             self.bandwidth)
            os.system("echo " + cmd)
            sn007 = k3_p3(serial_port=self.device)
            sn007.p3_span(self.bandwidth, self.offset)
        elif self.choice == '0':
            os.system("echo RESET")
            sn007 = k3_p3(serial_port=self.device)
            sn007.p3_reset()
        elif self.choice == '-1':
            os.system("echo QUIT")

    def guessOS(self):
        if platform.startswith('win'):
            self.device = 'Windows Device Needed'
        else:
            self.device = '/dev/ttyUSB0'

    def saveSettings(self):
        try:
            data = {
                "device": self.device,
                "bandwidth": self.bandwidth,
                "offset": self.offset
            }
            pickle.dump(data, open("p3lte.p", "wb"))
        except:
            pass

    def loadSettings(self):
        try:
            data = pickle.load(open("p3lte.p", "rb"))
            self.device = data['device']
            self.bandwidth = data['bandwidth']
            self.offset = data['offset']
        except:
            pass

    device = StringItem("Control Device ", "Device")
    offset = FloatItem("Offset",
                       default=200,
                       min=0,
                       max=5000,
                       unit=u'Hz',
                       slider=True)
    bandwidth = FloatItem("Bandwidth",
                          default=1500,
                          min=0,
                          max=10000,
                          unit=u'Hz',
                          slider=True)
    choice = ChoiceItem("Action", [('1', "Set P3"), ('0', "RESET"),
                                   ('-1', "QUIT")])
    processButton = ButtonItem("DO IT", hi).set_pos(col=0, colspan=2)
コード例 #15
0
ファイル: io_settings.py プロジェクト: stjordanis/spykeviewer
    def neo_to_guidata(self, paramlist, param_dict):
        """ Take a list of parameter description in Neo format and return
        a respective guidata DataSet.

        :param list paramlist: List of (name, parameters) tuples that describe
            load or save parameters Neo style.
        :param dict param_dict: Dictionary with default values. Is modified to
            include new default values when the respective parameter is not
            present.
        """
        # Normal widgets
        guidata_types = {
            bool: BoolItem,
            float: FloatItem,
            int: IntItem,
            str: StringItem,
            unicode: StringItem
        }
        # Widgets where parameter can be None
        guidata_types_with_none = {
            bool: BoolItem,
            float: FloatOrNoneItem,
            int: IntOrNoneItem,
            str: StringItem,
            unicode: StringItem
        }

        # Build up parameter items dictionary
        items = {}
        for name, params in paramlist:
            if 'label' in params:
                label = params['label']
            else:
                label = name

            if name in param_dict:
                default = param_dict[name]
            else:
                if 'value' in params:
                    default = params['value']
                else:
                    default = None

            if 'type' in params:
                if default is None:
                    classitem = guidata_types_with_none[params['type']]
                else:
                    classitem = guidata_types[params['type']]
            else:
                if default is None:
                    classitem = guidata_types_with_none[type(default)]
                else:
                    classitem = guidata_types[type(default)]

            if 'possible' in params:
                possible = params['possible'][:]
                for i, p in enumerate(possible):
                    if possible[i] == ' ':
                        possible[i] = 'Space'
                    elif possible[i] == '\t':
                        possible[i] = 'Tab'

                def_choice = 0
                if name in param_dict and name in params['possible']:
                    def_choice = params['possible'].index(param_dict[name])
                elif default in params['possible']:
                    def_choice = params['possible'].index(default)
                items[name] = ChoiceItem(label, possible, default=def_choice)
            else:
                items[name] = classitem(label, default=default)
            if name not in param_dict:
                param_dict[name] = default

        guidata_class = type('Parameters', (DataSet, ), items)
        return guidata_class