Beispiel #1
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"))
Beispiel #2
0
class FitParamDataSet(DataSet):
    name = StringItem(_("Name"))
    value = FloatItem(_("Value"), default=0.0)
    min = FloatItem(_("Min"), default=-1.0)
    max = FloatItem(_("Max"), default=1.0).set_pos(col=1)
    steps = IntItem(_("Steps"), default=5000)
    format = StringItem(_("Format"), default="%.3f").set_pos(col=1)
    logscale = BoolItem(_("Logarithmic"), _("Scale"))
    unit = StringItem(_("Unit"), default="").set_pos(col=1)
Beispiel #3
0
class TaurusCurveParam(DataSet):
    xModel = StringItem("Model for X", default="")
    yModel = StringItem("Model for Y", default="")

    def update_param(self, curve):
        self.xModel.update_param(curve.taurusparam.xModel)
        self.yModel.update_param(curve.taurusparam.yModel)
#        DataSet.update_param(self, curve)

    def update_curve(self, curve):
        curve.setModels(self.xModel or None, self.yModel)
Beispiel #4
0
class InfoData(DataSet):
    feed = IntItem("Feed:", default=cfeeds.default)
    section = IntItem("Section:", default=csections.default).set_pos(col=1,
                                                                     colspan=1)
    polar = StringItem("Polarization:",
                       default=cpolars.default).set_pos(col=2, colspan=1)
    freq = FloatItem("Frequency (MHz):", default="0.0").set_pos(col=3,
                                                                colspan=1)
    band = FloatItem("Band (MHz):", default="0.0").set_pos(col=4, colspan=1)
    otype = StringItem("Type:", default="")
    flagname = StringItem("Flag file:", default="").set_pos(col=1, colspan=1)
Beispiel #5
0
class AxisParam(DataSet):
    """Store the parameters to caracterise a measurement axis"""

    unit = StringItem("Physical unit", default='')
    length = IntItem("Number of point",
                     default=0,
                     help="Number of measured point along the axis")
    start = FloatItem("Physical start value", default=0)
    increment = FloatItem("Physical increment",
                          default=1,
                          help="Physical size of a pixel")

    scale = None  # lazy object, created on demand

    def get_length(self):
        """Return the length of the scale"""
        return int(self.length)

    def get_physical_length(self):
        """Return the physical length of the scale
           see self.unit for the unit
        """
        return self.length * self.increment

    def get_scale(self):
        """Return a vector with all the physical axis values based on start,
        length and increment parameters."""
        if self.scale is None:  # create lazy object
            self.update_scale()
        return self.scale

    def update_scale(self):
        """Update/create a vector with all the physical axis values based on start, resolution and increment parameters."""

        self.scale = self.start + arange(self.length) * self.increment

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

    def __len__(self):
        return self.get_length()

    def __getitem__(self, key):
        if 'physical length' == key:
            return self.get_physical_length()
        elif 'length' == key:
            return self.get_length()
        elif 'scale' == key:
            return self.get_scale()
        else:
            try:
                return getattr(self, key)
            except AttributeError:
                raise KeyError, _("They are no such attributes %s.") % key

    def __setitem__(self, key, value):
        if key in ('scale', 'physical length'):
            raise TypeError, _("Not mutable item.")
        setattr(self, key, value)
Beispiel #6
0
class TestParameters(DataSet):
    _bg = BeginGroup("R/W Commands")
    readcmd = FileOpenItem("Read command", "exe", "")
    writecmd = FileOpenItem("Write command", "exe", "")
    _eg = EndGroup("R/W Commands")

    _bg = BeginGroup("Channels")
    ch1n = IntItem("Channel #1", default=3, min=1, max=4)
    ach1n = EvalStringItem("K1", default="1").set_pos(col=1)
    ch2n = IntItem("Channel #2", default=4, min=1, max=4)
    ach2n = EvalStringItem("K2", default="1").set_pos(col=1)
    _eg = EndGroup("Channels")

    _bg = BeginGroup("Pulse")
    period = FloatItem("Period",
                       min=0.5,
                       default=1.0,
                       help="Time between two sequential clock pulse")
    duration = FloatItem("Duration",
                         min=0.5,
                         max=period,
                         default=0.7,
                         help="Duaration of the clock pulse")
    syncch = IntItem("#Sync channel",
                     default=1,
                     min=1,
                     max=2,
                     help="The sync DAC channel")
    _eg = EndGroup("Pulse")

    _bg = BeginGroup("Save raw channels data")
    raw_savedir = DirectoryItem("Directory", os.getcwd() + "\\tmp")
    raw_fileprefix = StringItem("File Name", default="raw_")
    _eg = EndGroup("Save raw channels data")
