Skip to main content

Python Speckle Generator

Overview

This is a simple python package for generation of a speckle pattern based on user inputs for variables such as imageheight, imagewidth, speckle_radius, black and white balance. It perfoms fast fourier transform analysis on the generated speckle pattern and determines the average speckle size and gives a visualisation of the pattern.

How to install

clone the repository and install package:

git clone <repository-url>
cd speckles
python3 -m pip install -e

Structure of package

The package has three source code modules for two different ways of generating random speckles:

  • pattern.py generates the pattern by plotting a uniform grid of speckles based on the image size and the speckle spacing and displacing each point/speckle by a randomnly generated amount within a range. This allows you to quantify 'how random' the pattern is if you wanted to. Takes inputs for image dimensions, speckle radius, black and white balance for the pattern.
  • fft.py module for performing the fft analysis of the pattern, takes user inputs for saving/outputting the fourier spectrum. Outputs the average speckle size in pixels
  • alternate_speckle_generation.py generates the speckle pattern by simply creating a white image of the dimensions inputted by the user and then randomnly generating points/speckles and changing those pixels to black. The input for black and white balance is treated as a measure of the 'density of speckles' which is used with the image size and speckle size to calculate how many speckles/points need to be generated. There is no fourier analysis in this module.
.gitignore
LICENSE
README.md
pyproject.toml
src/
|
|---- speckles/
|       |---- __init__.py
|       |---- alternate_pattern.py  #pattern generated from filling random pixels on a white image - uses rectangular speckles
|       |---- fft.py                #fast fourier transform analysis module, outputs the average speckle size in pixels
|       |---- pattern.py            #pattern generated from random displacements from uniform grid - uses circular speckles
|---- examples/
|       |---- example_scrpit_one.py #runs the pattern in pattern.py and fft.py
|       |---- example_script_two.py #runs the alternate pattern generation

Metadata

Release files for speckles-afw39 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speckles-afw39 0.1.0
File Size Uploaded
speckles_afw39-0.1.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for speckles-afw39 0.1.0
File Interpreter ABI Platform
speckles_afw39-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / speckles_afw39-0.1.0.tar.gz

Download URL speckles_afw39-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8c3eaa3d9d2936511cd71fc06322e8f3bce9c38108e4072fd90440056d7f198f
BLAKE2b-256 checksum
How to use checksums
fd8e66babd455f2301c61d1d7b0793eaf09badcc1d7bd8130d1e54c509e59d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / speckles_afw39-0.1.0-py3-none-any.whl

Download URL speckles_afw39-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0f563e558a5aafd1ead6ce31ffd1b9516fc6b6b0f0b991f4b0e2b0d0f0e0b71
BLAKE2b-256 checksum
How to use checksums
e3e4575a71bbb2e64c986fc9a10ff996fdea9d0ffde0aace34ca50bf0b4edccb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.1.13

2 release files

0.1.12

2 release files

0.1.10

2 release files

0.1.9

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page