Esempio n. 1
0
    def __init__(self):
        super(GuiDomain, self).__init__()

        layout = QtGui.QFormLayout()
        layout.setFieldGrowthPolicy(QtGui.QFormLayout.FieldsStayAtSizeHint)

        self.total_bits = QtGui.QSpinBox()
        self.samples_per_bit = QtGui.QSpinBox()
        self.bit_width = QtGui.QDoubleSpinBox()
        self.centre_nu = QtGui.QDoubleSpinBox()
        self.channels = QtGui.QSpinBox()

        set_spinbox_data(self.total_bits, value=1, minimum=1,
                         maximum=4096, single_step=1, decimals=None)
        set_spinbox_data(self.samples_per_bit, value=512, minimum=0,
                         maximum=262144, single_step=1, decimals=None)
        set_spinbox_data(self.bit_width, value=100.0, minimum=0.01,
                         maximum=1.0e4, single_step=1.0, decimals=2)
        set_spinbox_data(self.centre_nu, value=193.1, minimum=185.0,
                         maximum=400.0, single_step=0.001, decimals=3)
        set_spinbox_data(self.channels, value=1, minimum=1,
                         maximum=2, single_step=1, decimals=None)

        layout.addRow("Total bits to generate:", self.total_bits)
        layout.addRow("Number of samples per bit:", self.samples_per_bit)
        layout.addRow("Temporal with per bit:", self.bit_width)
        layout.addRow("Frequency of first channel:", self.centre_nu)
        layout.addRow("Number of channels to simulate:", self.channels)

        buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok)
        self.connect(buttons, QtCore.SIGNAL("accepted()"), self.close_dialog)
        layout.addRow(buttons)

        self.setLayout(layout)
Esempio n. 2
0
    def __init__(self):
        super(GuiSech, self).__init__()

        layout = QtGui.QFormLayout()
        layout.setFieldGrowthPolicy(QtGui.QFormLayout.FieldsStayAtSizeHint)

        self.name = QtGui.QLineEdit("sech")
        self.position = QtGui.QDoubleSpinBox()
        self.width = QtGui.QDoubleSpinBox()
        self.peak_power = QtGui.QDoubleSpinBox()
        self.offset_nu = QtGui.QDoubleSpinBox()
        self.chirp = QtGui.QDoubleSpinBox()
        self.initial_phase = QtGui.QDoubleSpinBox()
        self.channel = QtGui.QSpinBox()
        self.using_fwhm = QtGui.QCheckBox()

        set_spinbox_data(self.position, value=0.5, minimum=0.0,
                         maximum=1.0, single_step=0.01, decimals=2)
        set_spinbox_data(self.width, value=10.0, minimum=1.0e-3,
                         maximum=1.0e3, single_step=0.1, decimals=3)
        set_spinbox_data(self.peak_power, value=1.0e-3, minimum=0.0,
                         maximum=1.0e9, single_step=0.05, decimals=4)
        set_spinbox_data(self.offset_nu, value=0.0, minimum=-100.0,
                         maximum=100.0, single_step=0.001, decimals=3)
        set_spinbox_data(self.chirp, value=0.0, minimum=-1.0e3,
                         maximum=1.0e3, single_step=0.2, decimals=None)
        set_spinbox_data(self.initial_phase, value=0.0, minimum=0.0,
                         maximum=2.0 * np.pi, single_step=0.01, decimals=2)
        set_spinbox_data(self.channel, value=0, minimum=0,
                         maximum=1, single_step=1, decimals=None)

        layout.addRow("Name:", self.name)
        layout.addRow("Position:", self.position)
        layout.addRow("Width:", self.width)
        layout.addRow("Peak power:", self.peak_power)
        layout.addRow("Offset frequency:", self.offset_nu)
        layout.addRow("Chirp parameter:", self.chirp)
        layout.addRow("Initial phase:", self.initial_phase)
        layout.addRow("Channel:", self.channel)
        layout.addRow("Use FWHM measure:", self.using_fwhm)

        self.setLayout(layout)
Esempio n. 3
0
    def __init__(self):
        super(GuiFibre, self).__init__()

        layout = QtGui.QFormLayout()
        layout.setFieldGrowthPolicy(QtGui.QFormLayout.FieldsStayAtSizeHint)

        self.name = QtGui.QLineEdit("fibre")
        self.length = QtGui.QDoubleSpinBox()
        self.alpha = QtGui.QDoubleSpinBox()
        self.beta_2 = QtGui.QDoubleSpinBox()
        self.beta_3 = QtGui.QDoubleSpinBox()
        self.gamma = QtGui.QDoubleSpinBox()
        self.traces = QtGui.QSpinBox()
        self.total_steps = QtGui.QSpinBox()

        set_spinbox_data(self.length, value=1.0, minimum=0.0,
                         maximum=100.0, single_step=1.0e-3, decimals=5)
        set_spinbox_data(self.alpha, value=0.0, minimum=0.0,
                         maximum=5.0, single_step=0.01, decimals=4)
        set_spinbox_data(self.beta_2, value=0.0, minimum=-50.0,
                         maximum=50.0, single_step=0.01, decimals=4)
        set_spinbox_data(self.beta_3, value=0.0, minimum=-50.0,
                         maximum=50.0, single_step=0.01, decimals=4)
        set_spinbox_data(self.gamma, value=0.0, minimum=0.0,
                         maximum=1.0e3, single_step=0.01, decimals=4)
        set_spinbox_data(self.traces, value=1, minimum=0,
                         maximum=1000, single_step=1, decimals=None)
        set_spinbox_data(self.total_steps, value=100, minimum=1,
                         maximum=65536, single_step=1, decimals=None)

        layout.addRow("Name:", self.name)
        layout.addRow("Length:", self.length)
        layout.addRow("Attenuation:", self.alpha)
        layout.addRow("Second order dispersion:", self.beta_2)
        layout.addRow("Third order dispersion:", self.beta_3)
        layout.addRow("Nonlinearity:", self.gamma)
        layout.addRow("Number of traces:", self.traces)
        layout.addRow("Number of steps:", self.total_steps)

        self.setLayout(layout)