Beispiel #7
0
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")
Beispiel #8
0
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")
Beispiel #9
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)
Beispiel #10
0
class Info(DataSet):
    """Input Info About Data
    Please input infomation about the given data:
    Data File: Data File to be Converted
    SkipRows: Skip how many rows before reading data
    Fs: Fs of the data
    Lens: Length of the data
    Unit: Unit of the data
    ExpName: Experiment Name
    ExpCount: The counter of the experiment
    ChanelNum: The Start of Chanel Number
    """
    Fname = FileOpenItem("Data File: ")
    SkipRows = IntItem('SkipRows:', min=0, default=0)
    Fs = FloatItem('Fs: ', min=0, default=250)
    Lens = IntItem('Lens:', min=0, default=0)
    Unit = StringItem('Unit:', default='m/ss')
    ExpName = StringItem('ExpName', default='Test')
    ExpCount = IntItem('ExpCount:', min=1, default=1)
    ChanelNum = IntItem('ChanelNum:', min=1, default=1)
Beispiel #11
0
class ImageParam(DataSet):
    _hide_data = False
    _hide_size = True
    title = StringItem(_("Title"), default=_("Untitled"))
    data = FloatArrayItem(_("Data")).set_prop("display", hide=GetAttrProp("_hide_data"))
    width = IntItem(
        _("Width"), help=_("Image width (pixels)"), min=1, default=100
    ).set_prop("display", hide=GetAttrProp("_hide_size"))
    height = IntItem(
        _("Height"), help=_("Image height (pixels)"), min=1, default=100
    ).set_prop("display", hide=GetAttrProp("_hide_size"))
Beispiel #12
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)
Beispiel #13
0
        class Parameters(DataSet):
            ex_mw = StringItem("Excitting Microwave",
                               default="TCPIP::10.122.7.103::INSTR")
            lo_mw = StringItem("LO Microwave",
                               default="TCPIP::10.122.7.102::INSTR")
            me_mw = StringItem("Measurement Microwave",
                               default="TCPIP::10.122.7.101::INSTR")
            awg = StringItem("AWG", default="TCPIP::10.122.7.100::INSTR")
            #me_power = FloatItem("Measuerment Power (dBm)",
            #                 default=10, min=-135, max=25, step=0.01, slider=True)

            f_range_s = FloatItem("Frequency start (GHz)",
                                  default=9.0,
                                  min=1,
                                  max=20,
                                  step=0.01)
            f_range_e = FloatItem("Frequency stop (GHz)",
                                  default=9.04,
                                  min=1,
                                  max=20,
                                  step=0.01).set_pos(col=1)
            f_range_n = IntItem("Frequency Num", default=41, min=1,
                                max=100000).set_pos(col=2)

            p_range_s = FloatItem("Power start (dBm)",
                                  default=-30,
                                  min=-130,
                                  max=25,
                                  step=0.01)
            p_range_e = FloatItem("Power stop (dBm)",
                                  default=10.0,
                                  min=-130,
                                  max=25,
                                  step=0.01).set_pos(col=1)
            p_range_n = IntItem("Power Num", default=41, min=1,
                                max=100000).set_pos(col=2)

            npoints = IntItem("Number of points",
                              default=1000,
                              min=100,
                              max=100000)
Beispiel #14
0
class ArrayParam(DataSet):
    _hide_data = False
    _hide_size = True
    title = StringItem(_("Name"), default=_(" array name "))
    data = FloatArrayItem(_("Data")).set_prop("display",
                                              hide=GetAttrProp("_hide_data"))
    width = IntItem(_("Width(個數)"), help=_("總共幾個array"), min=1,
                    default=100).set_prop("display",
                                          hide=GetAttrProp("_hide_size"))
    height = IntItem(_("Height(長度)"), help=_("一個array的長度"), min=1,
                     default=1).set_prop("display",
                                         hide=GetAttrProp("_hide_size"))
