Example #1
0
        self.wavelength = float(self.cal.field.GetValue())
        self.spec.calibrate(self.wavelength)
        self.update_label()


class MainFrame(wx.Frame):
    def __init__(self, spectrometer_instance):
        wx.Frame.__init__(self, None, -1, "%s Control" % spectrometer_instance)

        self.panel = Spectrometer(self, spectrometer_instance)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.panel, 1, wx.EXPAND)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)


if __name__ == "__main__":
    import sys

    if len(sys.argv) < 2:
        print("supply spex address as positional argument")
        sys.exit()
    else:
        addr = sys.argv[1]
    app = wx.App(False)
    app.frame = MainFrame(spex750m(addr))
    app.frame.Show()
    app.MainLoop()
Example #2
0
            for line in self.spexlines['Ar']:
                line.remove()

    def draw_spexlines(self, locs, color):
        wlmin, wlmax = self.disp.axes.get_xlim()
        nearlocs = [wl for wl in locs if (wl > wlmin and wl < wlmax)]
        return [self.disp.axes.axvline(wl, c=color, ls=':') for wl in nearlocs]


if __name__ == "__main__":
    # get command line args
    args = parser.parse_args()

    # if --spec is provided, open connection to spex
    if args.spec_addr is not None:
        spec = spex750m(args.spec_addr)
        initial_wl = spec.get_wl()
    else:
        spec = None
        initial_wl = args.wl

    if args.ip is not None:
        clnt = labview_client(center_wl=initial_wl, host=args.ip)
    else:
        print 'No IP address provided'
        print 'proceeding with FAKE DATA'
        clnt = Fake_Client()
        if spec is not None:
            clnt.center_wl = spec.wl

    app = wx.App(False)