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.10

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.10
File Size Uploaded
speckles_afw39-0.1.10.tar.gz 7.2 kB Details

Built distribution (wheel)

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

Total release size: 15.1 kB

Release files / speckles_afw39-0.1.10.tar.gz

Download URL speckles_afw39-0.1.10.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
777eb7ecf3d6322d91b331cc2ccc0545727034e2a57a96d58aa08ba8d78a40ed
BLAKE2b-256 checksum
How to use checksums
7afc7bfeede247d36d63d0af35d8a634cedea1b8e94ad0d3501c95104a7cfd6b
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.10-py3-none-any.whl

Download URL speckles_afw39-0.1.10-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73ad95aa86e42885debcfbc9ff7574e681645347cc0864febf8ea458bbfdb0fd
BLAKE2b-256 checksum
How to use checksums
ccd6ee60b86200c172cbb0aa8cc7e659dfeb0f9b5e0d5b969886a81604b74f83
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

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.0

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