Beispiel #15
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")),
        ("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"))
Beispiel #16
0
class ResponsiveDataSet(DataSet):
	#DataSetEditGroupBox
	#SIG_APPLY_BUTTON_CLICKED.connect(self.update_window)
	#self.update_groupboxes()
	
	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)
	
	string = StringItem("String", default="foobar"
	                    ).set_prop("display", callback=cb_example)
	results = TextItem("Results")
Beispiel #17
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)
Beispiel #18
0
 class ModifyParam(DataSet):
     """
     Modification Parameter Setting
     Linear:  New Array = a * Original Array + b <br>
     Moving Average: Decide point number(to get average, or regard it as sinc filter)
     """
     text = StringItem("New Name", default="Modify_" + name)
     a = FloatItem("a :", default=1.0)
     b = FloatItem("b :", default=0.0)
     _en = GetAttrProp("enable")
     enable = BoolItem(
         "Enable Moving Average",
         help="If disabled, the following parameters will be ignored",
         default=False).set_prop("display", store=_en)
     points = IntItem("Window", default=5,
                      min=1).set_prop("display",
                                      active=FuncProp(_en, lambda x: x))
Beispiel #19
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)
Beispiel #20
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)
Beispiel #21
0
class TestParameters(DataSet):
    """
    PPT Converter
Choose according to your function
    """

    #fname = FileOpenItem("Open file", "ppt", FILE_ppt.name)
    #_eg = StartGroup("Convert_Mode")
    PPTnames = FilesOpenItem("Open_files", ("ppt", "pptx"),
                             help="Input your PPT file")  ##list
    outpath = DirectoryItem("OutDirectory",
                            default=PPTnames._props["data"]["basedir"],
                            help="default is the PPt path")
    outname = StringItem('Outlabel', help="default is the ppt name ")
    dtime = DateTimeItem("Date/time", default=datetime.datetime(
        2017, 10, 10))  #text = TextItem("Text")
    g1 = BeginGroup("Convert_Mode")
    #    outMode = MultipleChoiceItem("",
    #                                  ["Raw", "Resized",
    #                                   ],help="(default concated)",default=(1,)).horizontal(1)#.set_pos(col=1)
    raw = BoolItem("Raw", default=False, help="normal mode").set_pos(col=0)
    _prop = GetAttrProp("resize")
    #choice = ChoiceItem('Choice', choices).set_prop("display", store=_prop)
    resize = BoolItem("Resized", default=True,
                      help="normal mode").set_pos(col=1).set_prop("display",
                                                                  store=_prop)
    newsize = IntItem("NewSize(width_dpi)",
                      default=709,
                      min=0,
                      help="if changed,dpi",
                      max=2160,
                      slider=True).set_pos(col=2).set_prop(
                          "display",
                          active=FuncProp(_prop, lambda x: x)).set_pos(col=2)
    _g1 = EndGroup("Convert_Mode")
    outFormat = MultipleChoiceItem(
        "OuterForm",
        ["Pngs", "Con_Pngs", "PDF", "HTML", "XML"],
        help="(default all)",
        default=(0, 1, 2, 3, 4),
    ).horizontal(1)
Beispiel #22
0
class TestExcel(DataSet):
    """
    zx_FileSelector
    """
    files = SubDataSetItem("ExcelFiles:")
    string = StringItem("SheetName:")


#==============================================================================
# if __name__ == "__main__":
#     # Create QApplication
#     import guidata
#     _app = guidata.qapplication()
#     #app.exec_()
#     e = TestParameters()
#     #e.view()
#     #e.floatarray[:, 0] = np.linspace( -5, 5, 50)
#     #print(e)
#     if e.edit():pass
# #        e.edit()
# #        print(e)
#     e.view()
#==============================================================================
#e.files.fnames
Beispiel #23
0
class TestParameters(DataSet):
    """
    PPT_Converter:Based on Glance
Choose according to your demond
    """
    def updatedir(self, item, value):
        print("\nitem: ", item, "\nvalue:", value)
        if self.PPTnames and value[0]:
            self.outpath = os.path.split(value[0])[0]
            print(os.path.split(value[0]))
            if len(value) > 0:  #如果只是选择了单个文件
                self.outprefix = os.path.basename(value[0]).split('.')[0]

            else:  #选了多个文件
                self.outpath = os.getcwdu()
                self.outprefix = None
            self.WebTitle = self.outprefix
            print("\nitem: ", self.outpath, "\nvalue:", self.WebTitle)
            #self.ImagesDirName=str(self.newsize)