Esempio n. 4
0
    def __init__(self, system=None):
        super(GuiPlotter, self).__init__()

        self.system = system

        self.setWindowTitle("Field Plotter")

        self.module_outputs = QtGui.QComboBox()
        if system is not None:
            for label in system.fields:
                self.module_outputs.addItem(label)

        self.plot_types = QtGui.QComboBox()
        self.plot_types.addItems(
            QtCore.QStringList(["Single plot", "Map plot",
                                "Waterfall plot", "Animated plot"]))
        self.select_domain = QtGui.QComboBox()
        self.select_domain.addItems(
            QtCore.QStringList(["Temporal", "Spectral"]))

        self.filename = QtGui.QLineEdit()

        self.x_label = QtGui.QLineEdit()
        self.y_label = QtGui.QLineEdit()
        self.z_label = QtGui.QLineEdit()

        self.x_minimum = QtGui.QDoubleSpinBox()
        self.x_maximum = QtGui.QDoubleSpinBox()
        self.y_minimum = QtGui.QDoubleSpinBox()
        self.y_maximum = QtGui.QDoubleSpinBox()

        self.use_fill = QtGui.QCheckBox()
        self.use_fill.setChecked(True)
        self.fill_colour = QtGui.QLineEdit("blue")
        self.alpha = QtGui.QDoubleSpinBox()
        self.style = QtGui.QLineEdit("b-")

        self.use_colour = QtGui.QCheckBox()
        self.use_colour.setChecked(True)
        self.interpolation = QtGui.QComboBox()
        self.interpolation.addItem("lanczos")

        self.fps = QtGui.QSpinBox()
        self.clear_temp = QtGui.QCheckBox()
        self.clear_temp.setChecked(True)
        self.frame_prefix = QtGui.QLineEdit("_tmp")

        set_spinbox_data(self.x_minimum, value=None, minimum=-1.0e3,
                         maximum=1.0e3, single_step=0.1, decimals=3)
        set_spinbox_data(self.x_maximum, value=None, minimum=-1.0e3,
                         maximum=1.0e3, single_step=0.1, decimals=3)
        set_spinbox_data(self.alpha, value=0.2, minimum=0.0,
                         maximum=1.0, single_step=0.1, decimals=2)
        set_spinbox_data(self.y_minimum, value=None, minimum=-1.0e3,
                         maximum=1.0e3, single_step=0.005, decimals=4)
        set_spinbox_data(self.y_maximum, value=None, minimum=-1.0e3,
                         maximum=1.0e3, single_step=0.005, decimals=4)
        # Note default value of 10 (not 5 as in plotter.animated_plot):
        set_spinbox_data(self.fps, value=10, minimum=1,
                         maximum=100, single_step=1, decimals=None)

        general_layout = QtGui.QFormLayout()
        general_layout.setFieldGrowthPolicy(
            QtGui.QFormLayout.FieldsStayAtSizeHint)

        general_layout.addRow("Select module output:", self.module_outputs)
        general_layout.addRow("Select plot type:", self.plot_types)
        general_layout.addRow("Select domain:", self.select_domain)
        general_layout.addRow("Filename to save as:", self.filename)
        general_layout.addRow("Label for x-axis:", self.x_label)
        general_layout.addRow("Label for y-axis:", self.y_label)
        general_layout.addRow("Label for z-axis:", self.z_label)
        general_layout.addRow("Minimum for x-axis:", self.x_minimum)
        general_layout.addRow("Maximum for x-axis:", self.x_maximum)
        general_layout.addRow("Minimum for y-axis:", self.y_minimum)
        general_layout.addRow("Maximum for y-axis:", self.y_maximum)

        general_tab = QtGui.QWidget()
        general_tab.setLayout(general_layout)

        extras_layout = QtGui.QFormLayout()
        extras_layout.setFieldGrowthPolicy(
            QtGui.QFormLayout.FieldsStayAtSizeHint)

        extras_layout.addRow("Use fill for plots:", self.use_fill)
        extras_layout.addRow("Colour to use for fill:", self.fill_colour)
        extras_layout.addRow("Set transparency for fill:", self.alpha)
        extras_layout.addRow("Line style (colour and type):", self.style)
        extras_layout.addRow("Use colour in map plot:", self.use_colour)
        extras_layout.addRow("Interpolation method for map plot:",
                             self.interpolation)
        extras_layout.addRow("Frames per second for animation:", self.fps)
        extras_layout.addRow("Clear temporary files \nafter saving animation:",
                             self.clear_temp)
        extras_layout.addRow("Prefix for animation frames:", self.frame_prefix)

        extras_tab = QtGui.QWidget()
        extras_tab.setLayout(extras_layout)

        plot_option_tabs = QtGui.QTabWidget()
        plot_option_tabs.addTab(general_tab, "General options")
        plot_option_tabs.addTab(extras_tab, "Extra options")

        buttons = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
        self.connect(buttons, QtCore.SIGNAL("accepted()"), self.generate_plot)
        self.connect(buttons, QtCore.SIGNAL("rejected()"), self.close_dialog)

        main_layout = QtGui.QVBoxLayout()
        main_layout.addWidget(plot_option_tabs)
        main_layout.addWidget(buttons)

        self.setLayout(main_layout)