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)
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")
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")
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)
class NumericalInput(DataSet): """ Numerical Parameters Move Num. Steps slider to update the graphic """ mesh_x_size = IntItem("NX", default=40, min=2, max=401, slider=True) wave_speed = FloatItem("Wave Speed", default=1) step_size = FloatItem("Step Size", default=5e-3) num_of_steps = IntItem("Num. Steps", default=1, min=1, max=200, slider=True)
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)
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"))
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)
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"))
class Controlset(DataSet): Directory = DirectoryItem("Directory", default=os.path.abspath("../../data/")) _bt = BeginGroup("Configuration").set_pos(col=0) Frequency = FloatItem("Frequency", default=21.1, 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") Antenna = IntItem("Antenna offset", default=1000, unit="") NSpec = IntItem("Spectra per file", default=7000, unit="") _et = EndGroup("Configuration")
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)
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)
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)
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)
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)
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)
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'))
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"))
class FindData(DataSet): g1 = BeginGroup('Data Upload') fname = FileOpenItem('Open File', ('xlsx', 'xls')) _g1 = EndGroup('Data Upload') g2 = BeginGroup('Optional Parameters') enable = BoolItem('activate optional parameters', default=False).set_prop('display', store=prop1) rescore = IntItem('# of choices to score').set_prop('display', active=prop1) rescore6 = BoolItem('rescore 6 minutes', default=False) rescore12 = BoolItem('rescore 12 minutes', default=False) _g2 = EndGroup('Optional Parameters') save = FileSaveItem('create results', formats='xlsx')
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)
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))
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)
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)
class ImageParam(DataSet): title = StringItem(_("Title")) width = IntItem(_("Width"), help=_("Image width (pixels)")) height = IntItem(_("Height"), help=_("Image height (pixels)"))
class Parameters(DataSet): float1 = FloatItem("float #1", min=1, max=250, help="height in cm") float2 = FloatItem("float #2", min=1, max=250, help="width in cm") number = IntItem("number", min=3, max=20)
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")
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
class SGParam(DataSet): num_points = IntItem(_("Number of points"), default=8, min=2) poly_degree = IntItem(_("Polynom degree"), default=4, min=1) diff_order = 0
class Parameters(DataSet): height = FloatItem("Height", min=1, max=250, help="height in cm") width = FloatItem("Width", min=1, max=250, help="width in cm") number = IntItem("Number", min=3, max=20)
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)