コード例 #1
0
    def __init__(self, calibrationFile, analyser="VNA"):
        self.laserPositioner = LaserPositioner(ProbeCalibration.fromFile(calibrationFile))

        if analyser == "VNA":
            self.analyzer = device.knownDevices["networkAnalyzer"]
            self.analyzer._hardPresetMethod = self.laserPositioner.robot.strobeLowGpio1
        elif analyser == "SA":
            self.analyzer = device.knownDevices["spectrumAnalyzer"]
            self.analyzer.reset()
            self.analyzer.span = Frequency(1000, "MHz")
            self.analyzer.centerFrequency = Frequency(500, "MHz")
            self.analyzer.numberOfAveragingPoints = 100  # 500 for D3
        else:
            raise ValueError, "Analyser choice not recognised"

        #        self.powerSupply = None
        self.powerSupply = device.knownDevices["powerSupply"]
        self.powerSupply.setChannelParameters(4, Voltage(12.0, "V"), Current(0.7, "A"))
        self.powerSupply.setChannelParameters(3, Voltage(9.0, "V"), Current(0.25, "A"))
        self.powerSupply.setChannelParameters(2, Voltage(5.0, "V"), Current(1.00, "A"))
        self.powerSupply.setChannelParameters(1, Voltage(3.3, "V"), Current(0.7, "A"))
コード例 #2
0
    def __init__(self,calibrationFile,analyser='VNA'):
        self.laserPositioner = LaserPositioner(ProbeCalibration.fromFile(calibrationFile))
        
        if analyser == 'VNA':
            self.analyzer = device.knownDevices['networkAnalyzer']
            self.analyzer._hardPresetMethod = self.laserPositioner.robot.strobeLowGpio1
        elif analyser == 'SA':
            self.analyzer = device.knownDevices['spectrumAnalyzer']
            self.analyzer.reset()    
            self.analyzer.span = Frequency(1000,'MHz')
            self.analyzer.centerFrequency = Frequency(500,'MHz')
            self.analyzer.numberOfAveragingPoints = 100 #500 for D3
        else:
            raise ValueError, 'Analyser choice not recognised'
        
        self.powerSupply = None
#        self.powerSupply = device.knownDevices['powerSupply']
#        self.powerSupply.setChannelParameters(4,Voltage(12.0,'V'),Current(1.4,'A'))
#        self.powerSupply.setChannelParameters(3,Voltage(9.0,'V'),Current(0.25,'A'))
#        self.powerSupply.setChannelParameters(2,Voltage(5.0,'V'),Current(1.00,'A'))
#        self.powerSupply.setChannelParameters(1,Voltage(3.3,'V'),Current(0.7,'A'))
        if not(self.powerSupply):
            print "Warning: the power supply is not remote controlled. If you need an LNA, switch it on manually."
コード例 #3
0
ファイル: nfsfile.py プロジェクト: eseo-emc/emctestbench
</EmissionScan>
''')
        self._xmlFileHandle.close()
        
    def writePoint(self,position,complexVoltages):
        self._dataFileHandle.write('{position[0]:.6f} {position[1]:.6f} {position[2]:.6f}'.format(position=position.asUnit('m')))
        complexVoltageArray = numpy.array(complexVoltages)
        for (realVoltage,imaginaryVoltage) in zip(complexVoltageArray.real.flat,complexVoltageArray.imag.flat):
            self._dataFileHandle.write(' {realVoltage:.6e} {imaginaryVoltage:.6e}'.format(realVoltage=realVoltage,imaginaryVoltage=imaginaryVoltage))
        self._dataFileHandle.write('\n')

    def writePoints(self,xGrid,yGrid,zCoordinate,complexVoltagesGrid):
        for (xCoordinate,yCoordinate,complexVoltage) in zip(xGrid.flat,yGrid.flat,complexVoltagesGrid.reshape(xGrid.size,self._frequencies.size).tolist()):
            position = Position(numpy.array([xCoordinate,yCoordinate,zCoordinate]),'m')            
            self.writePoint(position,complexVoltage)
            
if __name__ == '__main__':            
    import numpy
    frequencies = numpy.arange(1000000,10000000,1000000)
    (xGrid, yGrid) = numpy.meshgrid(numpy.arange(0,5.0,1)/1000,numpy.arange(0,4.0,1)/1000,indexing='ij')
    zPosition = 5.0/1000
    complexVoltagesGrid = numpy.random.random((5,4,9))
    
    calibration = ProbeCalibration.fromFile('Hy-5mm.xml')
    
    with NfsFile('Z:/Measurements/NFSE-in','D2-Hy-newstyle10',imageName='D2',calibration=calibration.electrical,frequencies=frequencies) as nfsFile:
        nfsFile.writePoints(xGrid,
                            yGrid,
                            zPosition,
                            complexVoltagesGrid)