diff --git a/Cargo.toml b/Cargo.toml index 73bb947..4602c28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustfrc" -version = "0.1.2" +version = "1.0.0" edition = "2018" [lib] diff --git a/pyproject.toml b/pyproject.toml index 68303fa..a7bcbd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,10 @@ [tool.poetry] name = "rustfrc" -version = "0.1.2" +version = "1.0.0" description = "Package with some fast Rust functions for use with FRC resolution determination for microscopy. TU Delft BEP 2021-2022." authors = ["Tip ten Brink "] readme = "README.md" classifiers = [ - "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", "Programming Language :: Python", "Programming Language :: Rust", diff --git a/rustfrc/split.py b/rustfrc/split.py index 249697c..7525493 100644 --- a/rustfrc/split.py +++ b/rustfrc/split.py @@ -3,7 +3,8 @@ def binom_split(a: np.ndarray) -> np.ndarray: - """Takes an image (some) and splits every pixel value according to the + """Takes an image (numpy array) and splits every pixel (element) value according to the binomial distribution (n, p) with n = pixel value and p = 0.5. Returns a single image. + This conserves shot noise. """ return _internal.binom_split(a.astype(np.int32)) diff --git a/src/lib.rs b/src/lib.rs index 00b3c47..492ab02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,6 @@ fn rustfrc(py: Python<'_>, m: &PyModule) -> PyResult<()> { Ok(()) } - /// binom_split(a) /// -- /// @@ -31,6 +30,8 @@ fn binom_split<'py>(py: Python<'py>, a: PyReadonlyArrayDyn<'py, i32>) -> PyResul if error_i.load(Ordering::Relaxed) == 0 { let mut rng = thread_rng(); let n = u64::try_from(i).unwrap_or_else(|_| { + // Since this is a parallel function, a special AtomicI32 is necessary to communicate + // if there is a failure. error_i.store(i, Ordering::Relaxed); 0 });