#			self.htmlTitle=self.outprefix
#fname = FileOpenItem("Open file", "ppt", FILE_ppt.name)
#_eg = StartGroup("Convert_Mode")

    g0 = BeginGroup("Select Your PPTs to Manipulate")
    PPTnames = FilesOpenItem("OpenPPTs", ("ppt", "pptx"),
                             help="Select your PPT files",
                             all_files_first=True).set_prop(
                                 'display', callback=updatedir)  ##list
    outpath = DirectoryItem(
        "OutPath",
        help=
        "Select the output path.\nDefault is the path where you choose your PPT"
    ).set_prop('display', active=True)
    WebTitle = StringItem(
        'HTML/XML Title\n(Glance)',
        help=
        "The Title of the generated html/xml file.\nDefault is the PPT's filename"
    ).set_prop('display', active=True)
    outprefix = StringItem(
        'OutFilePrefix',
        help="The prefix of generated file .\nDefault is the ppt name "
    ).set_prop('display', active=True)
    _g0 = EndGroup("Select Your PPTs to Manipulate")

    g1 = BeginGroup("Select Your Convert_Mode")
    #    outMode = MultipleChoiceItem("",
    #                                  ["Raw", "Resized",
    #                                   ],help="(default concated)",default=(1,)).horizontal(1)#.set_pos(col=1)
    raw = BoolItem(
        "Raw",
        default=False,
        help=
        "Those Generated Files will Use Pngs Exported from PPT Slides Without any Crop or Resize"
    ).set_pos(col=0)
    _prop = GetAttrProp("resize")
    #choice = ChoiceItem('Choice', choices).set_prop("display", store=_prop)
    resize = BoolItem(
        "Resized",
        default=True,
        help=
        "Means You Want to Resize those Raw Pngs Before Use Them In Your Final Formats\ "
    ).set_pos(col=1).set_prop("display", store=_prop)
    newsize = IntItem("NewSize\n(width_dpi)",
                      default=709,
                      min=0,
                      help="The Value Must be lower than the raw png's Width!",
                      max=2160,
                      slider=True).set_prop("display",
                                            active=FuncProp(
                                                _prop, lambda x: x))
    ImagesDirName = StringItem(
        'ImagesDirName',
        help=
        "The DirName of Resized Pngs used in Html/Xml/LongPng file.\nDefault is the Png wideth size If You Leave It Empty"
    ).set_prop('display', active=FuncProp(_prop, lambda x: x))

    _g1 = EndGroup("Select Your Convert_Mode")
    g2 = BeginGroup("Which Format Do U Want To Generate")
    must = BoolItem(
        "Pngs",
        default=True,
        help="You Cannot Remove Pngs If You Want to Get Other Types."
    ).set_prop("display", active=0).set_pos(col=0)
    outFormat = MultipleChoiceItem(
        "Optional", ["Long_Png", "PDF", "HTML", "XML"],
        help=
        "(Default all,But I won't give U the Long_Png with Raw Pngs.\nAnd the 1st choice('Pngs') is default to generate.)",
        default=(1, 2, 3)).horizontal(1).set_pos(col=1)
    _g2 = EndGroup("Which Format Do U Want To Generate")
Beispiel #24
0
class ImageParam(DataSet):
    title = StringItem(_("Title"))
    width = IntItem(_("Width"), help=_("Image width (pixels)"))
    height = IntItem(_("Height"), help=_("Image height (pixels)"))
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)
Beispiel #26
0
class TestParameters_Light(TestParameters):
    date = StringItem("D1", default="Replacement for unsupported DateItem")
    dtime = StringItem("D2",
                       default="Replacement for unsupported DateTimeItem")
Beispiel #27
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)
Beispiel #28
0
 class Parameters(DataSet):
     name = StringItem('name', default = '')
Beispiel #29
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)