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

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.11
File Size Uploaded
speckles_afw39-0.1.11.tar.gz 7.3 kB Details

Built distribution (wheel)

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

Total release size: 15.3 kB

Release files / speckles_afw39-0.1.11.tar.gz

Download URL speckles_afw39-0.1.11.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
702b107556d2e718df408bf78cf20bf9a44dbccf32dd23d28a142288112803cf
BLAKE2b-256 checksum
How to use checksums
0d98bf398bac83965fa38ed3d35afc3e765c2cc3030d76b4c2d067089c30f8bc
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.11-py3-none-any.whl

Download URL speckles_afw39-0.1.11-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a0947aa1bac96fb83f0a6276ef1319a5947e9ef9cb516a7eb10f7d9956f419d
BLAKE2b-256 checksum
How to use checksums
a52b536486fbb41e496445d2a8cb82898656a368c54536d6c539172339f7f348
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.11 This release

2 release files

0.1.10

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