def testSpirals(): obj = SpiralPhasePlate() obj.maxHeight = 0.85 / 1.52 obj.radius = 4.275 obj.phiStep = 2 obj.radialStep = 0.2 obj.heightStep = 0.3 obj.N_HeightSteps = 7 obj.truncateBottom = False obj.minZ = -0.001 for i in [1, 2, 3, 4]: obj.N_Discontinuities = i obj.computePoints() obj.updateLimits() outfile1 = tempfile.gettempdir() + os.sep + 'spiralphaseplate_' + str( i) + '.gwl' outfile2 = tempfile.gettempdir() + os.sep + 'spiralphaseplate_' + str( i) + '.PP.gwl' obj.writeGWLWithPowerCompensation(outfile1) a = GWLobject() a.readGWL(outfile1) a.writeGWLWithPowerCompensation(outfile2) obj = SpiralPhasePlate() obj.truncateBottom = True obj.minZ = -1 obj.computePoints() obj.writeGWLWithPowerCompensation('foo.gwl') return
def ReadRotateWrite(infile): orig = GWLobject() orig.readGWL(infile) for alpha_deg in numpy.linspace(0, 45, 10): obj = copy.deepcopy(orig) obj.rotate([0, 0, 0], [0, 0, 1], alpha_deg) outfile = infile + '.alpha_' + str(alpha_deg) + '.gwl' obj.writeGWL(outfile) return
def main(): if len(sys.argv) > 4: INFILE = sys.argv[1] OUTFILE = sys.argv[2] LP0 = float(sys.argv[3]) K = float(sys.argv[4]) else: print('Usage: ' + sys.argv[0] + ' INFILE OUTFILE LP0 K', file=sys.stderr) sys.exit(-1) obj = GWLobject() obj.readGWL(INFILE) obj.addPowerCompensation(LP0, K) obj.writeGWL(OUTFILE)
#!/usr/bin/env python3 import sys from GWL.GWL_parser import GWLobject obj = GWLobject() obj.readGWL(sys.argv[1]) obj.writeGWL(sys.argv[2])
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # rotation example from GWL.GWL_parser import GWLobject if __name__ == '__main__': axis_point = [1, 2, 3] axis_direction = [1, 1, 1] angle_degrees = 45 filename_in = 'woodpile06um.gwl' filename_out = 'rotated.gwl' obj = GWLobject() obj.readGWL(filename_in) obj.rotate(axis_point, axis_direction, angle_degrees) obj.write_GWL(filename_out)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # rotation example from GWL.GWL_parser import GWLobject axis_point = [1,2,3] axis_direction = [1,1,1] angle_degrees = 45 filename_in = 'woodpile06um.gwl' filename_out = 'rotated.gwl' obj = GWLobject() obj.readGWL(filename_in) obj.rotate(axis_point, axis_direction, angle_degrees) obj.write_GWL(filename_out)