コード例 #1
0
    def _updateInputs(self):
        with blockSignals(self.linput):
            self.linput.setValue(self.wl * 1e9)
        with blockSignals(self.kinput):
            self.kinput.setValue(self.wl.k0)
        with blockSignals(self.winput):
            self.winput.setValue(self.wl.omega * 1e-12)
        with blockSignals(self.finput):
            self.finput.setValue(self.wl.frequency * 1e-12)

        if self.wl < 1260e-9:
            self.band.setText("")
        elif self.wl < 1360e-9:
            self.band.setText("O band")
        elif self.wl < 1460e-9:
            self.band.setText("E band")
        elif self.wl < 1530e-9:
            self.band.setText("S band")
        elif self.wl < 1565e-9:
            self.band.setText("C band")
        elif self.wl < 1625e-9:
            self.band.setText("L band")
        elif self.wl <= 1675e-9:
            self.band.setText("U band")
        else:
            self.band.setText("")
コード例 #2
0
 def setRangeLayout(self, check=True):
     if self._setType('range', check):
         self.innerLayout.addWidget(self.rstartInput)
         self.innerLayout.addWidget(self.rendInput)
         self.innerLayout.addWidget(self.rnumInput)
     with blockSignals(self.rstartInput):
         self.rstartInput.setValue(self._value['start'] * self.scale)
     with blockSignals(self.rendInput):
         self.rendInput.setValue(self._value['end'] * self.scale)
     with blockSignals(self.rnumInput):
         self.rnumInput.setValue(self._value['num'])
コード例 #3
0
ファイル: mainwindow.py プロジェクト: timhellwig/fibermodes
    def load(self, filename):
        # Test for fiber file
        p, f = os.path.split(filename)
        b, e = os.path.splitext(f)
        fiberfile = os.path.join(p, b+".fiber")
        if os.path.exists(fiberfile):
            self.doc.filename = fiberfile
            self.fiberSelector.fileLoaded.emit()
        else:
            # Trouver fiberfile...
            print(fiberfile, "not found")
            return False

        self.stop_simulation()
        with open(filename, 'r') as f:
            s = json.load(f)
            self.wavelengthInput.setValue(s['wl'])
            self.modeSelector.setCurrentIndex(int(s['modes']))
            self.doc.params = s['params']
            for p, box in self.simParamBoxes.items():
                with blockSignals(box):
                    box.setChecked(p in self.doc.params)
            self.nuMaxInput.setValue(int(s['numax']))
            self.mMaxInput.setValue(int(s['mmax']))
            self.fiberSlider.fiberInput.setValue(int(s['fnum']))
            self.wavelengthSlider.wavelengthInput.setValue(int(s['wlnum']))
            self.actions['paramwin'].setChecked(s['panes']['params'])
            self.actions['tablewin'].setChecked(s['panes']['modes'])
            self.actions['graphwin'].setChecked(s['panes']['graph'])
            self.togglePanes()
            self.plotFrame.load(s['graph'])
        return True
コード例 #4
0
 def _updateInputs(self):
     if self.index is None:
         args = [self.conc] if self.iscomp else []
         self.index = self.material.n(self.wl, *args)
         with blockSignals(self.iinput):
             self.iinput.setValue(self.index)
     elif self.conc is None:
         self.conc = self.material.xFromN(self.wl, self.index)
         with blockSignals(self.cinput):
             self.cinput.setValue(self.conc * 100)
     elif self.wl is None:
         args = [self.conc] if self.iscomp else []
         self.wl = self.material.wlFromN(self.index, *args)
         if self.wl is None:
             self.wavelengthChanged(self.winput.value())
         else:
             with blockSignals(self.winput):
                 self.winput.setValue(self.wl * 1e9)
コード例 #5
0
 def _updateInputs(self):
     if self.index is None:
         args = [self.conc] if self.iscomp else []
         self.index = self.material.n(self.wl, *args)
         with blockSignals(self.iinput):
             self.iinput.setValue(self.index)
     elif self.conc is None:
         self.conc = self.material.xFromN(self.wl, self.index)
         with blockSignals(self.cinput):
             self.cinput.setValue(self.conc * 100)
     elif self.wl is None:
         args = [self.conc] if self.iscomp else []
         self.wl = self.material.wlFromN(self.index, *args)
         if self.wl is None:
             self.wavelengthChanged(self.winput.value())
         else:
             with blockSignals(self.winput):
                 self.winput.setValue(self.wl * 1e9)
コード例 #6
0
ファイル: mainwindow.py プロジェクト: timhellwig/fibermodes
    def toggle_wlcalc(self):
        if self.wlcalc is None:
            self.wlcalc = WavelengthCalculator(self)
            self.wlcalc.hidden.connect(self.actions['wlcalc'].toggle)

        if self.actions['wlcalc'].isChecked():
            self.wlcalc.show()
        else:
            with blockSignals(self.wlcalc):
                self.wlcalc.hide()
コード例 #7
0
ファイル: mainwindow.py プロジェクト: timhellwig/fibermodes
    def toggle_mcalc(self):
        if self.mcalc is None:
            self.mcalc = MaterialCalculator(self)
            self.mcalc.hidden.connect(self.actions['mcalc'].toggle)

        if self.actions['mcalc'].isChecked():
            self.mcalc.show()
        else:
            with blockSignals(self.mcalc):
                self.mcalc.hide()
コード例 #8
0
ファイル: mainwindow.py プロジェクト: timhellwig/fibermodes
 def selectLayer(self):
     index = self.layerList.currentRow()
     self.layerName.setEnabled(True)
     with blockSignals(self.layerName):
         self.layerName.setText(self.factory.layers[index].name)
     self.initGeom()
     self.initMat()
     if index == len(self.factory.layers) - 1:
         self.actions['remove'].setEnabled(False)
     else:
         self.actions['remove'].setEnabled(True)
コード例 #9
0
ファイル: mainwindow.py プロジェクト: timhellwig/fibermodes
    def initGeom(self):
        layerIndex = self.layerList.currentRow()
        if layerIndex == len(self.factory.layers) - 1:
            self.geomType.setEnabled(False)
        else:
            self.geomType.setEnabled(True)

        geomtype = self.factory.layers[layerIndex].type
        gtidx = self.geomType.findText(geomtype)
        # We call selectGeomType directly instead of emitting the signal,
        # to prevent it setting dirty state, since we only display the
        # current state, we are not changing the geometry type
        with blockSignals(self.geomType):
            self.geomType.setCurrentIndex(gtidx)
            self.selectGeomType(gtidx, False)
コード例 #10
0
ファイル: delegate.py プロジェクト: cbrunet/fibermodes
 def setEditorData(self, editor, index):
     val = index.data(self._role)
     idx = self._values.index(val) if self._values else val
     with blockSignals(editor):
         editor.setCurrentIndex(idx)
コード例 #11
0
ファイル: mainwindow.py プロジェクト: cbrunet/fibermodes
 def toggleOptions(self):
     if self.actions['options'].isChecked():
         self.options.show()
     else:
         with blockSignals(self.options):
             self.options.hide()
コード例 #12
0
 def setEditorData(self, editor, index):
     val = index.data(self._role)
     idx = self._values.index(val) if self._values else val
     with blockSignals(editor):
         editor.setCurrentIndex(idx)
コード例 #13
0
 def toggleOptions(self):
     if self.actions['options'].isChecked():
         self.options.show()
     else:
         with blockSignals(self.options):
             self.options.hide()