Skip to content

Commit

Permalink
Merge pull request #14 from rhoitink/develop
Browse files Browse the repository at this point in the history
Pull request for v1.6.0
  • Loading branch information
rhoitink authored Feb 19, 2024
2 parents 3091757 + d1aeec1 commit ed01ba1
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 96 deletions.
16 changes: 0 additions & 16 deletions .bumpversion.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/deploydocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ htmlcov
site
*.xyz
*.ipynb
src/simulatedmicroscopy/_version.py
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml # checks for correct yaml syntax for github actions ex.
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ keywords:
- point spread function
- image generation
license: MIT
version: "v1.5.0"
date-released: '2023-04-26'
version: "v1.6.0"
date-released: '2024-02-19'
7 changes: 4 additions & 3 deletions docs/data-generation-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ You convolved image is now saved in the `image` variable.

## 4. Optional: adding noise and downsampling the image

Adding Poisson noise and downsampling the image to a lower pixel size is included as well and can be done as follows:
Adding noise and downsampling the image to a lower pixel size is included as well and can be done as follows:

```python
# add Poisson noise with λ = 50
# downsample by a factor 2 in z and factor 3 in xy
image.noisify(50).downsample([2, 3, 3])
# add Poisson noise (shot noise) with a signal-to-noise ratio of 30
# add Gaussian noise (read noise, additive) with a mean value of 1e-5 and a signal-to-noise ratio of 50
image.downsample([2, 3, 3]).add_shot_noise(SNR = 30.0).add_read_noise(SNR = 50.0, background = 1e-5)
```

The downsampling by a factor two along a dimension, means that the number of pixels along that dimension is divided by two, which leads to an increase of the pixel size by a factor or two.
Expand Down
56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[build-system]
requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/simulatedmicroscopy/_version.py"

[tool.black]
line-length = 79
target-version = ['py38', 'py39', 'py310', 'py311']

[tool.ruff]
line-length = 79
select = [
"E", "F", "W", #flake8
"UP", # pyupgrade
"I", # isort
"BLE", # flake8-blind-exception
"B", # flake8-bugbear
"A", # flake8-builtins
"C4", # flake8-comprehensions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PIE", # flake8-pie
"SIM", # flake8-simplify
]

ignore = [
"E501",
"E203",
]

exclude = [
".bzr",
".direnv",
".eggs",
".git",
".mypy_cache",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"*vendored*",
"*_vendor*",
]

target-version = "py38"
fix = true
63 changes: 61 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,61 @@
[flake8]
ignore=E501,E203,W503
[metadata]
name = simulatedmicroscopy

description = Python package to create synthetic (fluorescence) microscopy images of (nano)particles and convolution with a point spread function
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/rhoitink/simulatedmicroscopy
author = Roy Hoitink
author_email = L.D.Hoitink@uu.nl
license = MIT
license_files = LICENSE
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Scientific/Engineering :: Image Processing
project_urls =
Bug Tracker = https://github.com/rhoitink/simulatedmicroscopy/issues
Documentation = https://github.com/rhoitink/simulatedmicroscopy#README.md
Source Code = https://github.com/rhoitink/simulatedmicroscopy
User Support = https://github.com/rhoitink/simulatedmicroscopy/issues

[options]
packages = find:
install_requires =
numpy
matplotlib
h5py
scipy
scikit-image>=0.20.0

python_requires = >=3.8
include_package_data = True
package_dir =
=src
setup_requires = setuptools_scm

[options.packages.find]
where = src

[options.extras_require]
dev =
black
flake8
pytest
pytest-cov
docs =
mkdocs
mkdocs-material
mkdocstrings[python]
mkdocs-gen-files
mkdocs-literate-nav
34 changes: 0 additions & 34 deletions setup.py

This file was deleted.

19 changes: 0 additions & 19 deletions simulatedmicroscopy/__init__.py

This file was deleted.

22 changes: 22 additions & 0 deletions src/simulatedmicroscopy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from .image import HuygensImage, Image
from .input import Coordinates
from .particle import Cube, PointParticle, Shell, Sphere, Spherocylinder
from .psf import GaussianPSF, HuygensPSF

try:
from ._version import version as __version__
except ImportError:
__version__ = "unknown"

__all__ = [
"Coordinates",
"Image",
"HuygensImage",
"HuygensPSF",
"GaussianPSF",
"PointParticle",
"Sphere",
"Shell",
"Spherocylinder",
"Cube",
]
Loading

0 comments on commit ed01ba1

Please sign in to comment.