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 ExampleMultiGroupDataSet(DataSet): param0 = ChoiceItem("Choice", ['deazdazk', 'aeazee', '87575757']) param1 = FloatItem("Foobar 1", default=0, min=0) t_group = BeginTabGroup("T group") a_group = BeginGroup("A group") param2 = FloatItem("Foobar 2", default=.93) dir1 = DirectoryItem("Directory 1") file1 = FileOpenItem("File 1") _a_group = EndGroup("A group") b_group = BeginGroup("B group") param3 = FloatItem("Foobar 3", default=123) _b_group = EndGroup("B group") c_group = BeginGroup("C group") param4 = FloatItem("Foobar 4", default=250) _c_group = EndGroup("C group") _t_group = EndTabGroup("T group")
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)