File:Gaussianbeam intensity bw.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Gaussianbeam_intensity_bw.png(600 × 300 pixels, file size: 6 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Drawing of the intensity of a Gaussian beam propagating in horizontal direction, black on white.
Date
Source Own work
Author Geek3
Other versions


 
This plot was created with Matplotlib.

Source Code[edit]

The image is created by the following python source-code. Requirements:


Python Matplotlib source code
#!/usr/bin/env python
# -*- coding: utf8 -*-

'''
Copyright (C) 2015 Geek3, Wikimedia Foundation

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'''

from math import *
import scipy
from PIL import Image

w = 600
h = 300
image = scipy.zeros((h, w))


lambda_px = 24.
w0 = 24.

def I(r, z, w0):
    z0 = pi * w0**2 / lambda_px
    w = w0 * sqrt(1. + (z / z0)**2)
    E = w0 / w
    E *= e ** (-(r/w)**2)
    return abs(E)**2


for y in range(h):
    for x in range(w):
        z = (x + 0.5) - w / 2.0
        r = -(y + 0.5) + h / 2.0
        II = I(r, z, w0)
        image[y, x] = 1.0 - II


# write image to file
image_file = Image.new('L', (w, h))
for y in range(h):
    for x in range(w):
        c = int(2**8 * image[y, x])
        image_file.putpixel((x, y), c)
image_file.save('gaussianbeam_intensity_bw.png', 'PNG')

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
You may select the license of your choice.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current19:07, 12 July 2015Thumbnail for version as of 19:07, 12 July 2015600 × 300 (6 KB)Geek3 (talk | contribs)intensity plot of a gaussian beam

There are no pages that use this file.